Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
PCTypeMap.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2005-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// A storage for type mappings
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
26#include <string>
27#include <map>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class OptionsCont;
34
42class PCTypeMap {
43
44public:
46 PCTypeMap(const OptionsCont& oc);
47
49 ~PCTypeMap();
50
51 enum class Filltype {
52 NOFILL = 0,
53 FILL = 1,
55 };
56
61 struct TypeDef {
63 std::string id;
67 std::string prefix;
69 std::string icon;
71 double layer;
73 double angle;
75 std::string imgFile;
77 bool discard;
80 };
81
96 bool add(const std::string& id, const std::string& newid, const std::string& color,
97 const std::string& prefix, const std::string& icon, double layer,
98 double angle, const std::string& imgFile, bool discard, Filltype allowFill);
99
107 const TypeDef& get(const std::string& id);
108
113 bool has(const std::string& id);
114
117 return myDefaultType;
118 }
119
121 const std::map<std::string, TypeDef>& getTypes() const {
122 return myTypes;
123 }
124
125protected:
127 std::map<std::string, TypeDef> myTypes;
128
130
131};
A storage for options typed value containers).
Definition OptionsCont.h:89
const TypeDef & getDefault()
get the default type according to the given options
Definition PCTypeMap.h:116
~PCTypeMap()
Destructor.
Definition PCTypeMap.cpp:44
PCTypeMap(const OptionsCont &oc)
Constructor. The default type is constructed based on the given options.
Definition PCTypeMap.cpp:33
const std::map< std::string, TypeDef > & getTypes() const
retrieve all known types
Definition PCTypeMap.h:121
const TypeDef & get(const std::string &id)
Returns a type definition.
Definition PCTypeMap.cpp:70
bool add(const std::string &id, const std::string &newid, const std::string &color, const std::string &prefix, const std::string &icon, double layer, double angle, const std::string &imgFile, bool discard, Filltype allowFill)
Adds a type definition.
Definition PCTypeMap.cpp:48
TypeDef myDefaultType
Definition PCTypeMap.h:129
std::map< std::string, TypeDef > myTypes
A map of type names to type definitions.
Definition PCTypeMap.h:127
bool has(const std::string &id)
Returns the information whether the named type is known.
Definition PCTypeMap.cpp:76
A single definition of values that shall be used for a given type.
Definition PCTypeMap.h:61
std::string icon
the icon to use
Definition PCTypeMap.h:69
bool discard
Information whether polygons of this type shall be discarded.
Definition PCTypeMap.h:77
std::string prefix
The prefix to use.
Definition PCTypeMap.h:67
double layer
The layer to use.
Definition PCTypeMap.h:71
double angle
The angle to use.
Definition PCTypeMap.h:73
std::string imgFile
The image file to use.
Definition PCTypeMap.h:75
std::string id
The new type id to use.
Definition PCTypeMap.h:63
RGBColor color
The color to use.
Definition PCTypeMap.h:65
Filltype allowFill
Information whether polygons of this type can be filled.
Definition PCTypeMap.h:79