Class SwingTrajectoryPlot

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class SwingTrajectoryPlot extends SwingSpaceTimePlot
Embed a TrajectoryPlot in a Swing JPanel.

Copyright (c) 2023-2024 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
See Also:
  • Constructor Details

    • SwingTrajectoryPlot

      public SwingTrajectoryPlot(TrajectoryPlot plot)
      Construct a new Swing container for a TrajectoryPlot. Default colorers for blue, speed, id and acceleration are used if the plot has a single lane.
      Parameters:
      plot - the plot to embed
    • SwingTrajectoryPlot

      public SwingTrajectoryPlot(TrajectoryPlot plot, boolean defaultColorers)
      Constructor. Default colorers might be set based on the input, but only when the plot has a single lane.
      Parameters:
      plot - the plot to embed
      defaultColorers - whether to use default colorers for blue, speed, id and acceleration
  • Method Details

    • addColorer

      public void addColorer(TrajectoryColorer colorer, boolean selected)
      Add colorer.
      Parameters:
      colorer - colorer
      selected - whether the colorer should be the selected one
      Throws:
      IllegalStateException - when the plot has multiple lanes, in which case colorers are not supported
    • addPopUpMenuItems

      protected void addPopUpMenuItems(JPopupMenu popupMenu)
      Description copied from class: SwingPlot
      Overridable method to add pop up items.
      Overrides:
      addPopUpMenuItems in class SwingSpaceTimePlot
      Parameters:
      popupMenu - pop up menu
    • getChartMouseListener

      protected Optional<org.jfree.chart.ChartMouseListener> getChartMouseListener()
      Overridable; may return a chart listener for additional functions. This implementation creates a listener to disable and enable lanes through the legend, and to display density, flow of speed of a line.
      Overrides:
      getChartMouseListener in class SwingPlot
      Returns:
      ChartMouseListener, empty by default
    • getPlot

      public TrajectoryPlot getPlot()
      Retrieve the plot.
      Overrides:
      getPlot in class SwingSpaceTimePlot
      Returns:
      the plot