/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GeomConvHelper.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Sept 200318///19// Some helping functions for geometry parsing20/****************************************************************************/21#pragma once22#include <config.h>2324#include <string>25#include <utils/geom/PositionVector.h>26#include <utils/geom/Boundary.h>272829// ===========================================================================30// class definitions31// ===========================================================================32/**33* @class GeomConvHelper34* This class holds some helping functions for the parsing of geometries35*/36class GeomConvHelper {37public:38/** @brief Builds a PositionVector from a string representation, reporting occurred errors39*40* It is assumed, the vector is stored as "x,y[ x,y]*" where x and y are doubles.41* @param[in] shpdef The shape definition to parse42* @param[in] objecttype The name of the parsed object type; used for error message generation43* @param[in] objectid The name of the parsed object; used for error message generation44* @param[out] ok Whether the value could be read45* @param[in] allowEmpty Whether an empty shape definition is valid46* @param[in] report Whether errors shall be written to msg handler's error instance47* @return The parsed position vector48*/49static PositionVector parseShapeReporting(const std::string& shpdef, const std::string& objecttype,50const char* objectid, bool& ok, bool allowEmpty, bool report = true);515253/** @brief Builds a boundary from its string representation, reporting occurred errors54*55* It is assumed that the boundary is stored as a quadruple of double, divided by ','.56* @param[in] def The boundary definition to parse57* @param[in] objecttype The name of the parsed object type; used for error message generation58* @param[in] objectid The name of the parsed object; used for error message generation59* @param[out] ok Whether the value could be read60* @param[in] report Whether errors shall be written to msg handler's error instance61* @param[in] offsets Whether inverted values (i.e. xmin > xmax) shall be kept rather than corrected62* @return The parsed boundary63*/64static Boundary parseBoundaryReporting(const std::string& def, const std::string& objecttype,65const char* objectid, bool& ok, bool report = true, bool offsets = false);666768private:69/** @brief Writes an error message into the MessageHandler70* @param[in] report Whether errors shall be written to msg handler's error instance71* @param[in] what Name of the parsed object ("Shape", or "Boundary")72* @param[in] objecttype The name of the parsed object type the error occurred at73* @param[in] objectid The name of the parsed object type the error occurred at74* @param[out] desc Error description75*/76static void emitError(bool report, const std::string& what, const std::string& objecttype,77const char* objectid, const std::string& desc);787980};818283