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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // A storage for type mappings
20 /****************************************************************************/
21 #ifndef PCTypeMap_h
22 #define PCTypeMap_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include "utils/common/RGBColor.h"
35 #include <string>
36 #include <map>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class OptionsCont;
43 
51 class PCTypeMap {
52 public:
54  PCTypeMap(const OptionsCont& oc);
55 
56 
58  ~PCTypeMap();
59 
60 
65  struct TypeDef {
67  std::string id;
71  std::string prefix;
73  double layer;
75  bool discard;
77  bool allowFill;
78 
79  };
80 
81 
93  bool add(const std::string& id, const std::string& newid, const std::string& color,
94  const std::string& prefix, double layer, 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 
std::string id
The new type id to use.
Definition: PCTypeMap.h:67
A single definition of values that shall be used for a given type.
Definition: PCTypeMap.h:65
double layer
The layer to use.
Definition: PCTypeMap.h:73
TypeDef myDefaultType
Definition: PCTypeMap.h:122
bool discard
Information whether polygons of this type shall be discarded.
Definition: PCTypeMap.h:75
RGBColor color
The color to use.
Definition: PCTypeMap.h:69
A storage for type mappings.
Definition: PCTypeMap.h:51
bool has(const std::string &id)
Returns the information whether the named type is known.
Definition: PCTypeMap.cpp:80
PCTypeMap(const OptionsCont &oc)
Constructor. The default type is constructed based on the given options.
Definition: PCTypeMap.cpp:41
~PCTypeMap()
Destructor.
Definition: PCTypeMap.cpp:51
std::string prefix
The prefix to use.
Definition: PCTypeMap.h:71
A storage for options typed value containers)
Definition: OptionsCont.h:98
const TypeDef & getDefault()
get the default type according to the given options
Definition: PCTypeMap.h:114
std::map< std::string, TypeDef > myTypes
A map of type names to type definitions.
Definition: PCTypeMap.h:120
bool add(const std::string &id, const std::string &newid, const std::string &color, const std::string &prefix, double layer, bool discard, bool allowFill)
Adds a type definition.
Definition: PCTypeMap.cpp:55
bool allowFill
Information whether polygons of this type can be filled.
Definition: PCTypeMap.h:77