Class AbstractContourPlot<Z extends java.lang.Number>

Type Parameters:
Z - z-value type
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, Dataset, SeriesDataset, XYDataset, XYZDataset, Identifiable
Direct Known Subclasses:
ContourPlotAcceleration, ContourPlotDelay, ContourPlotDensity, ContourPlotFlow, ContourPlotSpeed

public abstract class AbstractContourPlot<Z extends java.lang.Number>
extends AbstractSamplerPlot
implements java.awt.event.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-2019 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 4 okt. 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • AbstractContourPlot

      public AbstractContourPlot​(java.lang.String caption, OTSSimulatorInterface simulator, ContourDataSource<?> dataPool, BoundsPaintScale paintScale, Z legendStep, java.lang.String legendFormat, java.lang.String valueFormat)
      Constructor with specified paint scale.
      Parameters:
      caption - String; caption
      simulator - OTSSimulatorInterface; simulator
      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​(java.lang.String caption, OTSSimulatorInterface simulator, ContourDataSource<?> dataPool, Z legendStep, java.lang.String legendFormat, Z minValue, Z maxValue, java.lang.String valueFormat)
      Constructor with default paint scale.
      Parameters:
      caption - String; caption
      simulator - OTSSimulatorInterface; simulator
      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 XYDataset
    • getX

      public final java.lang.Number getX​(int series, int item)
      Specified by:
      getX in interface XYDataset
    • getXValue

      public final double getXValue​(int series, int item)
      Specified by:
      getXValue in interface XYDataset
    • getY

      public final java.lang.Number getY​(int series, int item)
      Specified by:
      getY in interface XYDataset
    • getYValue

      public final double getYValue​(int series, int item)
      Specified by:
      getYValue in interface XYDataset
    • getZ

      public final java.lang.Number getZ​(int series, int item)
      Specified by:
      getZ in interface XYZDataset
    • getSeriesKey

      public final java.lang.Comparable<java.lang.String> getSeriesKey​(int series)
      Specified by:
      getSeriesKey in interface SeriesDataset
    • indexOf

      public final int indexOf​(java.lang.Comparable seriesKey)
      Specified by:
      indexOf in interface SeriesDataset
    • getDomainOrder

      public final DomainOrder getDomainOrder()
      Specified by:
      getDomainOrder in interface XYDataset
    • getZValue

      public final double getZValue​(int series, int item)
      Specified by:
      getZValue in interface XYZDataset
    • getSeriesCount

      public final int getSeriesCount()
      Specified by:
      getSeriesCount in interface SeriesDataset
    • getRangeBinCount

      public int getRangeBinCount()
    • getStatusLabel

      public final java.lang.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​(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()
    • actionPerformed

      public final void actionPerformed​(java.awt.event.ActionEvent actionEvent)
      Specified by:
      actionPerformed in interface java.awt.event.ActionListener