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 /****************************************************************************/
17 // A storage for loaded polygons and pois
18 /****************************************************************************/
19 #ifndef PCPolyContainer_h
20 #define PCPolyContainer_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <map>
30 #include <vector>
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class Boundary;
38 class SUMOPolygon;
39 class PointOfInterest;
40 class OptionsCont;
41 class OutputDevice;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
52 public:
58  PCPolyContainer(bool prune, const Boundary& pruningBoundary,
59  const std::vector<std::string>& removeByNames);
60 
61 
64 
65 
79  bool add(SUMOPolygon* poly, bool ignorePruning = false);
80 
81 
95  bool add(PointOfInterest* poi, bool ignorePruning = false);
96 
97 
98  void addLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat);
99 
105  void save(const std::string& file, bool useGeo);
106 
110  void saveDlrTDP(const std::string& prefix);
111 
112 
121  int getEnumIDFor(const std::string& key);
122 
123 
124 private:
125 
126  struct LanePos {
127  LanePos() {}
128  LanePos(const std::string& _laneID, double _pos, double _posLat) :
129  laneID(_laneID), pos(_pos), posLat(_posLat) {}
130  std::string laneID;
131  double pos;
132  double posLat;
133  };
134 
136  std::map<std::string, LanePos> myLanePosPois;
137 
139  std::map<std::string, int> myIDEnums;
140 
143 
145  bool myDoPrune;
146 
148  std::vector<std::string> myRemoveByNames;
149 
150  static void writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc);
151 
152 private:
155 
158 
159 
160 };
161 
162 
163 #endif
164 
165 /****************************************************************************/
166 
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:42
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:90
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:64
A point-of-interest.
bool myDoPrune
Information whether the pruning boundary shall be used.
static void writeDlrTDPHeader(OutputDevice &device, const OptionsCont &oc)