Eclipse SUMO - Simulation of Urban MObility
PCTypeMap.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2005-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // A storage for type mappings
17 /****************************************************************************/
18 #ifndef PCTypeMap_h
19 #define PCTypeMap_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include "utils/common/RGBColor.h"
28 #include <string>
29 #include <map>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class OptionsCont;
36 
44 class PCTypeMap {
45 public:
47  PCTypeMap(const OptionsCont& oc);
48 
49 
51  ~PCTypeMap();
52 
53 
58  struct TypeDef {
60  std::string id;
64  std::string prefix;
66  double layer;
68  double angle;
70  std::string imgFile;
72  bool discard;
74  bool allowFill;
75 
76  };
77 
78 
92  bool add(const std::string& id, const std::string& newid, const std::string& color,
93  const std::string& prefix, double layer, double angle, const std::string& imgFile,
94  bool discard, bool allowFill);
95 
96 
104  const TypeDef& get(const std::string& id);
105 
106 
111  bool has(const std::string& id);
112 
114  const TypeDef& getDefault() {
115  return myDefaultType;
116  }
117 
118 protected:
120  std::map<std::string, TypeDef> myTypes;
121 
123 
124 };
125 
126 
127 #endif
128 
129 /****************************************************************************/
130 
PCTypeMap::TypeDef::imgFile
std::string imgFile
The image file to use.
Definition: PCTypeMap.h:70
PCTypeMap::TypeDef::layer
double layer
The layer to use.
Definition: PCTypeMap.h:66
PCTypeMap::TypeDef::discard
bool discard
Information whether polygons of this type shall be discarded.
Definition: PCTypeMap.h:72
PCTypeMap::~PCTypeMap
~PCTypeMap()
Destructor.
Definition: PCTypeMap.cpp:44
PCTypeMap::myTypes
std::map< std::string, TypeDef > myTypes
A map of type names to type definitions.
Definition: PCTypeMap.h:120
PCTypeMap::getDefault
const TypeDef & getDefault()
get the default type according to the given options
Definition: PCTypeMap.h:114
PCTypeMap::get
const TypeDef & get(const std::string &id)
Returns a type definition.
Definition: PCTypeMap.cpp:70
RGBColor.h
RGBColor
Definition: RGBColor.h:39
PCTypeMap::PCTypeMap
PCTypeMap(const OptionsCont &oc)
Constructor. The default type is constructed based on the given options.
Definition: PCTypeMap.cpp:34
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
PCTypeMap::TypeDef::prefix
std::string prefix
The prefix to use.
Definition: PCTypeMap.h:64
PCTypeMap::has
bool has(const std::string &id)
Returns the information whether the named type is known.
Definition: PCTypeMap.cpp:76
PCTypeMap::add
bool add(const std::string &id, const std::string &newid, const std::string &color, const std::string &prefix, double layer, double angle, const std::string &imgFile, bool discard, bool allowFill)
Adds a type definition.
Definition: PCTypeMap.cpp:48
PCTypeMap::myDefaultType
TypeDef myDefaultType
Definition: PCTypeMap.h:122
config.h
PCTypeMap::TypeDef::id
std::string id
The new type id to use.
Definition: PCTypeMap.h:60
PCTypeMap::TypeDef::color
RGBColor color
The color to use.
Definition: PCTypeMap.h:62
PCTypeMap
A storage for type mappings.
Definition: PCTypeMap.h:44
PCTypeMap::TypeDef::allowFill
bool allowFill
Information whether polygons of this type can be filled.
Definition: PCTypeMap.h:74
PCTypeMap::TypeDef
A single definition of values that shall be used for a given type.
Definition: PCTypeMap.h:58
PCTypeMap::TypeDef::angle
double angle
The angle to use.
Definition: PCTypeMap.h:68