SUMO - Simulation of Urban MObility
GUIShapeContainer Class Reference

Storage for geometrical objects extended by mutexes. More...

#include <GUIShapeContainer.h>

Inheritance diagram for GUIShapeContainer:
Inheritance graph
Collaboration diagram for GUIShapeContainer:
Collaboration graph

Public Types

typedef NamedObjectCont< PointOfInterest * > POIs
 
typedef NamedObjectCont< SUMOPolygon * > Polygons
 containers More...
 

Public Member Functions

virtual bool addPOI (const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool ignorePruning=false)
 Builds a POI using the given values and adds it to the container. More...
 
virtual bool addPolygon (const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath, const PositionVector &shape, bool geo, bool fill, double lineWidth, bool ignorePruning=false)
 Builds a polygon using the given values and adds it to the container. More...
 
void allowReplacement ()
 
std::vector< GUIGlIDgetPOIIds () const
 Returns the gl-ids of all pois. More...
 
const POIsgetPOIs () const
 Returns all pois. More...
 
std::vector< GUIGlIDgetPolygonIDs () const
 Returns the gl-ids of all polygons. More...
 
const PolygonsgetPolygons () const
 Returns all polygons. More...
 
 GUIShapeContainer (SUMORTree &vis)
 Constructor. More...
 
virtual void movePOI (const std::string &id, const Position &pos)
 Assigns a new position to the named PoI. More...
 
virtual bool removePOI (const std::string &id)
 Removes a PoI from the container. More...
 
virtual bool removePolygon (const std::string &id)
 Removes a polygon from the container. More...
 
virtual void reshapePolygon (const std::string &id, const PositionVector &shape)
 Assigns a shape to the named polygon. More...
 
virtual ~GUIShapeContainer ()
 Destructor. More...
 

Protected Member Functions

virtual bool add (SUMOPolygon *poly, bool ignorePruning=false)
 add polygon More...
 
virtual bool add (PointOfInterest *poi, bool ignorePruning=false)
 add poi More...
 

Protected Attributes

POIs myPOIs
 stored POIs More...
 
Polygons myPolygons
 stored Polygons More...
 

Private Attributes

bool myAllowReplacement
 whether existing ids shall be replaced More...
 
MFXMutex myLock
 The mutex for adding/removing operations. More...
 
SUMORTreemyVis
 The RTree structure to add and remove visualization elements. More...
 

Detailed Description

Storage for geometrical objects extended by mutexes.

See also
ShapeContainer

Definition at line 48 of file GUIShapeContainer.h.

Member Typedef Documentation

◆ POIs

Definition at line 46 of file ShapeContainer.h.

◆ Polygons

containers

Definition at line 45 of file ShapeContainer.h.

Constructor & Destructor Documentation

◆ GUIShapeContainer()

GUIShapeContainer::GUIShapeContainer ( SUMORTree vis)

Constructor.

Definition at line 36 of file GUIShapeContainer.cpp.

◆ ~GUIShapeContainer()

GUIShapeContainer::~GUIShapeContainer ( )
virtual

Destructor.

Definition at line 42 of file GUIShapeContainer.cpp.

Member Function Documentation

◆ add() [1/2]

bool ShapeContainer::add ( SUMOPolygon poly,
bool  ignorePruning = false 
)
protectedvirtualinherited

◆ add() [2/2]

bool ShapeContainer::add ( PointOfInterest poi,
bool  ignorePruning = false 
)
protectedvirtualinherited

add poi

Reimplemented in PCPolyContainer.

Definition at line 106 of file ShapeContainer.cpp.

References NamedObjectCont< T >::add(), Named::getID(), and ShapeContainer::myPOIs.

◆ addPOI()

bool GUIShapeContainer::addPOI ( const std::string &  id,
const std::string &  type,
const RGBColor color,
const Position pos,
bool  geo,
const std::string &  lane,
double  posOverLane,
double  posLat,
double  layer,
double  angle,
const std::string &  imgFile,
bool  relativePath,
double  width,
double  height,
bool  ignorePruning = false 
)
virtual

Builds a POI using the given values and adds it to the container.

Parameters
[in]idThe name of the POI
[in]typeThe (abstract) type of the POI
[in]colorThe color of the POI
[in]posThe position of the POI

Reimplemented from ShapeContainer.

Definition at line 46 of file GUIShapeContainer.cpp.

References NamedObjectCont< T >::add(), SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myAllowReplacement, myLock, ShapeContainer::myPOIs, myVis, NamedObjectCont< T >::remove(), SUMORTree::removeAdditionalGLObject(), and WRITE_WARNING.

◆ addPolygon()

