Package org.opentrafficsim.draw.graphs
Class AbstractSpaceTimePlot
java.lang.Object
org.opentrafficsim.draw.graphs.AbstractPlot
org.opentrafficsim.draw.graphs.AbstractBoundedPlot
org.opentrafficsim.draw.graphs.AbstractSpaceTimePlot
- All Implemented Interfaces:
Dataset,org.opentrafficsim.base.Identifiable
- Direct Known Subclasses:
AbstractSamplerPlot
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-2023 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
-
Field Summary
Fields inherited from class org.opentrafficsim.draw.graphs.AbstractPlot
DEFAULT_INITIAL_UPPER_TIME_BOUND, GRAPH_ADD_EVENT, GRAPH_REMOVE_EVENT -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSpaceTimePlot(String caption, Duration updateInterval, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, Duration delay, Time initialEnd) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract LengthReturns the total path length.final voidsetAutoBoundDomain(XYPlot plot) Overridable; activates auto bounds on domain axis from user input.final voidsetAutoBoundRange(XYPlot plot) Overridable; activates auto bounds on range axis from user input.protected voidsetChart(JFreeChart chart) Sets the chart and adds menus and listeners.protected voidupdate()Redraws the plot and schedules the next update.voidupdateFixedDomainRange(boolean fixed) Update the fixed-ness of the domain range.Methods inherited from class org.opentrafficsim.draw.graphs.AbstractBoundedPlot
setLowerDomainBound, setLowerRangeBound, setUpperDomainBound, setUpperRangeBoundMethods inherited from class org.opentrafficsim.draw.graphs.AbstractPlot
addChangeListener, encodeAsPng, getCaption, getChart, getGraphType, getGroup, getId, getSimulator, getStatusLabel, getUpdateTime, increaseTime, notifyPlotChange, removeChangeListener, setGroup, setUpdateInterval
-
Constructor Details
-
AbstractSpaceTimePlot
public AbstractSpaceTimePlot(String caption, Duration updateInterval, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, Duration delay, Time initialEnd) Constructor.- Parameters:
caption- String; captionupdateInterval- Duration; regular update interval (simulation time)simulator- OtsSimulatorInterface; simulatordelay- Duration; amount of time that chart runs behind simulation to prevent gaps in the charted datainitialEnd- Time; initial end time of plots, will be expanded if simulation time exceeds it
-
-
Method Details
-
setChart
Sets the chart and adds menus and listeners.- Overrides:
setChartin classAbstractBoundedPlot- Parameters:
chart- JFreeChart; chart
-
update
protected void update()Redraws the plot and schedules the next update.- Overrides:
updatein classAbstractPlot
-
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
Overridable; activates auto bounds on domain axis from user input. This class does not force the use ofXYPlots, but the auto bounds command comes from theChartPanelthat this class creates. In case the used plot is aXYPlot, this method is then invoked. Sub classes with auto domain bounds that work with anXYPlotshould implement this. The method is not abstract as the use ofXYPlotis not obligated. This implementation overrides to enable it's own form of auto bounds.- Overrides:
setAutoBoundDomainin classAbstractBoundedPlot- Parameters:
plot- XYPlot; plot
-
setAutoBoundRange
Overridable; activates auto bounds on range axis from user input. This class does not force the use ofXYPlots, but the auto bounds command comes from theChartPanelthat this class creates. In case the used plot is aXYPlot, this method is then invoked. Sub classes with auto range bounds that work with anXYPlotshould implement this. The method is not abstract as the use ofXYPlotis not obligated. This implementation overrides to enable it's own form of auto bounds.- Overrides:
setAutoBoundRangein classAbstractBoundedPlot- Parameters:
plot- XYPlot; plot
-
getEndLocation
Returns the total path length.- Returns:
- Length; total path length
-