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-2016 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>
38 #include <utils/shapes/Polygon.h>
40 #include <utils/geom/Boundary.h>
42 using namespace SUMO;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
53 public:
59  PCPolyContainer(bool prune, const Boundary& pruningBoundary,
60  const std::vector<std::string>& removeByNames);
61 
62 
64  ~PCPolyContainer();
65 
66 
82  bool insert(const std::string& id, Polygon* poly, int layer,
83  bool ignorePruning = false);
84 
85 
101  bool insert(const std::string& id, PointOfInterest* poi, int layer,
102  bool ignorePruning = false);
103 
104 
108  unsigned int getNoPolygons() {
109  return (unsigned int) myPolyCont.size();
110  }
111 
112 
116  unsigned int getNoPOIs() {
117  return (unsigned int) myPOICont.size();
118  }
119 
120 
125  void clear();
126 
127 
129  void report();
130 
131 
136  bool containsPolygon(const std::string& kidey);
137 
138 
144  void save(const std::string& file, bool useGeo);
145 
146 
155  int getEnumIDFor(const std::string& key);
156 
157 
158 public:
160  typedef std::map<std::string, Polygon*> PolyCont;
162  PolyCont myPolyCont;
163 
165  typedef std::map<std::string, PointOfInterest*> POICont;
167  POICont myPOICont;
168 
170  std::map<std::string, int> myIDEnums;
171 
173  std::map<Polygon*, int> myPolyLayerMap;
174 
176  std::map<PointOfInterest*, int> myPOILayerMap;
177 
178 
181 
183  bool myDoPrune;
184 
186  std::vector<std::string> myRemoveByNames;
187 
188 
189 private:
192 
194  PCPolyContainer& operator=(const PCPolyContainer& s);
195 
196 
197 };
198 
199 
200 #endif
201 
202 /****************************************************************************/
203 
unsigned int getNoPOIs()
Returns the number of stored pois.
POICont myPOICont
The poi container, accessed by the pois&#39; ids.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
A storage for loaded polygons and pois.
A 2D- or 3D-polygon.
Definition: Polygon.h:52
Boundary myPruningBoundary
The boundary that described the rectangle within which an object must be in order to be kept...
unsigned int getNoPolygons()
Returns the number of stored polygons.
std::map< std::string, int > myIDEnums
An id to int map for proper enumeration.
std::map< std::string, Polygon * > PolyCont
Definition of a container of polygons, accessed by the string key.
std::map< PointOfInterest *, int > myPOILayerMap
A map from pois to the layers they are located in.
std::map< Polygon *, int > myPolyLayerMap
A map from polygons to the layers they are located in.
std::vector< std::string > myRemoveByNames
List of names of polygons/pois that shall be removed.
Definition: Polygon.h:43
A point-of-interest.
std::map< std::string, PointOfInterest * > POICont
Definition of a container of pois, accessed by the string key.
PolyCont myPolyCont
The polygon container, accessed by the polygons&#39; ids.
bool myDoPrune
Information whether the pruning boundary shall be used.