Class TrajectoryPlot
java.lang.Object
org.opentrafficsim.animation.graphs.AbstractPlot<S>
org.opentrafficsim.animation.graphs.AbstractBoundedPlot<S>
org.opentrafficsim.animation.graphs.AbstractSpaceTimePlot<TrajectoryPlot.TrajectoriesPaintState>
org.opentrafficsim.animation.graphs.TrajectoryPlot
- All Implemented Interfaces:
Identifiable,org.jfree.data.general.Dataset,org.jfree.data.general.SeriesDataset,org.jfree.data.xy.XYDataset
public class TrajectoryPlot
extends AbstractSpaceTimePlot<TrajectoryPlot.TrajectoriesPaintState>
implements org.jfree.data.xy.XYDataset
Plot of trajectories along a path.
Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordPaint state for trajectory plot. -
Field Summary
Fields inherited from class org.opentrafficsim.animation.graphs.AbstractPlot
DEFAULT_INITIAL_UPPER_TIME_BOUND, GRAPH_ADD_EVENT, GRAPH_REMOVE_EVENT -
Constructor Summary
ConstructorsConstructorDescriptionTrajectoryPlot(String caption, org.djunits.value.vdouble.scalar.Duration updateInterval, PlotScheduler scheduler, SamplerData<?> samplerData, GraphPath<? extends LaneData<?>> path) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculatePaintState(org.djunits.value.vdouble.scalar.Duration time) Calculates the paint state object and offers it throughAbstractPlot.offerPaintState(S), or delegates this work to a delegate.protected TrajectoryPlot.TrajectoriesPaintStateReturns an empty paint state.org.jfree.data.DomainOrderprotected final org.djunits.value.vdouble.scalar.LengthReturns the total space.Return the graph type for transceiver.intgetItemCount(int series) intReturns the number of lanes.Retrieve the lane visibility flags.org.jfree.chart.LegendItemCollectionRetrieve the legend.intgetSeriesKey(int series) getStatusLabel(double domainValue, double rangeValue) Returns the status label when the mouse is over the given location.getX(int series, int item) doublegetXValue(int series, int item) getY(int series, int item) doublegetYValue(int series, int item) intindexOf(Comparable seriesKey) voidsetColorer(TrajectoryColorer colorer) Sets the color renderer for trajectories.toString()Methods inherited from class org.opentrafficsim.animation.graphs.AbstractSpaceTimePlot
setAutoBoundDomain, setAutoBoundRange, setChart, setPaintState, updateFixedDomainRangeMethods inherited from class org.opentrafficsim.animation.graphs.AbstractBoundedPlot
setLowerDomainBound, setLowerRangeBound, setUpperDomainBound, setUpperRangeBoundMethods inherited from class org.opentrafficsim.animation.graphs.AbstractPlot
addChangeListener, encodeAsPng, getAvailableTime, getCaption, getChart, getGroup, getId, getPaintState, invalidate, notifyPlotChange, offerPaintState, offerUpdateInterval, removeChangeListener, setGroup, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
TrajectoryPlot
public TrajectoryPlot(String caption, org.djunits.value.vdouble.scalar.Duration updateInterval, PlotScheduler scheduler, SamplerData<?> samplerData, GraphPath<? extends LaneData<?>> path) Constructor.- Parameters:
caption- captionupdateInterval- regular update interval (simulation time)scheduler- scheduler.samplerData- sampler datapath- path- Throws:
IllegalArgumentException- when the path contains more than 6 lanes
-
-
Method Details
-
setColorer
Sets the color renderer for trajectories.- Parameters:
colorer- color renderer
-
getGraphType
Description copied from class:AbstractPlotReturn the graph type for transceiver.- Specified by:
getGraphTypein classAbstractPlot<TrajectoryPlot.TrajectoriesPaintState>- Returns:
- the graph type.
-
getStatusLabel
Description copied from class:AbstractPlotReturns the status label when the mouse is over the given location.- Specified by:
getStatusLabelin classAbstractPlot<TrajectoryPlot.TrajectoriesPaintState>- Parameters:
domainValue- domain value (x-axis)rangeValue- range value (y-axis)- Returns:
- status label when the mouse is over the given location
-
getSeriesCount
public int getSeriesCount()- Specified by:
getSeriesCountin interfaceorg.jfree.data.general.SeriesDataset
-
getLaneCount
public int getLaneCount()Returns the number of lanes.- Returns:
- the number of lanes
-
getSeriesKey
- Specified by:
getSeriesKeyin interfaceorg.jfree.data.general.SeriesDataset
-
indexOf
- Specified by:
indexOfin interfaceorg.jfree.data.general.SeriesDataset
-
getDomainOrder
public org.jfree.data.DomainOrder getDomainOrder()- Specified by:
getDomainOrderin interfaceorg.jfree.data.xy.XYDataset
-
getItemCount
public int getItemCount(int series) - Specified by:
getItemCountin interfaceorg.jfree.data.xy.XYDataset
-
getX
- Specified by:
getXin interfaceorg.jfree.data.xy.XYDataset
-
getXValue
public double getXValue(int series, int item) - Specified by:
getXValuein interfaceorg.jfree.data.xy.XYDataset
-
getY
- Specified by:
getYin interfaceorg.jfree.data.xy.XYDataset
-
getYValue
public double getYValue(int series, int item) - Specified by:
getYValuein interfaceorg.jfree.data.xy.XYDataset
-
toString
-
getLegend
public org.jfree.chart.LegendItemCollection getLegend()Retrieve the legend.- Returns:
- the legend
-
getLaneVisible
Retrieve the lane visibility flags. These can be set externally in the list.- Returns:
- the lane visibility flags
-
getEndLocation
protected final org.djunits.value.vdouble.scalar.Length getEndLocation()Description copied from class:AbstractSpaceTimePlotReturns the total space.- Specified by:
getEndLocationin classAbstractSpaceTimePlot<TrajectoryPlot.TrajectoriesPaintState>- Returns:
- total space
-
emptyPaintState
Description copied from class:AbstractPlotReturns an empty paint state. This is used at plot initialization.- Specified by:
emptyPaintStatein classAbstractPlot<TrajectoryPlot.TrajectoriesPaintState>- Returns:
- empty paint state.
-
calculatePaintState
protected void calculatePaintState(org.djunits.value.vdouble.scalar.Duration time) Description copied from class:AbstractPlotCalculates the paint state object and offers it throughAbstractPlot.offerPaintState(S), or delegates this work to a delegate. This method is invoked by the worker thread and can thus perform heavy calculations outside of the Swing EDT. Intermediate paint states during long calculations may also be offered. It is up to the implementation to either calculate a complete paint state, or cumulatively built on the results from previous calls. It is also up to the implementation to know when the whole time span needs to be recalculated due to property changes.- Specified by:
calculatePaintStatein classAbstractPlot<TrajectoryPlot.TrajectoriesPaintState>- Parameters:
time- time until which data in the paint state should be calculated
-