SUMO - Simulation of Urban MObility
PCPolyContainer.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 loaded polygons and pois
20 /****************************************************************************/
21 #ifndef PCPolyContainer_h
22 #define PCPolyContainer_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 <string>
35 #include <map>
36 #include <vector>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class Boundary;
44 class SUMOPolygon;
45 class PointOfInterest;
46 class OptionsCont;
47 class OutputDevice;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
58 public:
64  PCPolyContainer(bool prune, const Boundary& pruningBoundary,
65  const std::vector<std::string>& removeByNames);
66 
67 
70 
71 
85  bool add(SUMOPolygon* poly, bool ignorePruning = false);
86 
87 
101  bool add(PointOfInterest* poi, bool ignorePruning = false);
102 
103 
104  void addLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat);
105 
111  void save(const std::string& file, bool useGeo);
112 
116  void saveDlrTDP(const std::string& prefix);
117 
118 
127  int getEnumIDFor(const std::string& key);
128 
129 
130 private:
131 
132  struct LanePos {
133  LanePos() {}
134  LanePos(const std::string& _laneID, double _pos, double _posLat) :
135  laneID(_laneID), pos(_pos), posLat(_posLat) {}
136  std::string laneID;
137  double pos;
138  double posLat;
139  };
140 
142  std::map<std::string, LanePos> myLanePosPois;
143 
145  std::map<std::string, int> myIDEnums;
146 
149 
151  bool myDoPrune;
152 
154  std::vector<std::string> myRemoveByNames;
155 
156  static void writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc);
157 
158 private:
161 
164 
165 
166 };
167 
168 
169 #endif
170 
171 /****************************************************************************/
172 
PCPolyContainer(bool prune, const Boundary &pruningBoundary, const std::vector< std::string > &removeByNames)
Constructor.
bool add(SUMOPolygon *poly, bool ignorePruning=false)
Adds a polygon to the storage.
void saveDlrTDP(const std::string &prefix)
Saves the stored polygons and pois into the given file in dlrTDP format.
void save(const std::string &file, bool useGeo)
Saves the stored polygons and pois into the given file.
Storage for geometrical objects.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
A storage for loaded polygons and pois.
void addLanePos(const std::string &poiID, const std::string &laneID, double lanePos, double lanePosLat)
Boundary myPruningBoundary
The boundary that described the rectangle within which an object must be in order to be kept...
LanePos(const std::string &_laneID, double _pos, double _posLat)
std::map< std::string, LanePos > myLanePosPois
An id to pos map for lane pos specs.
PCPolyContainer & operator=(const PCPolyContainer &s)
Invalidated assignment operator.
~PCPolyContainer()
Destructor.
std::map< std::string, int > myIDEnums
An id to int map for proper enumeration.
int getEnumIDFor(const std::string &key)
Retuns a unique id for a given name.
A storage for options typed value containers)
Definition: OptionsCont.h:98
std::vector< std::string > myRemoveByNames
List of names of polygons/pois that shall be removed.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
A point-of-interest.
bool myDoPrune
Information whether the pruning boundary shall be used.
static void writeDlrTDPHeader(OutputDevice &device, const OptionsCont &oc)