#include <ShapeContainer.h>

Definition at line 45 of file ShapeContainer.h.
Public Member Functions | |
| virtual bool | add (int layer, PointOfInterest *p) throw () |
| Adds a PoI to the container. | |
| virtual bool | add (int layer, Polygon2D *p) throw () |
| Adds a polygon to the container. | |
| int | getMaxLayer () const throw () |
| Returns the highest layer. | |
| int | getMinLayer () const throw () |
| Returns the lowest layer. | |
| const NamedObjectCont < PointOfInterest * > & | getPOICont (int layer) const throw () |
| Returns the polygons located at the given layer. | |
| const NamedObjectCont < Polygon2D * > & | getPolygonCont (int layer) const throw () |
| Returns the polygons located at the given layer. | |
| virtual bool | removePOI (int layer, const std::string &id) throw () |
| Removes a PoI from the container. | |
| virtual bool | removePolygon (int layer, const std::string &id) throw () |
| Removes a polygon from the container. | |
| ShapeContainer () throw () | |
| Constructor. | |
| virtual | ~ShapeContainer () throw () |
| Destructor. | |
Private Attributes | |
| int | myMaxLayer |
| int | myMinLayer |
| The minimum and the maximum layers. | |
| std::map< int, NamedObjectCont < PointOfInterest * > > | myPOILayers |
| POI layers. | |
| std::map< int, NamedObjectCont < Polygon2D * > > | myPolygonLayers |
| Polygon layers. | |
| ShapeContainer::ShapeContainer | ( | ) | throw () |
Constructor.
Definition at line 56 of file ShapeContainer.cpp.
00057 : myMinLayer(100), myMaxLayer(-100) {}
| ShapeContainer::~ShapeContainer | ( | ) | throw () [virtual] |
| bool ShapeContainer::add | ( | int | layer, | |
| PointOfInterest * | p | |||
| ) | throw () [virtual] |
Adds a PoI to the container.
| [in] | layer | The layer the poi is located in |
| [in] | p | The PoI to add |
Reimplemented in GUIShapeContainer.
Definition at line 75 of file ShapeContainer.cpp.
References MAX2(), MIN2(), myMaxLayer, myMinLayer, and myPOILayers.
00075 { 00076 if (myPOILayers.find(layer)==myPOILayers.end()) { 00077 myPOILayers[layer] = NamedObjectCont<PointOfInterest*>(); 00078 myMinLayer = MIN2(layer, myMinLayer); 00079 myMaxLayer = MAX2(layer, myMaxLayer); 00080 } 00081 return myPOILayers[layer].add(p->getID(), p); 00082 }
Adds a polygon to the container.
| [in] | layer | The layer the polygon is located in |
| [in] | p | The polygon to add |
Reimplemented in GUIShapeContainer.
Definition at line 64 of file ShapeContainer.cpp.
References MAX2(), MIN2(), myMaxLayer, myMinLayer, and myPolygonLayers.
Referenced by GUIShapeContainer::add(), NLGeomShapeBuilder::addPoint(), GUIGeomShapeBuilder::addPoint(), NLGeomShapeBuilder::polygonEnd(), GUIGeomShapeBuilder::polygonEnd(), TraCIServerAPI_Polygon::processSet(), and TraCIServerAPI_POI::processSet().
00064 { 00065 if (myPolygonLayers.find(layer)==myPolygonLayers.end()) { 00066 myPolygonLayers[layer] = NamedObjectCont<Polygon2D*>(); 00067 myMinLayer = MIN2(layer, myMinLayer); 00068 myMaxLayer = MAX2(layer, myMaxLayer); 00069 } 00070 return myPolygonLayers[layer].add(p->getID(), p); 00071 }
| int ShapeContainer::getMaxLayer | ( | ) | const throw () [inline] |
Returns the highest layer.
Definition at line 114 of file ShapeContainer.h.
References myMaxLayer.
Referenced by traci::TraCIServer::getPoiByExtId(), traci::TraCIServer::getPolygonByExtId(), GUINet::getShapeIDs(), traci::TraCIServer::handlePoiDomain(), traci::TraCIServer::handlePolygonDomain(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_POI::processSet(), and traci::TraCIServer::TraCIServer().
00114 { 00115 return myMaxLayer; 00116 }
| int ShapeContainer::getMinLayer | ( | ) | const throw () [inline] |
Returns the lowest layer.
Definition at line 106 of file ShapeContainer.h.
References myMinLayer.
Referenced by traci::TraCIServer::getPoiByExtId(), traci::TraCIServer::getPolygonByExtId(), GUINet::getShapeIDs(), traci::TraCIServer::handlePoiDomain(), traci::TraCIServer::handlePolygonDomain(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_POI::processSet(), and traci::TraCIServer::TraCIServer().
00106 { 00107 return myMinLayer; 00108 }
| const NamedObjectCont< PointOfInterest * > & ShapeContainer::getPOICont | ( | int | layer | ) | const throw () |
Returns the polygons located at the given layer.
| [in] | layer | The layer of polygons to return |
Definition at line 115 of file ShapeContainer.cpp.
References MAX2(), MIN2(), myMaxLayer, myMinLayer, and myPOILayers.
Referenced by traci::TraCIServer::getPoiByExtId(), GUINet::getShapeIDs(), traci::TraCIServer::handlePoiDomain(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_POI::processSet(), and traci::TraCIServer::TraCIServer().
00115 { 00116 if (myPOILayers.find(layer)==myPOILayers.end()) { 00117 myPOILayers[layer] = NamedObjectCont<PointOfInterest*>(); 00118 myMinLayer = MIN2(layer, myMinLayer); 00119 myMaxLayer = MAX2(layer, myMaxLayer); 00120 } 00121 return myPOILayers[layer]; 00122 }
| const NamedObjectCont< Polygon2D * > & ShapeContainer::getPolygonCont | ( | int | layer | ) | const throw () |
Returns the polygons located at the given layer.
| [in] | layer | The layer of polygons to return |
Definition at line 104 of file ShapeContainer.cpp.
References MAX2(), MIN2(), myMaxLayer, myMinLayer, and myPolygonLayers.
Referenced by traci::TraCIServer::getPolygonByExtId(), GUINet::getShapeIDs(), traci::TraCIServer::handlePolygonDomain(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Polygon::processSet(), and traci::TraCIServer::TraCIServer().
00104 { 00105 if (myPolygonLayers.find(layer)==myPolygonLayers.end()) { 00106 myPolygonLayers[layer] = NamedObjectCont<Polygon2D*>(); 00107 myMinLayer = MIN2(layer, myMinLayer); 00108 myMaxLayer = MAX2(layer, myMaxLayer); 00109 } 00110 return myPolygonLayers[layer]; 00111 }
| bool ShapeContainer::removePOI | ( | int | layer, | |
| const std::string & | id | |||
| ) | throw () [virtual] |
Removes a PoI from the container.
| [in] | layer | The layer the PoI is located in |
| [in] | id | The id of the PoI |
Reimplemented in GUIShapeContainer.
Definition at line 95 of file ShapeContainer.cpp.
References myPOILayers.
Referenced by TraCIServerAPI_POI::processSet(), and GUIShapeContainer::removePOI().
00095 { 00096 if (myPOILayers.find(layer)==myPOILayers.end()) { 00097 return false; 00098 } 00099 return myPOILayers.find(layer)->second.remove(id); 00100 }
| bool ShapeContainer::removePolygon | ( | int | layer, | |
| const std::string & | id | |||
| ) | throw () [virtual] |
Removes a polygon from the container.
| [in] | layer | The layer the polygon is located in |
| [in] | id | The id of the polygon |
Reimplemented in GUIShapeContainer.
Definition at line 86 of file ShapeContainer.cpp.
References myPolygonLayers.
Referenced by TraCIServerAPI_Polygon::processSet(), and GUIShapeContainer::removePolygon().
00086 { 00087 if (myPolygonLayers.find(layer)==myPolygonLayers.end()) { 00088 return false; 00089 } 00090 return myPolygonLayers.find(layer)->second.remove(id); 00091 }
int ShapeContainer::myMaxLayer [mutable, private] |
Definition at line 127 of file ShapeContainer.h.
Referenced by add(), getMaxLayer(), getPOICont(), and getPolygonCont().
int ShapeContainer::myMinLayer [mutable, private] |
The minimum and the maximum layers.
Definition at line 127 of file ShapeContainer.h.
Referenced by add(), getMinLayer(), getPOICont(), and getPolygonCont().
std::map<int, NamedObjectCont<PointOfInterest*> > ShapeContainer::myPOILayers [mutable, private] |
POI layers.
Definition at line 124 of file ShapeContainer.h.
Referenced by add(), getPOICont(), and removePOI().
std::map<int, NamedObjectCont<Polygon2D*> > ShapeContainer::myPolygonLayers [mutable, private] |
Polygon layers.
Definition at line 121 of file ShapeContainer.h.
Referenced by add(), getPolygonCont(), and removePolygon().
1.5.6