Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
PolygonDynamics.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2004-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A polygon, which holds a timeSpan for displaying dynamic properties
19/****************************************************************************/
20
21
22#pragma once
23#include <config.h>
24
25#include <memory>
26#include "SUMOPolygon.h"
28
30class ShapeContainer;
31class SUMORTree;
32
34public:
49 PolygonDynamics(double creationTime,
50 SUMOPolygon* p,
51 SUMOTrafficObject* trackedObject,
52 const std::vector<double>& timeSpan,
53 const std::vector<double>& alphaSpan,
54 bool looped,
55 bool rotate);
56 virtual ~PolygonDynamics();
57
58 const std::string& getPolygonID() const {
59 return myPolygon->getID();
60 }
61
63 return myPolygon;
64 }
65
66 inline const std::string& getTrackedObjectID() const {
67 return myTrackedObjectID;
68 }
69
74
76 void setRTree(SUMORTree* rtree) {
77 myVis = rtree;
78 }
79
80private:
81
83 void setAlpha(double alpha);
84
87
90
93
96
100
102 bool looped;
103
106
108 bool rotate;
109
112 std::string myTrackedObjectID;
113
115 std::unique_ptr<Position> myTrackedObjectsInitialPositon;
116
119
123 std::unique_ptr<PositionVector> myOriginalShape;
124
127 std::unique_ptr<std::vector<double> > myTimeSpan;
128
131 std::vector<double>::const_iterator myPrevTime;
132 std::vector<double>::const_iterator myNextTime;
133
135 std::unique_ptr<std::vector<double> > myAlphaSpan;
138 std::vector<double>::const_iterator myPrevAlpha;
139 std::vector<double>::const_iterator myNextAlpha;
140
143
144};
long long int SUMOTime
Definition GUI.h:36
const std::string & getID() const
Returns the id.
Definition Named.h:74
std::vector< double >::const_iterator myNextAlpha
std::unique_ptr< Position > myTrackedObjectsInitialPositon
Initial position of the tracked object.
SUMOPolygon * getPolygon() const
bool looped
Whether animation should be looped.
virtual ~PolygonDynamics()
void initTrackedPosition()
Initialize the object's position.
void setRTree(SUMORTree *rtree)
Set the RTree.
bool tracking
Whether this polygon tracks an object.
std::string myTrackedObjectID
double myTrackedObjectsInitialAngle
Initial angle of the tracked object.
std::unique_ptr< std::vector< double > > myTimeSpan
Time points corresponding to the anchor values of the dynamic properties.
const std::string & getTrackedObjectID() const
std::vector< double >::const_iterator myNextTime
void setAlpha(double alpha)
Sets the alpha value for the shape's color.
bool animated
Whether this polygon is animated, i.e., whether timelines should be used to control properties.
double myCurrentTime
Current time.
SUMOTrafficObject * myTrackedObject
An object tracked by the shape, deletion by caller.
std::vector< double >::const_iterator myPrevTime
Pointer to the next time points in timeSpan.
SUMOPolygon * myPolygon
The polygon this dynamics acts upon.
bool rotate
Whether this polygon should be rotated with the tracked object.
const std::string & getPolygonID() const
std::unique_ptr< PositionVector > myOriginalShape
the original shape of the polygon (in case of tracking another object, this is converted to relative ...
std::unique_ptr< std::vector< double > > myAlphaSpan
Alpha values corresponding to.
SUMORTree * myVis
RTree will be supplied in case of GUI simulation to be updated on move.
double myLastUpdateTime
The last time the animation has been updated.
std::vector< double >::const_iterator myPrevAlpha
Pointer to the next alpha points in alphaSpan.
A RT-tree for efficient storing of SUMO's GL-objects.
Definition SUMORTree.h:66
Representation of a vehicle, person, or container.
Storage for geometrical objects.