Class AbstractSpaceTimePlot

  • All Implemented Interfaces:
    Dataset, Identifiable
    Direct Known Subclasses:
    AbstractSamplerPlot

    public abstract class AbstractSpaceTimePlot
    extends AbstractBoundedPlot
    Plots with space-time. This class adds some zoom control, where a user can manually select a zoom range, or the plot automatically zooms over the entire space range, and either the entire or some most recent fixed period in time.

    Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version 14 okt. 2018
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • AbstractSpaceTimePlot

        public AbstractSpaceTimePlot​(String caption,
                                     Duration updateInterval,
                                     OTSSimulatorInterface simulator,
                                     Duration delay,
                                     Time initialEnd)
        Constructor.
        Parameters:
        caption - String; caption
        updateInterval - Duration; regular update interval (simulation time)
        simulator - OTSSimulatorInterface; simulator
        delay - Duration; amount of time that chart runs behind simulation to prevent gaps in the charted data
        initialEnd - Time; initial end time of plots, will be expanded if simulation time exceeds it
    • Method Detail

      • setChart

        protected void setChart​(JFreeChart chart)
        Sets the chart and adds menus and listeners.
        Overrides:
        setChart in class AbstractBoundedPlot
        Parameters:
        chart - JFreeChart; chart
      • update

        protected void update()
        Redraws the plot and schedules the next update.
        Overrides:
        update in class AbstractPlot
      • updateFixedDomainRange

        public void updateFixedDomainRange​(boolean fixed)
        Update the fixed-ness of the domain range.
        Parameters:
        fixed - boolean; if true; the domain range will not update when new data becomes available; if false; the domain range will update to show newly available data
      • setAutoBoundDomain

        public final void setAutoBoundDomain​(XYPlot plot)
        Overridable; activates auto bounds on domain axis from user input. This class does not force the use of XYPlots, but the auto bounds command comes from the ChartPanel that this class creates. In case the used plot is a XYPlot, this method is then invoked. Sub classes with auto domain bounds that work with an XYPlot should implement this. The method is not abstract as the use of XYPlot is not obligated. This implementation overrides to enable it's own form of auto bounds.
        Overrides:
        setAutoBoundDomain in class AbstractBoundedPlot
        Parameters:
        plot - XYPlot; plot
      • setAutoBoundRange

        public final void setAutoBoundRange​(XYPlot plot)
        Overridable; activates auto bounds on range axis from user input. This class does not force the use of XYPlots, but the auto bounds command comes from the ChartPanel that this class creates. In case the used plot is a XYPlot, this method is then invoked. Sub classes with auto range bounds that work with an XYPlot should implement this. The method is not abstract as the use of XYPlot is not obligated. This implementation overrides to enable it's own form of auto bounds.
        Overrides:
        setAutoBoundRange in class AbstractBoundedPlot
        Parameters:
        plot - XYPlot; plot
      • getEndLocation

        protected abstract Length getEndLocation()
        Returns the total path length.
        Returns:
        Length; total path length