Eclipse SUMO - Simulation of Urban MObility
PolygonDynamics Class Reference

#include <PolygonDynamics.h>

Collaboration diagram for PolygonDynamics:
[legend]

Public Member Functions

SUMOPolygongetPolygon () const
 
const std::string & getPolygonID () const
 
const std::string & getTrackedObjectID () const
 
 PolygonDynamics (double creationTime, SUMOPolygon *p, SUMOTrafficObject *trackedObject, const std::vector< double > &timeSpan, const std::vector< double > &alphaSpan, bool looped, bool rotate)
 Constructor that takes a SUMOPolygon and adds timelines for the properties to be modified dynamically. More...
 
void setRTree (SUMORTree *rtree)
 Set the RTree. More...
 
SUMOTime update (SUMOTime t)
 Updates the polygon according to its timeSpan and follows the tracked object. More...
 
virtual ~PolygonDynamics ()
 

Private Member Functions

void initTrackedPosition ()
 Initialize the object's position. More...
 
void setAlpha (double alpha)
 Sets the alpha value for the shape's color. More...
 

Private Attributes

bool animated
 Whether this polygon is animated, i.e., whether timelines should be used to control properties. More...
 
bool looped
 Whether animation should be looped. More...
 
std::unique_ptr< std::vector< double > > myAlphaSpan
 Alpha values corresponding to. More...
 
double myCurrentTime
 Current time. More...
 
double myLastUpdateTime
 The last time the animation has been updated. More...
 
std::vector< double >::const_iterator myNextAlpha
 
std::vector< double >::const_iterator myNextTime
 
std::unique_ptr< PositionVectormyOriginalShape
 the original shape of the polygon (in case of tracking another object, this is converted to relative coords wrt to the other objects initial position as origin) More...
 
SUMOPolygonmyPolygon
 The polygon this dynamics acts upon. More...
 
std::vector< double >::const_iterator myPrevAlpha
 Pointer to the next alpha points in alphaSpan. More...
 
std::vector< double >::const_iterator myPrevTime
 Pointer to the next time points in timeSpan. More...
 
std::unique_ptr< std::vector< double > > myTimeSpan
 Time points corresponding to the anchor values of the dynamic properties. More...
 
SUMOTrafficObjectmyTrackedObject
 An object tracked by the shape, deletion by caller. More...
 
std::string myTrackedObjectID
 
double myTrackedObjectsInitialAngle
 Initial angle of the tracked object. More...
 
std::unique_ptr< PositionmyTrackedObjectsInitialPositon
 Initial position of the tracked object. More...
 
SUMORTreemyVis
 RTree will be supplied in case of GUI simulation to be updated on move. More...
 
bool rotate
 Whether this polygon should be rotated with the tracked object. More...
 
bool tracking
 Whether this polygon tracks an object. More...
 

Detailed Description

Definition at line 33 of file PolygonDynamics.h.

Constructor & Destructor Documentation

◆ PolygonDynamics()

PolygonDynamics::PolygonDynamics ( double  creationTime,
SUMOPolygon p,
SUMOTrafficObject trackedObject,
const std::vector< double > &  timeSpan,
const std::vector< double > &  alphaSpan,
bool  looped,
bool  rotate 
)

Constructor that takes a SUMOPolygon and adds timelines for the properties to be modified dynamically.

Parameters
pPolygon to be modified
trackedObjectA tracked object (nullptr indicates that no tracking is desired)
timeSpanAnchor time points For animated polygons: assumed to have a size >= 2, and start at timeSpan[0]=0, such that timeSpan[i+1] >= timeSpan[i]) If no animation is desired, give timeSpan == nullptr
...Spanproperty timelines (assumed to be either nullptr, or of size equal to timeSpan (in case of animated poly))
loopedWhether the animation should restart when the last keyframe is reached. In that case the animation jumps to the first keyframe as soon as the last is reached. If looped==false, the controlled polygon is removed as soon as the timeSpan elapses.
rotateWhether the polygon shall be rotated with the tracked object.

Definition at line 32 of file PolygonDynamics.cpp.

References animated, Named::getID(), SUMOPolygon::getShape(), initTrackedPosition(), myAlphaSpan, myNextAlpha, myNextTime, myOriginalShape, myPrevAlpha, myPrevTime, myTimeSpan, myTrackedObject, myTrackedObjectID, and tracking.

◆ ~PolygonDynamics()

PolygonDynamics::~PolygonDynamics ( )
virtual

Definition at line 93 of file PolygonDynamics.cpp.

Member Function Documentation

◆ getPolygon()

SUMOPolygon* PolygonDynamics::getPolygon ( ) const
inline

Definition at line 62 of file PolygonDynamics.h.

References myPolygon.

Referenced by GUIShapeContainer::polygonDynamicsUpdate().

Here is the caller graph for this function:

◆ getPolygonID()

const std::string& PolygonDynamics::getPolygonID ( ) const
inline

Definition at line 58 of file PolygonDynamics.h.

References Named::getID(), and myPolygon.

Referenced by LIBSUMO_NAMESPACE::Polygon::addDynamics(), and ShapeContainer::polygonDynamicsUpdate().

Here is the caller graph for this function:

◆ getTrackedObjectID()

const std::string& PolygonDynamics::getTrackedObjectID ( ) const
inline

Definition at line 66 of file PolygonDynamics.h.

References myTrackedObjectID.

Referenced by ShapeContainer::addPolygonDynamics().

Here is the caller graph for this function:

◆ initTrackedPosition()

void PolygonDynamics::initTrackedPosition ( )
private

Initialize the object's position.

Definition at line 229 of file PolygonDynamics.cpp.

References SUMOTrafficObject::getAngle(), Named::getID(), SUMOTrafficObject::getPosition(), Position::INVALID, myOriginalShape, myTrackedObject, myTrackedObjectsInitialAngle, and myTrackedObjectsInitialPositon.

Referenced by PolygonDynamics(), and update().

Here is the caller graph for this function:

◆ setAlpha()

void PolygonDynamics::setAlpha ( double  alpha)
private

Sets the alpha value for the shape's color.

Definition at line 244 of file PolygonDynamics.cpp.

References myPolygon, and Shape::setShapeAlpha().

Referenced by update().

Here is the caller graph for this function:

◆ setRTree()

void PolygonDynamics::setRTree ( SUMORTree rtree)
inline

Set the RTree.

Definition at line 76 of file PolygonDynamics.h.

References myVis.

Referenced by GUIShapeContainer::addPolygonDynamics().

Here is the caller graph for this function:

◆ update()

SUMOTime PolygonDynamics::update ( SUMOTime  t)

Updates the polygon according to its timeSpan and follows the tracked object.

Parameters
tCurrent sumo time step (in ms.) when this is called
Returns
Next desired update time.

Definition at line 98 of file PolygonDynamics.cpp.

References PositionVector::add(), animated, DELTA_T, SUMOTrafficObject::getAngle(), Named::getID(), SUMOTrafficObject::getPosition(), initTrackedPosition(), Position::INVALID, looped, MAX2(), myAlphaSpan, myCurrentTime, myLastUpdateTime, myNextAlpha, myNextTime, myOriginalShape, myPolygon, myPrevAlpha, myPrevTime, myTimeSpan, myTrackedObject, myTrackedObjectsInitialAngle, myTrackedObjectsInitialPositon, rotate, PositionVector::rotate2D(), setAlpha(), SUMOPolygon::setShape(), STEPS2TIME, and tracking.

Referenced by ShapeContainer::polygonDynamicsUpdate().

Here is the caller graph for this function:

Field Documentation

◆ animated

bool PolygonDynamics::animated
private

Whether this polygon is animated, i.e., whether timelines should be used to control properties.

Definition at line 99 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().

◆ looped

bool PolygonDynamics::looped
private

Whether animation should be looped.

Definition at line 102 of file PolygonDynamics.h.

Referenced by update().

◆ myAlphaSpan

std::unique_ptr<std::vector<double> > PolygonDynamics::myAlphaSpan
private

Alpha values corresponding to.

Definition at line 135 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().

◆ myCurrentTime

double PolygonDynamics::myCurrentTime
private

Current time.

Definition at line 92 of file PolygonDynamics.h.

Referenced by update().

◆ myLastUpdateTime

double PolygonDynamics::myLastUpdateTime
private

The last time the animation has been updated.

Definition at line 95 of file PolygonDynamics.h.

Referenced by update().

◆ myNextAlpha

std::vector<double>::const_iterator PolygonDynamics::myNextAlpha
private

Definition at line 139 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().

◆ myNextTime

std::vector<double>::const_iterator PolygonDynamics::myNextTime
private

Definition at line 132 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().

◆ myOriginalShape

std::unique_ptr<PositionVector> PolygonDynamics::myOriginalShape
private

the original shape of the polygon (in case of tracking another object, this is converted to relative coords wrt to the other objects initial position as origin)

Definition at line 123 of file PolygonDynamics.h.

Referenced by initTrackedPosition(), PolygonDynamics(), and update().

◆ myPolygon

SUMOPolygon* PolygonDynamics::myPolygon
private

The polygon this dynamics acts upon.

Definition at line 89 of file PolygonDynamics.h.

Referenced by getPolygon(), getPolygonID(), setAlpha(), and update().

◆ myPrevAlpha

std::vector<double>::const_iterator PolygonDynamics::myPrevAlpha
private

Pointer to the next alpha points in alphaSpan.

Note
These iterators are only valid if alphaSpan != nullptr

Definition at line 138 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().

◆ myPrevTime

std::vector<double>::const_iterator PolygonDynamics::myPrevTime
private

Pointer to the next time points in timeSpan.

Note
These iterators are only valid if timeSpan != nullptr

Definition at line 131 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().

◆ myTimeSpan

std::unique_ptr<std::vector<double> > PolygonDynamics::myTimeSpan
private

Time points corresponding to the anchor values of the dynamic properties.

Note
Assumed to have a size >= 2, and start at timeSpan[0]=0, such that timeSpan[i+1] >= timeSpan[i]

Definition at line 127 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().

◆ myTrackedObject

SUMOTrafficObject* PolygonDynamics::myTrackedObject
private

An object tracked by the shape, deletion by caller.

Definition at line 111 of file PolygonDynamics.h.

Referenced by initTrackedPosition(), PolygonDynamics(), and update().

◆ myTrackedObjectID

std::string PolygonDynamics::myTrackedObjectID
private

Definition at line 112 of file PolygonDynamics.h.

Referenced by getTrackedObjectID(), and PolygonDynamics().

◆ myTrackedObjectsInitialAngle

double PolygonDynamics::myTrackedObjectsInitialAngle
private

Initial angle of the tracked object.

Definition at line 118 of file PolygonDynamics.h.

Referenced by initTrackedPosition(), and update().

◆ myTrackedObjectsInitialPositon

std::unique_ptr<Position> PolygonDynamics::myTrackedObjectsInitialPositon
private

Initial position of the tracked object.

Definition at line 115 of file PolygonDynamics.h.

Referenced by initTrackedPosition(), and update().

◆ myVis

SUMORTree* PolygonDynamics::myVis
private

RTree will be supplied in case of GUI simulation to be updated on move.

Definition at line 142 of file PolygonDynamics.h.

Referenced by setRTree().

◆ rotate

bool PolygonDynamics::rotate
private

Whether this polygon should be rotated with the tracked object.

Definition at line 108 of file PolygonDynamics.h.

Referenced by update().

◆ tracking

bool PolygonDynamics::tracking
private

Whether this polygon tracks an object.

Definition at line 105 of file PolygonDynamics.h.

Referenced by PolygonDynamics(), and update().


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