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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 // A storage for loaded polygons and pois
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
26 #include <map>
27 #include <vector>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class Boundary;
35 class SUMOPolygon;
36 class PointOfInterest;
37 class OptionsCont;
38 class OutputDevice;
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
49 public:
55  PCPolyContainer(bool prune, const Boundary& pruningBoundary,
56  const std::vector<std::string>& removeByNames);
57 
58 
61 
62 
76  bool add(SUMOPolygon* poly, bool ignorePruning = false);
77 
78 
92  bool add(PointOfInterest* poi, bool ignorePruning = false);
93 
94 
95  void addLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat);
96 
102  void save(const std::string& file, bool useGeo);
103 
107  void saveDlrTDP(const std::string& prefix);
108 
109 
118  int getEnumIDFor(const std::string& key);
119 
120 
121 private:
122 
123  struct LanePos {
124  LanePos() {}
125  LanePos(const std::string& _laneID, double _pos, double _posLat) :
126  laneID(_laneID), pos(_pos), posLat(_posLat) {}
127  std::string laneID;
128  double pos;
129  double posLat;
130  };
131 
133  std::map<std::string, LanePos> myLanePosPois;
134 
136  std::map<std::string, int> myIDEnums;
137 
140 
142  bool myDoPrune;
143 
145  std::vector<std::string> myRemoveByNames;
146 
147  static void writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc);
148 
149 private:
152 
155 
156 
157 };
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
A storage for loaded polygons and pois.
std::map< std::string, LanePos > myLanePosPois
An id to pos map for lane pos specs.
void addLanePos(const std::string &poiID, const std::string &laneID, double lanePos, double lanePosLat)
static void writeDlrTDPHeader(OutputDevice &device, const OptionsCont &oc)
bool myDoPrune
Information whether the pruning boundary shall be used.
~PCPolyContainer()
Destructor.
PCPolyContainer(const PCPolyContainer &s)
Invalidated copy constructor.
void save(const std::string &file, bool useGeo)
Saves the stored polygons and pois into the given file.
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.
std::vector< std::string > myRemoveByNames
List of names of polygons/pois that shall be removed.
PCPolyContainer(bool prune, const Boundary &pruningBoundary, const std::vector< std::string > &removeByNames)
Constructor.
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.
PCPolyContainer & operator=(const PCPolyContainer &s)
Invalidated assignment operator.
Boundary myPruningBoundary
The boundary that described the rectangle within which an object must be in order to be kept.
A point-of-interest.
Storage for geometrical objects.
LanePos(const std::string &_laneID, double _pos, double _posLat)