Class AbstractContourPlot<Z extends Number>

Type Parameters:
Z - z-value type
All Implemented Interfaces:
ActionListener, EventListener, org.djutils.base.Identifiable, org.jfree.data.general.Dataset, org.jfree.data.general.SeriesDataset, org.jfree.data.xy.XYDataset, org.jfree.data.xy.XYZDataset, XyInterpolatedDataset
Direct Known Subclasses:
ContourPlotAcceleration, ContourPlotDelay, ContourPlotDensity, ContourPlotFlow, ContourPlotSpeed

public abstract class AbstractContourPlot<Z extends Number> extends AbstractSamplerPlot implements XyInterpolatedDataset, ActionListener
Class for contour plots. The data that is plotted is stored in a ContourDataSource, which may be shared among several contour plots along the same path. This abstract class takes care of the interactions between the plot and the data pool. Sub classes only need to specify a few plot specific variables and functionalities.

Copyright (c) 2013-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
  • Constructor Details

    • AbstractContourPlot

      public AbstractContourPlot(String caption, PlotScheduler scheduler, ContourDataSource dataPool, BoundsPaintScale paintScale, Z legendStep, String legendFormat, String valueFormat)
      Constructor with specified paint scale.
      Parameters:
      caption - String; caption
      scheduler - PlotScheduler; scheduler.
      dataPool - ContourDataSource; data pool
      paintScale - BoundsPaintScale; paint scale
      legendStep - Z; increment between color legend entries
      legendFormat - String; format string for the captions in the color legend
      valueFormat - String; format string used to create status label (under the mouse)
    • AbstractContourPlot

      public AbstractContourPlot(String caption, PlotScheduler scheduler, ContourDataSource dataPool, Z legendStep, String legendFormat, Z minValue, Z maxValue, String valueFormat)
      Constructor with default paint scale.
      Parameters:
      caption - String; caption
      scheduler - PlotScheduler; scheduler.
      dataPool - ContourDataSource; data pool
      legendStep - Z; increment between color legend entries
      legendFormat - String; format string for the captions in the color legend
      minValue - Z; minimum value
      maxValue - Z; maximum value
      valueFormat - String; format string used to create status label (under the mouse)
  • Method Details

    • getTimeGranularity

      public double getTimeGranularity()
      Returns the time granularity, just for information.
      Returns:
      double; time granularity
    • getSpaceGranularity

      public double getSpaceGranularity()
      Returns the space granularity, just for information.
      Returns:
      double; space granularity
    • setSpaceGranularity

      public final void setSpaceGranularity(double granularity)
      Sets the correct space granularity radio button to selected. This is done from a DataPool to keep multiple plots consistent.
      Parameters:
      granularity - double; space granularity
    • setTimeGranularity

      public final void setTimeGranularity(double granularity)
      Sets the correct time granularity radio button to selected. This is done from a DataPool to keep multiple plots consistent.
      Parameters:
      granularity - double; time granularity
    • setInterpolation

      public final void setInterpolation(boolean interpolate)
      Sets the check box for interpolated rendering and block renderer setting. This is done from a DataPool to keep multiple plots consistent.
      Parameters:
      interpolate - boolean; selected or not
    • getDataPool

      public final ContourDataSource getDataPool()
      Returns the data pool for sub classes.
      Returns:
      ContourDataSource; data pool for subclasses
    • getItemCount

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

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

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

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

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

      public final Number getZ(int series, int item)
      Specified by:
      getZ in interface org.jfree.data.xy.XYZDataset
    • getSeriesKey

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

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

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

      public final double getZValue(int series, int item)
      Specified by:
      getZValue in interface org.jfree.data.xy.XYZDataset
    • getSeriesCount

      public final int getSeriesCount()
      Specified by:
      getSeriesCount in interface org.jfree.data.general.SeriesDataset
    • getRangeBinCount

      public int getRangeBinCount()
      Returns the number of items in each column.
      Specified by:
      getRangeBinCount in interface XyInterpolatedDataset
      Returns:
      int; number of items in each column
    • getStatusLabel

      public final String getStatusLabel(double domainValue, double rangeValue)
      Returns the status label when the mouse is over the given location.
      Specified by:
      getStatusLabel in class AbstractPlot
      Parameters:
      domainValue - double; domain value (x-axis)
      rangeValue - double; range value (y-axis)
      Returns:
      String; status label when the mouse is over the given location
    • increaseTime

      protected final void increaseTime(org.djunits.value.vdouble.scalar.Time time)
      Increase the simulated time span.
      Specified by:
      increaseTime in class AbstractPlot
      Parameters:
      time - Time; time to increase to
    • getValue

      protected abstract double getValue(int item, double cellLength, double cellSpan)
      Obtain value for cell from the data pool.
      Parameters:
      item - int; item number
      cellLength - double; cell length
      cellSpan - double; cell duration
      Returns:
      double; value for cell from the data pool
    • scale

      protected abstract double scale(double si)
      Scale the value from SI to the desired unit for users.
      Parameters:
      si - double; SI value
      Returns:
      double; scaled value
    • getContourDataType

      protected abstract ContourDataSource.ContourDataType<Z,?> getContourDataType()
      Returns the contour data type for use in a ContourDataSource.
      Returns:
      CountorDataType; contour data type
    • getBlockRenderer

      public XyInterpolatedBlockRenderer getBlockRenderer()
      Returns the block renderer.
      Returns:
      block renderer
    • actionPerformed

      public final void actionPerformed(ActionEvent actionEvent)
      Specified by:
      actionPerformed in interface ActionListener