Eclipse 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-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 /****************************************************************************/
16 // A storage for loaded polygons and pois
17 /****************************************************************************/
18 #ifndef PCPolyContainer_h
19 #define PCPolyContainer_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <map>
29 #include <vector>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class Boundary;
37 class SUMOPolygon;
38 class PointOfInterest;
39 class OptionsCont;
40 class OutputDevice;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
51 public:
57  PCPolyContainer(bool prune, const Boundary& pruningBoundary,
58  const std::vector<std::string>& removeByNames);
59 
60 
63 
64 
78  bool add(SUMOPolygon* poly, bool ignorePruning = false);
79 
80 
94  bool add(PointOfInterest* poi, bool ignorePruning = false);
95 
96 
97  void addLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat);
98 
104  void save(const std::string& file, bool useGeo);
105 
109  void saveDlrTDP(const std::string& prefix);
110 
111 
120  int getEnumIDFor(const std::string& key);
121 
122 
123 private:
124 
125  struct LanePos {
126  LanePos() {}
127  LanePos(const std::string& _laneID, double _pos, double _posLat) :
128  laneID(_laneID), pos(_pos), posLat(_posLat) {}
129  std::string laneID;
130  double pos;
131  double posLat;
132  };
133 
135  std::map<std::string, LanePos> myLanePosPois;
136 
138  std::map<std::string, int> myIDEnums;
139 
142 
144  bool myDoPrune;
145 
147  std::vector<std::string> myRemoveByNames;
148 
149  static void writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc);
150 
151 private:
154 
157 
158 
159 };
160 
161 
162 #endif
163 
164 /****************************************************************************/
165 
PCPolyContainer::saveDlrTDP
void saveDlrTDP(const std::string &prefix)
Saves the stored polygons and pois into the given file in dlrTDP format.
Definition: PCPolyContainer.cpp:150
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
PCPolyContainer::getEnumIDFor
int getEnumIDFor(const std::string &key)
Retuns a unique id for a given name.
Definition: PCPolyContainer.cpp:203
PCPolyContainer::PCPolyContainer
PCPolyContainer(bool prune, const Boundary &pruningBoundary, const std::vector< std::string > &removeByNames)
Constructor.
Definition: PCPolyContainer.cpp:44
ShapeContainer
Storage for geometrical objects.
Definition: ShapeContainer.h:49
PCPolyContainer::LanePos::laneID
std::string laneID
Definition: PCPolyContainer.h:129
PCPolyContainer::LanePos::posLat
double posLat
Definition: PCPolyContainer.h:131
PCPolyContainer::addLanePos
void addLanePos(const std::string &poiID, const std::string &laneID, double lanePos, double lanePosLat)
Definition: PCPolyContainer.cpp:97
PCPolyContainer::writeDlrTDPHeader
static void writeDlrTDPHeader(OutputDevice &device, const OptionsCont &oc)
Definition: PCPolyContainer.cpp:134
PCPolyContainer::add
bool add(SUMOPolygon *poly, bool ignorePruning=false)
Adds a polygon to the storage.
Definition: PCPolyContainer.cpp:58
PCPolyContainer::LanePos::LanePos
LanePos(const std::string &_laneID, double _pos, double _posLat)
Definition: PCPolyContainer.h:127
PCPolyContainer::LanePos::LanePos
LanePos()
Definition: PCPolyContainer.h:126
PCPolyContainer::~PCPolyContainer
~PCPolyContainer()
Destructor.
Definition: PCPolyContainer.cpp:51
PCPolyContainer::LanePos::pos
double pos
Definition: PCPolyContainer.h:130
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
PCPolyContainer::operator=
PCPolyContainer & operator=(const PCPolyContainer &s)
Invalidated assignment operator.
PCPolyContainer::LanePos
Definition: PCPolyContainer.h:125
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
PCPolyContainer::myPruningBoundary
Boundary myPruningBoundary
The boundary that described the rectangle within which an object must be in order to be kept.
Definition: PCPolyContainer.h:141
PCPolyContainer::myDoPrune
bool myDoPrune
Information whether the pruning boundary shall be used.
Definition: PCPolyContainer.h:144
SUMOPolygon
Definition: SUMOPolygon.h:46
PCPolyContainer::save
void save(const std::string &file, bool useGeo)
Saves the stored polygons and pois into the given file.
Definition: PCPolyContainer.cpp:103
PCPolyContainer::myRemoveByNames
std::vector< std::string > myRemoveByNames
List of names of polygons/pois that shall be removed.
Definition: PCPolyContainer.h:147
PCPolyContainer::myIDEnums
std::map< std::string, int > myIDEnums
An id to int map for proper enumeration.
Definition: PCPolyContainer.h:138
PCPolyContainer::myLanePosPois
std::map< std::string, LanePos > myLanePosPois
An id to pos map for lane pos specs.
Definition: PCPolyContainer.h:135
PCPolyContainer
A storage for loaded polygons and pois.
Definition: PCPolyContainer.h:50
config.h
ShapeContainer.h
PointOfInterest
A point-of-interest.
Definition: PointOfInterest.h:43