Eclipse SUMO - Simulation of Urban MObility
|
Storage for geometrical objects extended by mutexes. More...
#include <GUIShapeContainer.h>
Public Types | |
typedef NamedObjectCont< PointOfInterest * > | POIs |
typedef NamedObjectCont< SUMOPolygon * > | Polygons |
containers | |
Public Member Functions | |
void | addInactivePolygonTypes (std::set< std::string > inactivePolygonTypes) |
Adds new polygon types to the set of inactive ones. | |
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, bool friendlyPos, double posLat, const std::string &icon, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool ignorePruning=false) override |
Builds a POI using the given values and adds it to the container. | |
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, const std::string &name=Shape::DEFAULT_NAME) override |
Builds a polygon using the given values and adds it to the container. | |
PolygonDynamics * | addPolygonDynamics (double simtime, std::string polyID, SUMOTrafficObject *trackedObject, const std::vector< double > &timeSpan, const std::vector< double > &alphaSpan, bool looped, bool rotate) override |
Adds dynamics to the given Polygon,. | |
virtual void | addPolygonUpdateCommand (std::string polyID, ParametrisedWrappingCommand< ShapeContainer, PolygonDynamics * > *cmd) |
Register update command (for descheduling at removal) | |
void | allowReplacement () |
allow replacement | |
void | clearState () |
Remove all dynamics before quick-loading state. | |
const std::set< std::string > & | getInactiveTypes (void) const |
std::vector< GUIGlID > | getPOIIds () const |
Returns the gl-ids of all pois. | |
const POIs & | getPOIs () const |
Returns all pois. | |
std::vector< GUIGlID > | getPolygonIDs () const |
Returns the gl-ids of all polygons. | |
const Polygons & | getPolygons () const |
Returns all polygons. | |
GUIShapeContainer (SUMORTree &vis) | |
Constructor. | |
virtual void | movePOI (const std::string &id, const Position &pos) override |
Assigns a new position to the named PoI. | |
SUMOTime | polygonDynamicsUpdate (SUMOTime t, PolygonDynamics *pd) override |
Update PolygonDynamics,. | |
virtual void | registerHighlight (const std::string &objectID, const int type, const std::string &polygonID) |
register highlight of the specified type if the given id | |
void | removeInactivePolygonTypes (std::set< std::string > inactivePolygonTypes) |
Remove some polygon types that were deemed as inactive. | |
virtual bool | removePOI (const std::string &id) override |
Removes a PoI from the container. | |
virtual bool | removePolygon (const std::string &id, bool useLock=true) override |
Removes a polygon from the container. | |
virtual bool | removePolygonDynamics (const std::string &polyID) |
Remove dynamics (animation / tracking) for the given polygon. | |
virtual void | removeTrackers (std::string objectID) |
Remove all tracking polygons for the given object. | |
virtual void | reshapePolygon (const std::string &id, const PositionVector &shape) override |
Assigns a shape to the named polygon. | |
void | setInactivePolygonTypes (std::set< std::string > inactivePolygonTypes) |
Sets polygon types that define which one is active or not. | |
virtual | ~GUIShapeContainer () |
Destructor. | |
Protected Member Functions | ||||
virtual bool | add (PointOfInterest *poi, bool ignorePruning=false) | |||
add poi | ||||
virtual bool | add (SUMOPolygon *poly, bool ignorePruning=false) | |||
add polygon | ||||
virtual void | cleanupPolygonDynamics (const std::string &id) | |||
Unschedules the removal and update commands of the given polygon. | ||||
Management of highlights. For each type, only one highlight can be active, | ||||
Remove any previously added highlight polygon of the specified type
| ||||
virtual void | clearHighlight (const std::string &objectID, const int type, std::string &toRemove) | |||
virtual void | clearHighlights (const std::string &objectID, SUMOPolygon *p) | |||
Clears all highlight information from the maps when the object leaves the net (Highlight polygons and dynamics are removed via removeTrackers()) | ||||
Protected Attributes | |
std::map< std::string, std::string > | myHighlightedObjects |
inverse map to myHighlightPolygons saves the highlighted object for each polygon | |
std::map< std::string, std::map< int, std::string > > | myHighlightPolygons |
maps objects to a map of highlight types to highlighting polygons | |
POIs | myPOIs |
stored POIs | |
std::map< std::string, PolygonDynamics * > | myPolygonDynamics |
stored PolygonDynamics | |
Polygons | myPolygons |
stored Polygons | |
std::map< const std::string, std::set< const SUMOPolygon * > > | myTrackingPolygons |
Information about tracked objects. | |
Private Member Functions | |
void | computeActivePolygons (void) |
Determine which polygons are active based on their type. | |
Private Attributes | |
bool | myAllowReplacement |
whether existing ids shall be replaced | |
std::set< std::string > | myInactivePolygonTypes |
The polygon types that define the inactive polygons. | |
FXMutex | myLock |
The mutex for adding/removing operations. | |
std::map< const std::string, ParametrisedWrappingCommand< ShapeContainer, PolygonDynamics * > * > | myPolygonUpdateCommands |
Command pointers for scheduled polygon update. Maps PolyID->Command. | |
SUMORTree & | myVis |
The RTree structure to add and remove visualization elements. | |
Storage for geometrical objects extended by mutexes.
Definition at line 45 of file GUIShapeContainer.h.
|
inherited |
Definition at line 54 of file ShapeContainer.h.
|
inherited |
containers
Definition at line 53 of file ShapeContainer.h.
GUIShapeContainer::GUIShapeContainer | ( | SUMORTree & | vis | ) |
Constructor.
Definition at line 35 of file GUIShapeContainer.cpp.
|
virtual |
Destructor.
Definition at line 41 of file GUIShapeContainer.cpp.
|
protectedvirtualinherited |
add poi
Reimplemented in PCPolyContainer.
Definition at line 197 of file ShapeContainer.cpp.
References NamedObjectCont< T >::add(), Named::getID(), and ShapeContainer::myPOIs.
|
protectedvirtualinherited |
add polygon
Reimplemented in PCPolyContainer.
Definition at line 187 of file ShapeContainer.cpp.
References NamedObjectCont< T >::add(), Named::getID(), and ShapeContainer::myPolygons.
Referenced by PCPolyContainer::add(), PCPolyContainer::add(), ShapeContainer::addPOI(), and ShapeContainer::addPolygon().
void GUIShapeContainer::addInactivePolygonTypes | ( | std::set< std::string > | inactivePolygonTypes | ) |
Adds new polygon types to the set of inactive ones.
inactivePolygonTypes | Some set of inactive polygon types. |
Definition at line 217 of file GUIShapeContainer.cpp.
References computeActivePolygons(), and myInactivePolygonTypes.
Referenced by GUIViewTraffic::drawPedestrianNetwork().
|
overridevirtual |
Builds a POI using the given values and adds it to the container.
[in] | id | The name of the POI |
[in] | type | The (abstract) type of the POI |
[in] | color | The color of the POI |
[in] | pos | The position of the POI |
[in[ | geo use GEO coordinates (lon/lat) | |
[in] | lane | The Lane in which this POI is placed |
[in] | posOverLane | The position over Lane |
[in] | friendlyPos | enable or disable friendly position over lane |
[in] | posLat | The position lateral over Lane |
[in] | icon | The icon of the POI |
[in] | layer | The layer of the POI |
[in] | angle | The rotation of the POI |
[in] | imgFile | The raster image of the POI |
[in] | relativePath | set image file as relative path |
[in] | width | The width of the POI image |
[in] | height | The height of the POI image |
Reimplemented from ShapeContainer.
Definition at line 45 of file GUIShapeContainer.cpp.
References NamedObjectCont< T >::add(), SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myAllowReplacement, myLock, ShapeContainer::myPOIs, myVis, NamedObjectCont< T >::remove(), SUMORTree::removeAdditionalGLObject(), TL, and WRITE_WARNINGF.
|
overridevirtual |
Builds a polygon using the given values and adds it to the container.
[in] | id | The name of the polygon |
[in] | type | The (abstract) type of the polygon |
[in] | color | The color of the polygon |
[in] | layer | The layer of the polygon |
[in] | angle | The rotation of the polygon |
[in] | imgFile | The raster image of the polygon |
[in] | relativePath | set image file as relative path |
[in] | shape | The shape of the polygon |
[in] | geo | specify if shape was loaded as GEO coordinate |
[in] | fill | Whether the polygon shall be filled |
[in] | lineWidth | Line width when drawing unfilled polygon |
Reimplemented from ShapeContainer.
Definition at line 70 of file GUIShapeContainer.cpp.
References GUIPolygon::activate(), NamedObjectCont< T >::add(), SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myAllowReplacement, myInactivePolygonTypes, myLock, ShapeContainer::myPolygons, myVis, NamedObjectCont< T >::remove(), SUMORTree::removeAdditionalGLObject(), TL, and WRITE_WARNINGF.
|
overridevirtual |
Adds dynamics to the given Polygon,.
Reimplemented from ShapeContainer.
Definition at line 97 of file GUIShapeContainer.cpp.
References ShapeContainer::addPolygonDynamics(), myVis, and PolygonDynamics::setRTree().
|
virtualinherited |
Register update command (for descheduling at removal)
Definition at line 287 of file ShapeContainer.cpp.
References ShapeContainer::myPolygonUpdateCommands.
Referenced by LIBSUMO_NAMESPACE::Polygon::addDynamics().
void GUIShapeContainer::allowReplacement | ( | ) |
allow replacement
Definition at line 204 of file GUIShapeContainer.cpp.
References myAllowReplacement.
|
protectedvirtualinherited |
Unschedules the removal and update commands of the given polygon.
[in] | id | The id of the polygon |
Definition at line 214 of file ShapeContainer.cpp.
References ShapeContainer::myPolygonUpdateCommands.
Referenced by ShapeContainer::removePolygonDynamics().
|
protectedvirtualinherited |
Definition at line 252 of file ShapeContainer.cpp.
References ShapeContainer::myHighlightedObjects, and ShapeContainer::myHighlightPolygons.
Referenced by ShapeContainer::registerHighlight().
|
protectedvirtualinherited |
Clears all highlight information from the maps when the object leaves the net (Highlight polygons and dynamics are removed via removeTrackers())
Definition at line 268 of file ShapeContainer.cpp.
References Named::getID(), and ShapeContainer::myHighlightPolygons.
Referenced by ShapeContainer::removePolygonDynamics().
|
inherited |
Remove all dynamics before quick-loading state.
Definition at line 206 of file ShapeContainer.cpp.
References ShapeContainer::myPolygonUpdateCommands.
Referenced by MSNet::clearState().
|
private |
Determine which polygons are active based on their type.
Definition at line 233 of file GUIShapeContainer.cpp.
References GUIPolygon::activate(), Shape::getShapeType(), myInactivePolygonTypes, and ShapeContainer::myPolygons.
Referenced by addInactivePolygonTypes(), removeInactivePolygonTypes(), and setInactivePolygonTypes().
|
inline |
Definition at line 143 of file GUIShapeContainer.h.
References myInactivePolygonTypes.
std::vector< GUIGlID > GUIShapeContainer::getPOIIds | ( | ) | const |
Returns the gl-ids of all pois.
Definition at line 182 of file GUIShapeContainer.cpp.
References GUIGlObject::getGlID(), ShapeContainer::getPOIs(), and myLock.
|
inlineinherited |
Returns all pois.
Definition at line 157 of file ShapeContainer.h.
References ShapeContainer::myPOIs.
Referenced by LIBSUMO_NAMESPACE::POI::add(), ShapeHandler::addPOI(), LIBSUMO_NAMESPACE::POI::getPoI(), getPOIIds(), LIBSUMO_NAMESPACE::POI::getTree(), PCLoaderVisum::load(), NWWriter_OpenDrive::mapmatchRoadObjects(), LIBSUMO_NAMESPACE::POI::remove(), NWWriter_OpenDrive::writeRoadObjects(), and NWWriter_OpenDrive::writeSignals().
std::vector< GUIGlID > GUIShapeContainer::getPolygonIDs | ( | ) | const |
Returns the gl-ids of all polygons.
Definition at line 193 of file GUIShapeContainer.cpp.
References GUIGlObject::getGlID(), ShapeContainer::getPolygons(), and myLock.
|
inlineinherited |
Returns all polygons.
Definition at line 152 of file ShapeContainer.h.
References ShapeContainer::myPolygons.
Referenced by LIBSUMO_NAMESPACE::Polygon::add(), MSPModel_JuPedSim::add(), NLHandler::addDistrict(), ShapeHandler::addPoly(), MSPModel_JuPedSim::buildPedestrianNetwork(), MSDevice_FCD::buildShapeFilter(), GUIViewTraffic::changePedestrianNetworkColor(), LIBSUMO_NAMESPACE::Polygon::exists(), LIBSUMO_NAMESPACE::Polygon::getPolygon(), getPolygonIDs(), LIBSUMO_NAMESPACE::Polygon::getTree(), MSPModel_JuPedSim::initialize(), PCLoaderVisum::load(), PCLoaderDlrNavteq::loadPolyFile(), NWWriter_OpenDrive::mapmatchRoadObjects(), MSPModel_JuPedSim::preparePolygonForDrawing(), LIBSUMO_NAMESPACE::Polygon::remove(), NWWriter_OpenDrive::writeNetwork(), and NWWriter_OpenDrive::writeRoadObjects().
|
overridevirtual |
Assigns a new position to the named PoI.
[in] | id | The id of the PoI to move |
[in] | pos | The PoI's new position |
Reimplemented from ShapeContainer.
Definition at line 157 of file GUIShapeContainer.cpp.
References SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myLock, ShapeContainer::myPOIs, myVis, and SUMORTree::removeAdditionalGLObject().
|
overridevirtual |
Update PolygonDynamics,.
Reimplemented from ShapeContainer.
Definition at line 113 of file GUIShapeContainer.cpp.
References SUMORTree::addAdditionalGLObject(), PolygonDynamics::getPolygon(), myLock, myVis, ShapeContainer::polygonDynamicsUpdate(), and SUMORTree::removeAdditionalGLObject().
|
virtualinherited |
register highlight of the specified type if the given id
Definition at line 236 of file ShapeContainer.cpp.
References ShapeContainer::clearHighlight(), ShapeContainer::myHighlightedObjects, ShapeContainer::myHighlightPolygons, and ShapeContainer::removePolygon().
Referenced by LIBSUMO_NAMESPACE::Polygon::addHighlightPolygon().
void GUIShapeContainer::removeInactivePolygonTypes | ( | std::set< std::string > | inactivePolygonTypes | ) |
Remove some polygon types that were deemed as inactive.
inactivePolygonTypes | Some set of inactive polygon types. |
Definition at line 224 of file GUIShapeContainer.cpp.
References computeActivePolygons(), and myInactivePolygonTypes.
Referenced by GUIViewTraffic::drawPedestrianNetwork().
|
overridevirtual |
Removes a PoI from the container.
[in] | id | The id of the PoI |
Reimplemented from ShapeContainer.
Definition at line 145 of file GUIShapeContainer.cpp.
References NamedObjectCont< T >::get(), myLock, ShapeContainer::myPOIs, myVis, NamedObjectCont< T >::remove(), and SUMORTree::removeAdditionalGLObject().
|
overridevirtual |
Removes a polygon from the container.
[in] | id | The id of the polygon |
Reimplemented from ShapeContainer.
Definition at line 128 of file GUIShapeContainer.cpp.
References NamedObjectCont< T >::get(), myLock, ShapeContainer::myPolygons, myVis, SUMORTree::removeAdditionalGLObject(), and ShapeContainer::removePolygon().
|
virtualinherited |
Remove dynamics (animation / tracking) for the given polygon.
polyID | ID of the polygon for which dynamics shall be removed |
Definition at line 113 of file ShapeContainer.cpp.
References ShapeContainer::cleanupPolygonDynamics(), ShapeContainer::clearHighlights(), NamedObjectCont< T >::get(), ShapeContainer::myPolygonDynamics, ShapeContainer::myPolygons, and ShapeContainer::myTrackingPolygons.
Referenced by ShapeContainer::addPolygonDynamics(), and ShapeContainer::removePolygon().
|
virtualinherited |
Remove all tracking polygons for the given object.
Definition at line 293 of file ShapeContainer.cpp.
References ShapeContainer::myTrackingPolygons, and ShapeContainer::removePolygon().
Referenced by MSDynamicShapeUpdater::vehicleStateChanged().
|
overridevirtual |
Assigns a shape to the named polygon.
[in] | id | The id of the polygon to reshape |
[in] | shape | The polygon's new shape |
Reimplemented from ShapeContainer.
Definition at line 169 of file GUIShapeContainer.cpp.
References SUMORTree::addAdditionalGLObject(), NamedObjectCont< T >::get(), myLock, ShapeContainer::myPolygons, myVis, SUMORTree::removeAdditionalGLObject(), and GUIPolygon::setShape().
void GUIShapeContainer::setInactivePolygonTypes | ( | std::set< std::string > | inactivePolygonTypes | ) |
Sets polygon types that define which one is active or not.
inactivePolygonTypes | The whole set of inactive polygon types. |
Definition at line 210 of file GUIShapeContainer.cpp.
References computeActivePolygons(), and myInactivePolygonTypes.
|
private |
whether existing ids shall be replaced
Definition at line 167 of file GUIShapeContainer.h.
Referenced by addPOI(), addPolygon(), and allowReplacement().
|
protectedinherited |
inverse map to myHighlightPolygons saves the highlighted object for each polygon
Definition at line 213 of file ShapeContainer.h.
Referenced by ShapeContainer::clearHighlight(), and ShapeContainer::registerHighlight().
|
protectedinherited |
maps objects to a map of highlight types to highlighting polygons
Definition at line 211 of file ShapeContainer.h.
Referenced by ShapeContainer::clearHighlight(), ShapeContainer::clearHighlights(), and ShapeContainer::registerHighlight().
|
private |
The polygon types that define the inactive polygons.
Definition at line 170 of file GUIShapeContainer.h.
Referenced by addInactivePolygonTypes(), addPolygon(), computeActivePolygons(), getInactiveTypes(), removeInactivePolygonTypes(), and setInactivePolygonTypes().
|
mutableprivate |
The mutex for adding/removing operations.
Definition at line 161 of file GUIShapeContainer.h.
Referenced by addPOI(), addPolygon(), getPOIIds(), getPolygonIDs(), movePOI(), polygonDynamicsUpdate(), removePOI(), removePolygon(), and reshapePolygon().
|
protectedinherited |
stored POIs
Definition at line 221 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), addPOI(), ShapeContainer::getPOIs(), ShapeContainer::movePOI(), movePOI(), ShapeContainer::removePOI(), removePOI(), PCPolyContainer::save(), PCPolyContainer::saveDlrTDP(), and PCPolyContainer::~PCPolyContainer().
|
protectedinherited |
stored PolygonDynamics
Definition at line 208 of file ShapeContainer.h.
Referenced by ShapeContainer::addPolygonDynamics(), ShapeContainer::removePolygonDynamics(), and ShapeContainer::~ShapeContainer().
|
protectedinherited |
stored Polygons
Definition at line 205 of file ShapeContainer.h.
Referenced by ShapeContainer::add(), addPolygon(), ShapeContainer::addPolygonDynamics(), computeActivePolygons(), ShapeContainer::getPolygons(), ShapeContainer::removePolygon(), removePolygon(), ShapeContainer::removePolygonDynamics(), ShapeContainer::reshapePolygon(), reshapePolygon(), PCPolyContainer::save(), PCPolyContainer::saveDlrTDP(), and PCPolyContainer::~PCPolyContainer().
|
privateinherited |
Command pointers for scheduled polygon update. Maps PolyID->Command.
Definition at line 225 of file ShapeContainer.h.
Referenced by ShapeContainer::addPolygonUpdateCommand(), ShapeContainer::cleanupPolygonDynamics(), ShapeContainer::clearState(), ShapeContainer::polygonDynamicsUpdate(), and ShapeContainer::~ShapeContainer().
|
protectedinherited |
Information about tracked objects.
Definition at line 218 of file ShapeContainer.h.
Referenced by ShapeContainer::addPolygonDynamics(), ShapeContainer::removePolygonDynamics(), and ShapeContainer::removeTrackers().
|
private |
The RTree structure to add and remove visualization elements.
Definition at line 164 of file GUIShapeContainer.h.
Referenced by addPOI(), addPolygon(), addPolygonDynamics(), movePOI(), polygonDynamicsUpdate(), removePOI(), removePolygon(), and reshapePolygon().