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 /****************************************************************************/
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  double angle;
71  std::string imgFile;
73  bool discard;
75  bool allowFill;
76 
77  };
78 
79 
93  bool add(const std::string& id, const std::string& newid, const std::string& color,
94  const std::string& prefix, double layer, double angle, const std::string& imgFile,
95  bool discard, bool allowFill);
96 
97 
105  const TypeDef& get(const std::string& id);
106 
107 
112  bool has(const std::string& id);
113 
115  const TypeDef& getDefault() {
116  return myDefaultType;
117  }
118 
119 protected:
121  std::map<std::string, TypeDef> myTypes;
122 
124 
125 };
126 
127 
128 #endif
129 
130 /****************************************************************************/
131 
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
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:49
double layer
The layer to use.
Definition: PCTypeMap.h:67
TypeDef myDefaultType
Definition: PCTypeMap.h:123
bool discard
Information whether polygons of this type shall be discarded.
Definition: PCTypeMap.h:73
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:77
double angle
The angle to use.
Definition: PCTypeMap.h:69
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:90
const TypeDef & getDefault()
get the default type according to the given options
Definition: PCTypeMap.h:115
std::map< std::string, TypeDef > myTypes
A map of type names to type definitions.
Definition: PCTypeMap.h:121
std::string imgFile
The image file to use.
Definition: PCTypeMap.h:71
bool allowFill
Information whether polygons of this type can be filled.
Definition: PCTypeMap.h:75