SUMO - Simulation of Urban MObility

ShapeContainer Class Reference

Storage for geometrical objects, sorted by the layers they are in. More...

#include <ShapeContainer.h>

Inheritance diagram for ShapeContainer:
GUIShapeContainer

Public Member Functions

virtual bool addPoI (const std::string &name, int layer, const std::string &type, const RGBColor &c, const Position &pos) throw ()
 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) throw ()
 Builds a polygon using the given values and adds it to the according layer.
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< Polygon * > & getPolygonCont (int layer) const throw ()
 Returns the polygons located at the given layer.
virtual void movePoI (int layer, const std::string &id, const Position &pos) throw ()
 Assigns a new position to the named PoI.
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.
virtual void reshapePolygon (int layer, const std::string &id, const PositionVector &shape) throw ()
 Assigns a shape to the named polygon.
 ShapeContainer () throw ()
 Constructor.
virtual ~ShapeContainer () throw ()
 Destructor.

Protected Types

typedef std::map< std::string,
Polygon * > 
PolyMap

Protected Member Functions

bool add (int layer, Polygon *p) throw ()
 Adds a polygon to the container.
bool add (int layer, PointOfInterest *p) throw ()
 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.

Detailed Description

Storage for geometrical objects, sorted by the layers they are in.

Definition at line 53 of file ShapeContainer.h.


Member Typedef Documentation

typedef std::map<std::string, Polygon*> ShapeContainer::PolyMap [protected]

Definition at line 176 of file ShapeContainer.h.


Constructor & Destructor Documentation

ShapeContainer::ShapeContainer ( ) throw ()

Constructor.

Definition at line 53 of file ShapeContainer.cpp.

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

Destructor.

Definition at line 57 of file ShapeContainer.cpp.


Member Function Documentation

bool ShapeContainer::add ( int  layer,
Polygon *  p 
) throw () [protected]

Adds a polygon to the container.

Parameters:
[in]layerThe layer the polygon is located in
[in]pThe polygon to add
Returns:
Whether the polygon could be added (no other with same name existed before)

Definition at line 151 of file ShapeContainer.cpp.

References MAX2(), and MIN2().

bool ShapeContainer::add ( int  layer,
PointOfInterest *  p 
) throw () [protected]

Adds a PoI to the container.

Parameters:
[in]layerThe layer the poi is located in
[in]pThe PoI to add
Returns:
Whether the PoI could be added (no other with same name existed before)

Definition at line 162 of file ShapeContainer.cpp.

References MAX2(), and MIN2().

bool ShapeContainer::addPoI ( const std::string &  name,
int  layer,
const std::string &  type,
const RGBColor &  c,
const Position &  pos 
) throw () [virtual]

Builds a PoI using the given values and adds it to the according layer.

Parameters:
[in]nameThe name of the PoI to add
[in]layerThe layer to add the PoI to
[in]typeThe type of the PoI to add
[in]cThe color of the PoI to add
[in]posThe position of the PoI to add
Returns:
Whether the PoI could be added (no other with same id exists in the layer)
See also:
ShapeContainer::addPoI

Reimplemented in GUIShapeContainer.

Definition at line 61 of file ShapeContainer.cpp.

Referenced by NLHandler::addPOI(), and TraCIServerAPI_POI::processSet().

bool ShapeContainer::addPolygon ( const std::string &  name,
int  layer,
const std::string &  type,
const RGBColor &  c,
bool  filled,
const PositionVector &  shape 
) throw () [virtual]

Builds a polygon using the given values and adds it to the according layer.

Parameters:
[in]nameThe name of the polygon to add
[in]layerThe layer to add the polygon to
[in]typeThe type of the polygon to add
[in]cThe color of the polygon to add
[in]shapeThe shape of the polygon to add
Returns:
Whether the polygon could be added (no other with same id exists in the layer)
See also:
ShapeContainer::addPolygon

Reimplemented in GUIShapeContainer.

Definition at line 73 of file ShapeContainer.cpp.

Referenced by NLHandler::addPoly(), and TraCIServerAPI_Polygon::processSet().

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

Returns the highest layer.

Returns:
The highest layer

Definition at line 153 of file ShapeContainer.h.

References myMaxLayer.

Referenced by TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processSet(), and TraCIServerAPI_POI::processSet().

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

Returns the lowest layer.

Returns:
The lowest layer

Definition at line 145 of file ShapeContainer.h.

References myMinLayer.

Referenced by TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processSet(), and TraCIServerAPI_POI::processSet().

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

Returns the polygons located at the given layer.

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

Definition at line 139 of file ShapeContainer.cpp.

References MAX2(), and MIN2().

Referenced by GUIShapeContainer::getShapeIDs(), TraCIServerAPI_POI::processGet(), and TraCIServerAPI_POI::processSet().

const NamedObjectCont< Polygon * > & ShapeContainer::getPolygonCont ( int  layer) const throw ()

Returns the polygons located at the given layer.

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

Definition at line 128 of file ShapeContainer.cpp.

References MAX2(), and MIN2().

Referenced by GUIShapeContainer::getShapeIDs(), TraCIServerAPI_Polygon::processGet(), and TraCIServerAPI_Polygon::processSet().

void ShapeContainer::movePoI ( int  layer,
const std::string &  id,
const Position &  pos 
) throw () [virtual]

Assigns a new position to the named PoI.

Parameters:
[in]layerThe layer the PoI is located in
[in]idThe id of the PoI to move
[in]posThe PoI's new position

Reimplemented in GUIShapeContainer.

Definition at line 105 of file ShapeContainer.cpp.

Referenced by TraCIServerAPI_POI::processSet().

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

Removes a PoI from the container.

Parameters:
[in]layerThe layer the PoI is located in
[in]idThe id of the PoI
Returns:
Whether the poi could be removed

Reimplemented in GUIShapeContainer.

Definition at line 95 of file ShapeContainer.cpp.

Referenced by TraCIServerAPI_POI::processSet().

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

Removes a polygon from the container.

Parameters:
[in]layerThe layer the polygon is located in
[in]idThe id of the polygon
Returns:
Whether the polygon could be removed

Reimplemented in GUIShapeContainer.

Definition at line 86 of file ShapeContainer.cpp.

Referenced by TraCIServerAPI_Polygon::processSet().

void ShapeContainer::reshapePolygon ( int  layer,
const std::string &  id,
const PositionVector &  shape 
) throw () [virtual]

Assigns a shape to the named polygon.

Parameters:
[in]layerThe layer the polygon is located in
[in]idThe id of the polygon to reshape
[in]shapeThe polygon's new shape

Reimplemented in GUIShapeContainer.

Definition at line 116 of file ShapeContainer.cpp.

References Polygon::setShape().

Referenced by TraCIServerAPI_Polygon::processSet().


Field Documentation

int ShapeContainer::myMaxLayer [mutable, protected]

Definition at line 184 of file ShapeContainer.h.

Referenced by getMaxLayer(), and GUIShapeContainer::getShapeIDs().

int ShapeContainer::myMinLayer [mutable, protected]

The minimum and the maximum layers.

Definition at line 184 of file ShapeContainer.h.

Referenced by getMinLayer(), and GUIShapeContainer::getShapeIDs().

std::map<int, NamedObjectCont<PointOfInterest*> > ShapeContainer::myPOILayers [mutable, protected]

POI layers.

Definition at line 181 of file ShapeContainer.h.

std::map<int, NamedObjectCont<Polygon*> > ShapeContainer::myPolygonLayers [mutable, protected]

Polygon layers.

Definition at line 178 of file ShapeContainer.h.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines