Eclipse SUMO - Simulation of Urban MObility
|
#include <PolygonDynamics.h>
Public Member Functions | |
SUMOPolygon * | getPolygon () 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. | |
void | setRTree (SUMORTree *rtree) |
Set the RTree. | |
SUMOTime | update (SUMOTime t) |
Updates the polygon according to its timeSpan and follows the tracked object. | |
virtual | ~PolygonDynamics () |
Private Member Functions | |
void | initTrackedPosition () |
Initialize the object's position. | |
void | setAlpha (double alpha) |
Sets the alpha value for the shape's color. | |
Private Attributes | |
bool | animated |
Whether this polygon is animated, i.e., whether timelines should be used to control properties. | |
bool | looped |
Whether animation should be looped. | |
std::unique_ptr< std::vector< double > > | myAlphaSpan |
Alpha values corresponding to. | |
double | myCurrentTime |
Current time. | |
double | myLastUpdateTime |
The last time the animation has been updated. | |
std::vector< double >::const_iterator | myNextAlpha |
std::vector< double >::const_iterator | myNextTime |
std::unique_ptr< PositionVector > | myOriginalShape |
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) | |
SUMOPolygon * | myPolygon |
The polygon this dynamics acts upon. | |
std::vector< double >::const_iterator | myPrevAlpha |
Pointer to the next alpha points in alphaSpan. | |
std::vector< double >::const_iterator | myPrevTime |
Pointer to the next time points in timeSpan. | |
std::unique_ptr< std::vector< double > > | myTimeSpan |
Time points corresponding to the anchor values of the dynamic properties. | |
SUMOTrafficObject * | myTrackedObject |
An object tracked by the shape, deletion by caller. | |
std::string | myTrackedObjectID |
double | myTrackedObjectsInitialAngle |
Initial angle of the tracked object. | |
std::unique_ptr< Position > | myTrackedObjectsInitialPositon |
Initial position of the tracked object. | |
SUMORTree * | myVis |
RTree will be supplied in case of GUI simulation to be updated on move. | |
bool | rotate |
Whether this polygon should be rotated with the tracked object. | |
bool | tracking |
Whether this polygon tracks an object. | |
Definition at line 33 of file PolygonDynamics.h.
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.
p | Polygon to be modified |
trackedObject | A tracked object (nullptr indicates that no tracking is desired) |
timeSpan | Anchor 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 |
...Span | property timelines (assumed to be either nullptr, or of size equal to timeSpan (in case of animated poly)) |
looped | Whether 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. |
rotate | Whether 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.
|
virtual |
Definition at line 93 of file PolygonDynamics.cpp.
|
inline |
Definition at line 62 of file PolygonDynamics.h.
References myPolygon.
Referenced by GUIShapeContainer::polygonDynamicsUpdate().
|
inline |
Definition at line 58 of file PolygonDynamics.h.
References Named::getID(), and myPolygon.
Referenced by LIBSUMO_NAMESPACE::Polygon::addDynamics(), and ShapeContainer::polygonDynamicsUpdate().
|
inline |
Definition at line 66 of file PolygonDynamics.h.
References myTrackedObjectID.
Referenced by ShapeContainer::addPolygonDynamics().
|
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().
|
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().
|
inline |
Set the RTree.
Definition at line 76 of file PolygonDynamics.h.
References myVis.
Referenced by GUIShapeContainer::addPolygonDynamics().
Updates the polygon according to its timeSpan and follows the tracked object.
t | Current sumo time step (in ms.) when this is called |
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().
|
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().
|
private |
Whether animation should be looped.
Definition at line 102 of file PolygonDynamics.h.
Referenced by update().
|
private |
Alpha values corresponding to.
Definition at line 135 of file PolygonDynamics.h.
Referenced by PolygonDynamics(), and update().
|
private |
|
private |
The last time the animation has been updated.
Definition at line 95 of file PolygonDynamics.h.
Referenced by update().
|
private |
Definition at line 139 of file PolygonDynamics.h.
Referenced by PolygonDynamics(), and update().
|
private |
Definition at line 132 of file PolygonDynamics.h.
Referenced by PolygonDynamics(), and update().
|
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().
|
private |
The polygon this dynamics acts upon.
Definition at line 89 of file PolygonDynamics.h.
Referenced by getPolygon(), getPolygonID(), setAlpha(), and update().
|
private |
Pointer to the next alpha points in alphaSpan.
Definition at line 138 of file PolygonDynamics.h.
Referenced by PolygonDynamics(), and update().
|
private |
Pointer to the next time points in timeSpan.
Definition at line 131 of file PolygonDynamics.h.
Referenced by PolygonDynamics(), and update().
|
private |
Time points corresponding to the anchor values of the dynamic properties.
Definition at line 127 of file PolygonDynamics.h.
Referenced by PolygonDynamics(), and update().
|
private |
An object tracked by the shape, deletion by caller.
Definition at line 111 of file PolygonDynamics.h.
Referenced by initTrackedPosition(), PolygonDynamics(), and update().
|
private |
Definition at line 112 of file PolygonDynamics.h.
Referenced by getTrackedObjectID(), and PolygonDynamics().
|
private |
Initial angle of the tracked object.
Definition at line 118 of file PolygonDynamics.h.
Referenced by initTrackedPosition(), and update().
|
private |
Initial position of the tracked object.
Definition at line 115 of file PolygonDynamics.h.
Referenced by initTrackedPosition(), and update().
|
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().
|
private |
Whether this polygon should be rotated with the tracked object.
Definition at line 108 of file PolygonDynamics.h.
Referenced by update().
|
private |
Whether this polygon tracks an object.
Definition at line 105 of file PolygonDynamics.h.
Referenced by PolygonDynamics(), and update().