Class 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
  • 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 - caption
      updateInterval - regular update interval (simulation time)
      scheduler - scheduler.
      samplerData - sampler data
      path - path
      Throws:
      IllegalArgumentException - when the path contains more than 6 lanes
  • Method Details

    • setColorer

      public void setColorer(TrajectoryColorer colorer)
      Sets the color renderer for trajectories.
      Parameters:
      colorer - color renderer
    • getGraphType

      public GraphType getGraphType()
      Description copied from class: AbstractPlot
      Return the graph type for transceiver.
      Specified by:
      getGraphType in class AbstractPlot<TrajectoryPlot.TrajectoriesPaintState>
      Returns:
      the graph type.
    • getStatusLabel

      public String getStatusLabel(double domainValue, double rangeValue)
      Description copied from class: AbstractPlot
      Returns the status label when the mouse is over the given location.
      Specified by:
      getStatusLabel in class AbstractPlot<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:
      getSeriesCount in interface org.jfree.data.general.SeriesDataset
    • getLaneCount

      public int getLaneCount()
      Returns the number of lanes.
      Returns:
      the number of lanes
    • getSeriesKey

      public Comparable<Integer> getSeriesKey(int series)
      Specified by:
      getSeriesKey in interface org.jfree.data.general.SeriesDataset
    • indexOf

      public int indexOf(Comparable seriesKey)
      Specified by:
      indexOf in interface org.jfree.data.general.SeriesDataset
    • getDomainOrder

      public org.jfree.data.DomainOrder getDomainOrder()
      Specified by:
      getDomainOrder in interface org.jfree.data.xy.XYDataset
    • getItemCount

      public int getItemCount(int series)
      Specified by:
      getItemCount in interface org.jfree.data.xy.XYDataset
    • getX

      public Number getX(int series, int item)
      Specified by:
      getX in interface org.jfree.data.xy.XYDataset
    • getXValue

      public double getXValue(int series, int item)
      Specified by:
      getXValue in interface org.jfree.data.xy.XYDataset
    • getY

      public Number getY(int series, int item)
      Specified by:
      getY in interface org.jfree.data.xy.XYDataset
    • getYValue

      public double getYValue(int series, int item)
      Specified by:
      getYValue in interface org.jfree.data.xy.XYDataset
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLegend

      public org.jfree.chart.LegendItemCollection getLegend()
      Retrieve the legend.
      Returns:
      the legend
    • getLaneVisible

      public List<Boolean> 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: AbstractSpaceTimePlot
      Returns the total space.
      Specified by:
      getEndLocation in class AbstractSpaceTimePlot<TrajectoryPlot.TrajectoriesPaintState>
      Returns:
      total space
    • emptyPaintState

      protected TrajectoryPlot.TrajectoriesPaintState emptyPaintState()
      Description copied from class: AbstractPlot
      Returns an empty paint state. This is used at plot initialization.
      Specified by:
      emptyPaintState in class AbstractPlot<TrajectoryPlot.TrajectoriesPaintState>
      Returns:
      empty paint state.
    • calculatePaintState

      protected void calculatePaintState(org.djunits.value.vdouble.scalar.Duration time)
      Description copied from class: AbstractPlot
      Calculates the paint state object and offers it through AbstractPlot.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:
      calculatePaintState in class AbstractPlot<TrajectoryPlot.TrajectoriesPaintState>
      Parameters:
      time - time until which data in the paint state should be calculated