class TrajectoryPlot.VariableSampleRateTrajectory extends Object implements TrajectoryPlot.Trajectory, Serializable
Modifier and Type | Class and Description |
---|---|
(package private) class |
TrajectoryPlot.VariableSampleRateTrajectory.DistanceAndTime
Store a position and a time.
|
Constructor and Description |
---|
VariableSampleRateTrajectory(String id)
Construct a new VariableSamplerateTrajectory.
|
Modifier and Type | Method and Description |
---|---|
void |
addSample(LaneBasedGTU gtu,
Lane lane,
double position)
Add a trajectory segment sample and update the currentEndTime and currentEndPosition.
|
org.djunits.value.vdouble.scalar.Time |
getCurrentEndTime()
Retrieve the time of the last stored event.
|
double |
getDistance(int item)
Return the distance of the Nth stored sample.
|
String |
getId()
Retrieve the id of this Trajectory.
|
Double |
getLastPosition()
Retrieve the last recorded non-null position, or null if no non-null positions have been recorded yet.
|
double |
getTime(int item)
Return the time of the Nth stored sample.
|
void |
recordGTULeftTrajectoryEvent()
Store that the GTU went off of the trajectory.
|
int |
size()
Retrieve the number of stored samples in this Trajectory.
|
String |
toString() |
public VariableSampleRateTrajectory(String id)
id
- String; id of the new Trajectory (id of the GTU)public org.djunits.value.vdouble.scalar.Time getCurrentEndTime()
getCurrentEndTime
in interface TrajectoryPlot.Trajectory
public Double getLastPosition()
getLastPosition
in interface TrajectoryPlot.Trajectory
public String getId()
getId
in interface TrajectoryPlot.Trajectory
public void addSample(LaneBasedGTU gtu, Lane lane, double position) throws org.opentrafficsim.core.network.NetworkException, org.opentrafficsim.core.gtu.GTUException
addSample
in interface TrajectoryPlot.Trajectory
gtu
- AbstractLaneBasedGTU; the GTU whose currently committed trajectory segment must be addedlane
- Lane; the Lane that the positionOffset is valid forposition
- Double; distance in meters from the start of the trajectoryorg.opentrafficsim.core.network.NetworkException
- when car is not on lane anymoreorg.opentrafficsim.core.gtu.GTUException
- on problems obtaining data from the GTUpublic void recordGTULeftTrajectoryEvent()
public int size()
size
in interface TrajectoryPlot.Trajectory
public double getTime(int item)
getTime
in interface TrajectoryPlot.Trajectory
item
- int; the index of the samplepublic double getDistance(int item)
getDistance
in interface TrajectoryPlot.Trajectory
item
- int; the index of the sampleCopyright © 2014–2016 Delft University of Technology. All rights reserved.