SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PCTypeMap.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A storage for type mappings
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2005-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef PCTypeMap_h
23 #define PCTypeMap_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include "utils/common/RGBColor.h"
36 #include <string>
37 #include <map>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class OptionsCont;
44 
52 class PCTypeMap {
53 public:
55  PCTypeMap(const OptionsCont& oc);
56 
57 
59  ~PCTypeMap();
60 
61 
66  struct TypeDef {
68  std::string id;
72  std::string prefix;
74  int layer;
76  bool discard;
78  bool allowFill;
79 
80  };
81 
82 
94  bool add(const std::string& id, const std::string& newid, const std::string& color,
95  const std::string& prefix, int layer, 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:68
A single definition of values that shall be used for a given type.
Definition: PCTypeMap.h:66
TypeDef myDefaultType
Definition: PCTypeMap.h:123
bool discard
Information whether polygons of this type shall be discarded.
Definition: PCTypeMap.h:76
RGBColor color
The color to use.
Definition: PCTypeMap.h:70
A storage for type mappings.
Definition: PCTypeMap.h:52
bool add(const std::string &id, const std::string &newid, const std::string &color, const std::string &prefix, int layer, bool discard, bool allowFill)
Adds a type definition.
Definition: PCTypeMap.cpp:60
bool has(const std::string &id)
Returns the information whether the named type is known.
Definition: PCTypeMap.cpp:85
PCTypeMap(const OptionsCont &oc)
Constructor. The default type is constructed based on the given options.
Definition: PCTypeMap.cpp:46
~PCTypeMap()
Destructor.
Definition: PCTypeMap.cpp:56
std::string prefix
The prefix to use.
Definition: PCTypeMap.h:72
A storage for options typed value containers)
Definition: OptionsCont.h:108
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
int layer
The layer to use.
Definition: PCTypeMap.h:74
bool allowFill
Information whether polygons of this type can be filled.
Definition: PCTypeMap.h:78