SUMO - Simulation of Urban MObility
PCPolyContainer.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A storage for loaded polygons and pois
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef PCPolyContainer_h
23 #define PCPolyContainer_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <map>
37 #include <vector>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class Boundary;
45 class SUMOPolygon;
46 class PointOfInterest;
47 class OptionsCont;
48 class OutputDevice;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
59 public:
65  PCPolyContainer(bool prune, const Boundary& pruningBoundary,
66  const std::vector<std::string>& removeByNames);
67 
68 
71 
72 
86  bool add(SUMOPolygon* poly, bool ignorePruning = false);
87 
88 
102  bool add(PointOfInterest* poi, bool ignorePruning = false);
103 
104 
105  void addLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat);
106 
112  void save(const std::string& file, bool useGeo);
113 
117  void saveDlrTDP(const std::string& prefix);
118 
119 
128  int getEnumIDFor(const std::string& key);
129 
130 
131 private:
132 
133  struct LanePos {
134  LanePos() {}
135  LanePos(const std::string& _laneID, double _pos, double _posLat) :
136  laneID(_laneID), pos(_pos), posLat(_posLat) {}
137  std::string laneID;
138  double pos;
139  double posLat;
140  };
141 
143  std::map<std::string, LanePos> myLanePosPois;
144 
146  std::map<std::string, int> myIDEnums;
147 
150 
152  bool myDoPrune;
153 
155  std::vector<std::string> myRemoveByNames;
156 
157  static void writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc);
158 
159 private:
162 
165 
166 
167 };
168 
169 
170 #endif
171 
172 /****************************************************************************/
173 
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:48
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:99
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:71
A point-of-interest.
bool myDoPrune
Information whether the pruning boundary shall be used.
static void writeDlrTDPHeader(OutputDevice &device, const OptionsCont &oc)