/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2005-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 PCTypeMap.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @author Jakob Erdmann17/// @date Mon, 05 Dec 200518///19// A storage for type mappings20/****************************************************************************/21#pragma once22#include <config.h>2324#include "utils/common/RGBColor.h"25#include <string>26#include <map>272829// ===========================================================================30// class declarations31// ===========================================================================32class OptionsCont;3334/**35* @class PCTypeMap36* @brief A storage for type mappings37*38* This class holds the mappings between names of read polygon/poi types and the39* values (color, new type name etc.) that shall be assigned to them.40*/41class PCTypeMap {4243public:44/// @brief Constructor. The default type is constructed based on the given options45PCTypeMap(const OptionsCont& oc);4647/// @brief Destructor48~PCTypeMap();4950enum class Filltype {51NOFILL = 0,52FILL = 1,53FORCE = 254};5556/**57* @struct TypeDef58* @brief A single definition of values that shall be used for a given type59*/60struct TypeDef {61/// @brief The new type id to use62std::string id;63/// @brief The color to use64RGBColor color;65/// @brief The prefix to use66std::string prefix;67/// @brief the icon to use68std::string icon;69/// @brief The layer to use70double layer;71/// @brief The angle to use72double angle;73/// @brief The image file to use74std::string imgFile;75/// @brief Information whether polygons of this type shall be discarded76bool discard;77/// @brief Information whether polygons of this type can be filled78Filltype allowFill;79};8081/** @brief Adds a type definition82*83* @param[in] id The original id of the type84* @param[in] newid The new id (name) of the type85* @param[in] color The color to set for imported objects of this type86* @param[in] prefix The prefix to prepend to the read names of this type's objects87* @param[in] layer The layer number to set for this type's objects88* @param[in] icon The icon for this type's objects89* @param[in] angle The angle to rotate this type's objects90* @param[in] imgFile The image file used as texture for objects of this type91* @param[in] discard Whether objects of this type shall be discarded92* @param[in] allowFill Whether objects of this type may be filled93* @return Whether the type could been added (was not known before)94*/95bool add(const std::string& id, const std::string& newid, const std::string& color,96const std::string& prefix, const std::string& icon, double layer,97double angle, const std::string& imgFile, bool discard, Filltype allowFill);9899/** @brief Returns a type definition100*101* This type definition MUST have been added otherwise the further process102* is undefined.103* @param[in] id The id of the type to get the definitions of104* @return Definition of the named type105*/106const TypeDef& get(const std::string& id);107108/** @brief Returns the information whether the named type is known109* @param[in] id The id of the type110* @return Whether a definition of the named type was added before111*/112bool has(const std::string& id);113114/// @brief get the default type according to the given options115const TypeDef& getDefault() {116return myDefaultType;117}118119/// @brief retrieve all known types120const std::map<std::string, TypeDef>& getTypes() const {121return myTypes;122}123124protected:125/// @brief A map of type names to type definitions126std::map<std::string, TypeDef> myTypes;127128TypeDef myDefaultType;129130};131132133