SUMO - Simulation of Urban MObility
|
Storage for geometrical objects extended by mutexes. More...
#include <GUIShapeContainer.h>
Public Member Functions | |
virtual bool | addPoI (const std::string &name, int layer, const std::string &type, const RGBColor &c, const Position &pos) |
Builds a PoI using the given values and adds it to the according layer. | |
virtual bool | addPolygon (const std::string &name, int layer, const std::string &type, const RGBColor &c, bool filled, const PositionVector &shape) |
Builds a polygon using the given values and adds it to the according layer. | |
int | getMaxLayer () const |
Returns the highest layer. | |
int | getMinLayer () const |
Returns the lowest layer. | |
const NamedObjectCont < PointOfInterest * > & | getPOICont (int layer) const |
Returns the polygons located at the given layer. | |
const NamedObjectCont< Polygon * > & | getPolygonCont (int layer) const |
Returns the polygons located at the given layer. | |
std::vector< GUIGlID > | getShapeIDs () const |
Returns the gl-ids of all shapes. | |
GUIShapeContainer (SUMORTree &vis) | |
Constructor. | |
void | movePoI (int layer, const std::string &id, const Position &pos) |
Assigns a new position to the named PoI. | |
bool | removePoI (int layer, const std::string &id) |
Removes a PoI from the container. | |
bool | removePolygon (int layer, const std::string &id) |
Removes a polygon from the container. | |
void | reshapePolygon (int layer, const std::string &id, const PositionVector &shape) |
Assigns a shape to the named polygon. | |
virtual | ~GUIShapeContainer () |
Destructor. |
Protected Types | |
typedef std::map< std::string, Polygon * > | PolyMap |
Protected Member Functions | |
bool | add (int layer, Polygon *p) |
Adds a polygon to the container. | |
bool | add (int layer, PointOfInterest *p) |
Adds a PoI to the container. |
Protected Attributes | |
int | myMaxLayer |
int | myMinLayer |
The minimum and the maximum layers. | |
std::map< int, NamedObjectCont < PointOfInterest * > > | myPOILayers |
POI layers. | |
std::map< int, NamedObjectCont < Polygon * > > | myPolygonLayers |
Polygon layers. |
Private Attributes | |
MFXMutex | myLock |
The mutex for adding/removing operations. | |
SUMORTree & | myVis |
The RTree structure to add and remove visualization elements. |
Storage for geometrical objects extended by mutexes.
Definition at line 54 of file GUIShapeContainer.h.
|
protectedinherited |
Definition at line 178 of file ShapeContainer.h.
GUIShapeContainer::GUIShapeContainer | ( | SUMORTree & | vis | ) |
Constructor.
Definition at line 46 of file GUIShapeContainer.cpp.
|
virtual |
Destructor.
Definition at line 50 of file GUIShapeContainer.cpp.
Adds a polygon to the container.
[in] | layer | The layer the polygon is located in |
[in] | p | The polygon to add |
Definition at line 154 of file ShapeContainer.cpp.
References Polygon::getID(), MAX2(), MIN2(), ShapeContainer::myMaxLayer, ShapeContainer::myMinLayer, and ShapeContainer::myPolygonLayers.
Referenced by addPoI(), ShapeContainer::addPoI(), addPolygon(), and ShapeContainer::addPolygon().
|
protectedinherited |
Adds a PoI to the container.
[in] | layer | The layer the poi is located in |
[in] | p | The PoI to add |
Definition at line 165 of file ShapeContainer.cpp.
References Named::getID(), MAX2(), MIN2(), ShapeContainer::myMaxLayer, ShapeContainer::myMinLayer, and ShapeContainer::myPOILayers.
|
virtual |
Builds a PoI using the given values and adds it to the according layer.
[in] | name | The name of the PoI to add |
[in] | layer | The layer to add the PoI to |
[in] | type | The type of the PoI to add |
[in] | c | The color of the PoI to add |
[in] | pos | The position of the PoI to add |
Reimplemented from ShapeContainer.
Definition at line 54 of file GUIShapeContainer.cpp.
References ShapeContainer::add(), SUMORTree::addAdditionalGLObject(), MFXMutex::lock(), myLock, myVis, and MFXMutex::unlock().
|
virtual |
Builds a polygon using the given values and adds it to the according layer.
[in] | name | The name of the polygon to add |
[in] | layer | The layer to add the polygon to |
[in] | type | The type of the polygon to add |
[in] | c | The color of the polygon to add |
[in] | pos | The position of the polygon to add |
Reimplemented from ShapeContainer.
Definition at line 70 of file GUIShapeContainer.cpp.
References ShapeContainer::add(), SUMORTree::addAdditionalGLObject(), MFXMutex::lock(), myLock, myVis, and MFXMutex::unlock().
|
inlineinherited |
Returns the highest layer.
Definition at line 155 of file ShapeContainer.h.
References ShapeContainer::myMaxLayer.
Referenced by TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Polygon::processSet(), and TraCIServerAPI_POI::processSet().
|
inlineinherited |
Returns the lowest layer.
Definition at line 147 of file ShapeContainer.h.
References ShapeContainer::myMinLayer.
Referenced by TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Polygon::processSet(), and TraCIServerAPI_POI::processSet().
|
inherited |
Returns the polygons located at the given layer.
[in] | layer | The layer of polygons to return |
Definition at line 142 of file ShapeContainer.cpp.
References MAX2(), MIN2(), ShapeContainer::myMaxLayer, ShapeContainer::myMinLayer, and ShapeContainer::myPOILayers.
Referenced by getShapeIDs(), TraCIServerAPI_POI::processGet(), and TraCIServerAPI_POI::processSet().
|
inherited |
Returns the polygons located at the given layer.
[in] | layer | The layer of polygons to return |
Definition at line 131 of file ShapeContainer.cpp.
References MAX2(), MIN2(), ShapeContainer::myMaxLayer, ShapeContainer::myMinLayer, and ShapeContainer::myPolygonLayers.
Referenced by getShapeIDs(), TraCIServerAPI_Polygon::processGet(), and TraCIServerAPI_Polygon::processSet().
std::vector< GUIGlID > GUIShapeContainer::getShapeIDs | ( | ) | const |
Returns the gl-ids of all shapes.
Definition at line 157 of file GUIShapeContainer.cpp.
References ShapeContainer::getPOICont(), ShapeContainer::getPolygonCont(), ShapeContainer::myMaxLayer, and ShapeContainer::myMinLayer.
Assigns a new position to the named PoI.
[in] | layer | The layer the PoI is located in |
[in] | id | The id of the PoI to move |
[in] | pos | The PoI's new position |
Reimplemented from ShapeContainer.
Definition at line 127 of file GUIShapeContainer.cpp.
References SUMORTree::addAdditionalGLObject(), MFXMutex::lock(), myLock, ShapeContainer::myPOILayers, myVis, SUMORTree::removeAdditionalGLObject(), and MFXMutex::unlock().
Removes a PoI from the container.
[in] | layer | The layer the PoI is located in |
[in] | id | The id of the PoI |
Reimplemented from ShapeContainer.
Definition at line 87 of file GUIShapeContainer.cpp.
References NamedObjectCont< T >::get(), MFXMutex::lock(), myLock, ShapeContainer::myPOILayers, myVis, NamedObjectCont< T >::remove(), SUMORTree::removeAdditionalGLObject(), and MFXMutex::unlock().
Removes a polygon from the container.
[in] | layer | The layer the polygon is located in |
[in] | id | The id of the polygon |
Reimplemented from ShapeContainer.
Definition at line 107 of file GUIShapeContainer.cpp.
References MFXMutex::lock(), myLock, ShapeContainer::myPolygonLayers, myVis, SUMORTree::removeAdditionalGLObject(), and MFXMutex::unlock().
|
virtual |
Assigns a shape to the named polygon.
[in] | layer | The layer the polygon is located in |
[in] | id | The id of the polygon to reshape |
[in] | shape | The polygon's new shape |
Reimplemented from ShapeContainer.
Definition at line 142 of file GUIShapeContainer.cpp.
References SUMORTree::addAdditionalGLObject(), MFXMutex::lock(), myLock, ShapeContainer::myPolygonLayers, myVis, SUMORTree::removeAdditionalGLObject(), Polygon::setShape(), and MFXMutex::unlock().
|
private |
The mutex for adding/removing operations.
Definition at line 134 of file GUIShapeContainer.h.
Referenced by addPoI(), addPolygon(), movePoI(), removePoI(), removePolygon(), and reshapePolygon().
|
mutableprotectedinherited |
Definition at line 186 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), ShapeContainer::getMaxLayer(), ShapeContainer::getPOICont(), ShapeContainer::getPolygonCont(), and getShapeIDs().
|
mutableprotectedinherited |
The minimum and the maximum layers.
Definition at line 186 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), ShapeContainer::getMinLayer(), ShapeContainer::getPOICont(), ShapeContainer::getPolygonCont(), and getShapeIDs().
|
mutableprotectedinherited |
POI layers.
Definition at line 183 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), ShapeContainer::getPOICont(), ShapeContainer::movePoI(), movePoI(), ShapeContainer::removePoI(), and removePoI().
|
mutableprotectedinherited |
Polygon layers.
Definition at line 180 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), ShapeContainer::getPolygonCont(), removePolygon(), ShapeContainer::removePolygon(), ShapeContainer::reshapePolygon(), and reshapePolygon().
|
private |
The RTree structure to add and remove visualization elements.
Definition at line 137 of file GUIShapeContainer.h.
Referenced by addPoI(), addPolygon(), movePoI(), removePoI(), removePolygon(), and reshapePolygon().