Class AbstractContourPlot<Z extends Number>

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

public abstract class AbstractContourPlot<Z extends Number> extends AbstractSpaceTimePlot<AbstractContourPlot.ContourPaintState>
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 source. Sub-classes only need to specify a few plot specific variables and functionalities.

Copyright (c) 2013-2026 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

  • Method Details

    • emptyPaintState

      protected AbstractContourPlot.ContourPaintState emptyPaintState()
      Description copied from class: AbstractPlot
      Returns an empty paint state. This is used at plot initialization.
      Specified by:
      emptyPaintState in class AbstractPlot<AbstractContourPlot.ContourPaintState>
      Returns:
      empty paint state.
    • getContourDataType

      protected ContourDataSource.ContourDataType<Z> getContourDataType()
      Returns the contour data type for use in a ContourDataSource.
      Returns:
      contour data type
    • scale

      protected abstract double scale(double si)
      Scale the z-value from SI to the desired unit for users, in line with unit in AbstractContourPlot.LabelData.labelFormat.
      Parameters:
      si - SI value
      Returns:
      scaled value
    • setPaintState

      protected void setPaintState()
      Description copied from class: AbstractPlot
      Sets the paint state in a thread safe manner and notifies the listeners. This method is always invoked on the Swing EDT. This method may be overridden to use a newly set paint state (after calling super.setPaintState()) to set internal properties. For example, setting the block size of an internal block renderer based on the granularity of the data.
      Overrides:
      setPaintState in class AbstractSpaceTimePlot<AbstractContourPlot.ContourPaintState>
    • getStatusLabel

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

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

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

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

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

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

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

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

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

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

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

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

      public int getRangeBinCount()
    • addListener

      public void addListener(EventListener listener, EventType eventType)
      Add listener to synchronize UI element when another UI element changes a setting, or the setting is changed programmatically.
      Parameters:
      listener - listener
      eventType - event type (i.e. ContourDataSource.GRANULARITY, ContourDataSource.INTERPOLATE or ContourDataSource.SMOOTH)
    • getGranularities

      public double[] getGranularities(ContourDataSource.Dimension dimension)
      Returns the available granularities that a linked plot may use.
      Parameters:
      dimension - space or time
      Returns:
      available granularities that a linked plot may use
    • getGranularity

      public double getGranularity(ContourDataSource.Dimension dimension)
      Returns the selected granularity that a linked plot should use.
      Parameters:
      dimension - space or time
      Returns:
      granularity that a linked plot should use
    • setGranularity

      public void setGranularity(ContourDataSource.Dimension dimension, double granularity)
      Sets the granularity of the plot. This will invalidate the plot triggering a redraw.
      Parameters:
      dimension - space or time
      granularity - granularity in space or time (SI unit)
    • setInterpolate

      public void setInterpolate(boolean interpolate)
      Sets bi-linear interpolation enabled or disabled. This will invalidate the plot triggering a redraw.
      Parameters:
      interpolate - whether to enable interpolation
    • setSmooth

      public void setSmooth(boolean smooth)
      Sets the adaptive smoothing enabled or disabled. This will invalidate the plot triggering a redraw.
      Parameters:
      smooth - whether to smooth the plot
    • calculatePaintState

      protected void calculatePaintState(org.djunits.value.vdouble.scalar.Duration time)
      Description copied from class: AbstractPlot
      Calculates the paint state object and offers it through AbstractPlot.offerPaintState(S), or delegates this work to a delegate. This method is invoked by the worker thread and can thus perform heavy calculations outside of the Swing EDT. Intermediate paint states during long calculations may also be offered. It is up to the implementation to either calculate a complete paint state, or cumulatively built on the results from previous calls. It is also up to the implementation to know when the whole time span needs to be recalculated due to property changes.
      Specified by:
      calculatePaintState in class AbstractPlot<AbstractContourPlot.ContourPaintState>
      Parameters:
      time - time until which data in the paint state should be calculated
    • getEndLocation

      protected org.djunits.value.vdouble.scalar.Length getEndLocation()
      Description copied from class: AbstractSpaceTimePlot
      Returns the total space.
      Specified by:
      getEndLocation in class AbstractSpaceTimePlot<AbstractContourPlot.ContourPaintState>
      Returns:
      total space