SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShapeContainer.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Storage for geometrical objects, sorted by the layers they are in
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef ShapeContainer_h
22 #define ShapeContainer_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class Polygon;
42 class PointOfInterest;
43 class Position;
44 class PositionVector;
45 class RGBColor;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
56 public:
58  ShapeContainer() ;
59 
60 
62  virtual ~ShapeContainer() ;
63 
64 
65 
75  virtual bool addPoI(const std::string& name, int layer, const std::string& type,
76  const RGBColor& c, const Position& pos) ;
77 
78 
88  virtual bool addPolygon(const std::string& name, int layer,
89  const std::string& type, const RGBColor& c, bool filled, const PositionVector& shape) ;
90 
91 
92 
98  virtual bool removePolygon(int layer, const std::string& id) ;
99 
100 
106  virtual bool removePoI(int layer, const std::string& id) ;
107 
108 
109 
115  virtual void movePoI(int layer, const std::string& id, const Position& pos) ;
116 
117 
123  virtual void reshapePolygon(int layer, const std::string& id, const PositionVector& shape) ;
124 
125 
126 
132  const NamedObjectCont<Polygon*> &getPolygonCont(int layer) const ;
133 
134 
140  const NamedObjectCont<PointOfInterest*> &getPOICont(int layer) const ;
141 
142 
143 
147  int getMinLayer() const {
148  return myMinLayer;
149  }
150 
151 
155  int getMaxLayer() const {
156  return myMaxLayer;
157  }
158 
159 
160 protected:
166  bool add(int layer, Polygon* p) ;
167 
168 
174  bool add(int layer, PointOfInterest* p) ;
175 
176 
177 protected:
178  typedef std::map<std::string, Polygon*> PolyMap;
180  mutable std::map<int, NamedObjectCont<Polygon*> > myPolygonLayers;
181 
183  mutable std::map<int, NamedObjectCont<PointOfInterest*> > myPOILayers;
184 
186  mutable int myMinLayer, myMaxLayer;
187 
188 };
189 
190 
191 #endif
192 
193 /****************************************************************************/
194