GUIShapeContainer Class Reference

#include <GUIShapeContainer.h>

Inheritance diagram for GUIShapeContainer:

ShapeContainer

Detailed Description

Storage for geometrical objects extended by mutexes.

See also:
ShapeContainer

Definition at line 44 of file GUIShapeContainer.h.


Public Member Functions

bool add (int layer, PointOfInterest *p) throw ()
 Adds a POI to the container.
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.
 GUIShapeContainer () throw ()
 Constructor.
bool removePOI (int layer, const std::string &id) throw ()
 Removes a PoI from the container.
bool removePolygon (int layer, const std::string &id) throw ()
 Removes a polygon from the container.
virtual ~GUIShapeContainer () throw ()
 Destructor.

Private Attributes

MFXMutex myLock
 The mutex for adding/removing operations.

Constructor & Destructor Documentation

GUIShapeContainer::GUIShapeContainer (  )  throw ()

Constructor.

Definition at line 44 of file GUIShapeContainer.cpp.

00044 {}

GUIShapeContainer::~GUIShapeContainer (  )  throw () [virtual]

Destructor.

Definition at line 47 of file GUIShapeContainer.cpp.

00047 {}


Member Function Documentation

bool GUIShapeContainer::add ( int  layer,
PointOfInterest p 
) throw () [virtual]

Adds a POI to the container.

Parameters:
[in] layer The layer the poi is located in
[in] p The poi to add
Returns:
Whether the poi could be added (no other with same name existed before)
See also:
ShapeContainer::add

Reimplemented from ShapeContainer.

Definition at line 60 of file GUIShapeContainer.cpp.

References ShapeContainer::add(), MFXMutex::lock(), myLock, and MFXMutex::unlock().

00060                                                             {
00061     myLock.lock();
00062     bool ret = ShapeContainer::add(layer, p);
00063     myLock.unlock();
00064     return ret;
00065 }

bool GUIShapeContainer::add ( int  layer,
Polygon2D p 
) throw () [virtual]

Adds a polygon to the container.

Parameters:
[in] layer The layer the polygon is located in
[in] p The polygon to add
Returns:
Whether the polygon could be added (no other with same name existed before)
See also:
ShapeContainer::add

Reimplemented from ShapeContainer.

Definition at line 51 of file GUIShapeContainer.cpp.

References ShapeContainer::add(), MFXMutex::lock(), myLock, and MFXMutex::unlock().

00051                                                       {
00052     myLock.lock();
00053     bool ret = ShapeContainer::add(layer, p);
00054     myLock.unlock();
00055     return ret;
00056 }

int ShapeContainer::getMaxLayer (  )  const throw () [inline, inherited]

int ShapeContainer::getMinLayer (  )  const throw () [inline, inherited]

const NamedObjectCont< PointOfInterest * > & ShapeContainer::getPOICont ( int  layer  )  const throw () [inherited]

Returns the polygons located at the given layer.

Parameters:
[in] layer The layer of polygons to return
Returns:
The polygons at this layer
See also:
NamedObjectCont

Definition at line 115 of file ShapeContainer.cpp.

References MAX2(), MIN2(), ShapeContainer::myMaxLayer, ShapeContainer::myMinLayer, and ShapeContainer::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 () [inherited]

Returns the polygons located at the given layer.

Parameters:
[in] layer The layer of polygons to return
Returns:
The polygons at this layer
See also:
NamedObjectCont

Definition at line 104 of file ShapeContainer.cpp.

References MAX2(), MIN2(), ShapeContainer::myMaxLayer, ShapeContainer::myMinLayer, and ShapeContainer::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 GUIShapeContainer::removePOI ( int  layer,
const std::string &  id 
) throw () [virtual]

Removes a PoI from the container.

Parameters:
[in] layer The layer the PoI is located in
[in] id The id of the PoI
Returns:
Whether the poi could be removed
See also:
ShapeContainer::removePOI

Reimplemented from ShapeContainer.

Definition at line 78 of file GUIShapeContainer.cpp.

References MFXMutex::lock(), myLock, ShapeContainer::removePOI(), and MFXMutex::unlock().

00078                                                                    {
00079     myLock.lock();
00080     bool ret = ShapeContainer::removePOI(layer, id);
00081     myLock.unlock();
00082     return ret;
00083 }

bool GUIShapeContainer::removePolygon ( int  layer,
const std::string &  id 
) throw () [virtual]

Removes a polygon from the container.

Parameters:
[in] layer The layer the polygon is located in
[in] id The id of the polygon
Returns:
Whether the polygon could be removed
See also:
ShapeContainer::removePolygon

Reimplemented from ShapeContainer.

Definition at line 69 of file GUIShapeContainer.cpp.

References MFXMutex::lock(), myLock, ShapeContainer::removePolygon(), and MFXMutex::unlock().

00069                                                                        {
00070     myLock.lock();
00071     bool ret = ShapeContainer::removePolygon(layer, id);
00072     myLock.unlock();
00073     return ret;
00074 }


Field Documentation

The mutex for adding/removing operations.

Definition at line 92 of file GUIShapeContainer.h.

Referenced by add(), removePOI(), and removePolygon().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:45 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6