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-2018 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 /****************************************************************************/
17 // A storage for type mappings
18 /****************************************************************************/
19 #ifndef PCTypeMap_h
20 #define PCTypeMap_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include "utils/common/RGBColor.h"
29 #include <string>
30 #include <map>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OptionsCont;
37 
45 class PCTypeMap {
46 public:
48  PCTypeMap(const OptionsCont& oc);
49 
50 
52  ~PCTypeMap();
53 
54 
59  struct TypeDef {
61  std::string id;
65  std::string prefix;
67  double layer;
69  bool discard;
71  bool allowFill;
72 
73  };
74 
75 
87  bool add(const std::string& id, const std::string& newid, const std::string& color,
88  const std::string& prefix, double layer, bool discard, bool allowFill);
89 
90 
98  const TypeDef& get(const std::string& id);
99 
100 
105  bool has(const std::string& id);
106 
108  const TypeDef& getDefault() {
109  return myDefaultType;
110  }
111 
112 protected:
114  std::map<std::string, TypeDef> myTypes;
115 
117 
118 };
119 
120 
121 #endif
122 
123 /****************************************************************************/
124 
std::string id
The new type id to use.
Definition: PCTypeMap.h:61
A single definition of values that shall be used for a given type.
Definition: PCTypeMap.h:59
double layer
The layer to use.
Definition: PCTypeMap.h:67
TypeDef myDefaultType
Definition: PCTypeMap.h:116
bool discard
Information whether polygons of this type shall be discarded.
Definition: PCTypeMap.h:69
RGBColor color
The color to use.
Definition: PCTypeMap.h:63
A storage for type mappings.
Definition: PCTypeMap.h:45
bool has(const std::string &id)
Returns the information whether the named type is known.
Definition: PCTypeMap.cpp:74
PCTypeMap(const OptionsCont &oc)
Constructor. The default type is constructed based on the given options.
Definition: PCTypeMap.cpp:35
~PCTypeMap()
Destructor.
Definition: PCTypeMap.cpp:45
std::string prefix
The prefix to use.
Definition: PCTypeMap.h:65
A storage for options typed value containers)
Definition: OptionsCont.h:92
const TypeDef & getDefault()
get the default type according to the given options
Definition: PCTypeMap.h:108
std::map< std::string, TypeDef > myTypes
A map of type names to type definitions.
Definition: PCTypeMap.h:114
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:49
bool allowFill
Information whether polygons of this type can be filled.
Definition: PCTypeMap.h:71