SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PCTypeMap.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A storage for type mappings
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
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  int 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, int 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
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 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:58
bool has(const std::string &id)
Returns the information whether the named type is known.
Definition: PCTypeMap.cpp:83
PCTypeMap(const OptionsCont &oc)
Constructor. The default type is constructed based on the given options.
Definition: PCTypeMap.cpp:44
~PCTypeMap()
Destructor.
Definition: PCTypeMap.cpp:54
std::string prefix
The prefix to use.
Definition: PCTypeMap.h:71
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:114
std::map< std::string, TypeDef > myTypes
A map of type names to type definitions.
Definition: PCTypeMap.h:120
int layer
The layer to use.
Definition: PCTypeMap.h:73
bool allowFill
Information whether polygons of this type can be filled.
Definition: PCTypeMap.h:77