bool GUIShapeContainer::addPolygon ( const std::string &  id,
const std::string &  type,
const RGBColor color,
double  layer,
double  angle,
const std::string &  imgFile,
bool  relativePath,
const PositionVector shape,
bool  geo,
bool  fill,
double  lineWidth,
bool  ignorePruning = false 
)
virtual

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

Parameters
[in]idThe name of the polygon
[in]typeThe (abstract) type of the polygon
[in]colorThe color of the polygon
[in]layerThe layer of the polygon
[in]angleThe rotation of the polygon
[in]imgFileThe raster image of the polygon
[in]relativePathset image file as relative path
[in]shapeThe shape of the polygon
[in]geospecify if shape was loaded as GEO coordinate
[in]fillWhether the polygon shall be filled
[in]lineWidthLine width when drawing unfilled polygon
Returns
whether the polygon could be added

Reimplemented from ShapeContainer.

Definition at line 69 of file GUIShapeContainer.cpp.

References NamedObjectCont< T >::add(), SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myAllowReplacement, myLock, ShapeContainer::myPolygons, myVis, NamedObjectCont< T >::remove(), SUMORTree::removeAdditionalGLObject(), and WRITE_WARNING.

◆ allowReplacement()

void GUIShapeContainer::allowReplacement ( )
inline

Definition at line 135 of file GUIShapeContainer.h.

References myAllowReplacement.

◆ getPOIIds()

std::vector< GUIGlID > GUIShapeContainer::getPOIIds ( ) const

Returns the gl-ids of all pois.

Definition at line 142 of file GUIShapeContainer.cpp.

References ShapeContainer::getPOIs(), and myLock.

◆ getPOIs()

◆ getPolygonIDs()

std::vector< GUIGlID > GUIShapeContainer::getPolygonIDs ( ) const

Returns the gl-ids of all polygons.

Definition at line 153 of file GUIShapeContainer.cpp.

References ShapeContainer::getPolygons(), and myLock.

◆ getPolygons()

◆ movePOI()

void GUIShapeContainer::movePOI ( const std::string &  id,
const Position pos 
)
virtual

Assigns a new position to the named PoI.

Parameters
[in]idThe id of the PoI to move
[in]posThe PoI's new position

Reimplemented from ShapeContainer.

Definition at line 117 of file GUIShapeContainer.cpp.

References SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myLock, ShapeContainer::myPOIs, myVis, and SUMORTree::removeAdditionalGLObject().

◆ removePOI()

bool GUIShapeContainer::removePOI ( const std::string &  id)
virtual

Removes a PoI from the container.

Parameters
[in]idThe id of the PoI
Returns
Whether the poi could be removed

Reimplemented from ShapeContainer.

Definition at line 105 of file GUIShapeContainer.cpp.

References NamedObjectCont< T >::get(), myLock, ShapeContainer::myPOIs, myVis, NamedObjectCont< T >::remove(), and SUMORTree::removeAdditionalGLObject().

◆ removePolygon()

bool GUIShapeContainer::removePolygon ( const std::string &  id)
virtual

Removes a polygon from the container.

Parameters
[in]idThe id of the polygon
Returns
Whether the polygon could be removed

Reimplemented from ShapeContainer.

Definition at line 93 of file GUIShapeContainer.cpp.

References NamedObjectCont< T >::get(), myLock, ShapeContainer::myPolygons, myVis, NamedObjectCont< T >::remove(), and SUMORTree::removeAdditionalGLObject().

◆ reshapePolygon()

void GUIShapeContainer::reshapePolygon ( const std::string &  id,
const PositionVector shape 
)
virtual

Assigns a shape to the named polygon.

Parameters
[in]idThe id of the polygon to reshape
[in]shapeThe polygon's new shape

Reimplemented from ShapeContainer.

Definition at line 129 of file GUIShapeContainer.cpp.

References SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myLock, ShapeContainer::myPolygons, myVis, SUMORTree::removeAdditionalGLObject(), and GUIPolygon::setShape().

Field Documentation

◆ myAllowReplacement

bool GUIShapeContainer::myAllowReplacement
private

whether existing ids shall be replaced

Definition at line 148 of file GUIShapeContainer.h.

Referenced by addPOI(), addPolygon(), and allowReplacement().

◆ myLock

MFXMutex GUIShapeContainer::myLock
mutableprivate

The mutex for adding/removing operations.

Definition at line 141 of file GUIShapeContainer.h.

Referenced by addPOI(), addPolygon(), getPOIIds(), getPolygonIDs(), movePOI(), removePOI(), removePolygon(), and reshapePolygon().

◆ myPOIs

◆ myPolygons

◆ myVis

SUMORTree& GUIShapeContainer::myVis
private

The RTree structure to add and remove visualization elements.

Definition at line 144 of file GUIShapeContainer.h.

Referenced by addPOI(), addPolygon(), movePOI(), removePOI(), removePolygon(), and reshapePolygon().


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