Class FundamentalDiagram

All Implemented Interfaces:
Identifiable, org.jfree.data.general.Dataset, org.jfree.data.general.SeriesDataset, org.jfree.data.xy.XYDataset

public class FundamentalDiagram extends AbstractBoundedPlot<FundamentalDiagram.FdPaintState> implements org.jfree.data.xy.XYDataset
Fundamental diagram from various sources.

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

    • getPossibleUpdatesPerPeriod

      public ImmutableList<Integer> getPossibleUpdatesPerPeriod()
      Returns the possible updates per period values.
      Returns:
      possible update per period values
    • getDefaultUpdatesPerPeriod

      public int getDefaultUpdatesPerPeriod()
      Returns the default updates per period.
      Returns:
      default updates per period
    • getPossibleAggregationPeriods

      public ImmutableList<org.djunits.value.vdouble.scalar.Duration> getPossibleAggregationPeriods()
      Returns the possible aggregation period values.
      Returns:
      possible aggregation period values
    • getDefaultAggregationPeriod

      public org.djunits.value.vdouble.scalar.Duration getDefaultAggregationPeriod()
      Returns the default aggregation period.
      Returns:
      default aggregation period
    • 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. UPDATES_PER_PERIOD or AGGREGATION_PERIOD)
    • getNumberOfSeries

      public int getNumberOfSeries()
      Returns the number of series.
      Returns:
      number of series
    • getUpdateInterval

      public org.djunits.value.vdouble.scalar.Duration getUpdateInterval()
      Returns the update interval.
      Returns:
      update interval
    • setUpdatesPerPeriod

      public void setUpdatesPerPeriod(int n)
      Sets the number of updates per period.
      Parameters:
      n - number of updates per period
    • setAggregationPeriod

      public void setAggregationPeriod(org.djunits.value.vdouble.scalar.Duration period)
      Sets the aggregation period.
      Parameters:
      period - aggregation period
    • emptyPaintState

      protected FundamentalDiagram.FdPaintState emptyPaintState()
      Description copied from class: AbstractPlot
      Returns an empty paint state. This is used at plot initialization.
      Specified by:
      emptyPaintState in class AbstractPlot<FundamentalDiagram.FdPaintState>
      Returns:
      empty paint state.
    • 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<FundamentalDiagram.FdPaintState>
      Parameters:
      time - time until which data in the paint state should be calculated
    • 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 AbstractPlot<FundamentalDiagram.FdPaintState>
    • getSeriesCount

      public int getSeriesCount()
      Specified by:
      getSeriesCount in interface org.jfree.data.general.SeriesDataset
    • 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
    • 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
    • getGraphType

      public GraphType getGraphType()
      Description copied from class: AbstractPlot
      Return the graph type for transceiver.
      Specified by:
      getGraphType in class AbstractPlot<FundamentalDiagram.FdPaintState>
      Returns:
      the graph type.
    • getStatusLabel

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

      public org.jfree.chart.LegendItemCollection getLegend()
      Retrieve the legend of this FundamentalDiagram.
      Returns:
      the legend
    • getLaneVisible

      public List<Boolean> getLaneVisible()
      Return the list of lane visibility flags.
      Returns:
      the list of lane visibility flags
    • getDomainQuantity

      public FundamentalDiagram.Quantity getDomainQuantity()
      Return the domain quantity.
      Returns:
      the domain quantity
    • setDomainQuantity

      public void setDomainQuantity(FundamentalDiagram.Quantity domainQuantity)
      Set the domain quantity.
      Parameters:
      domainQuantity - the new domain quantity
    • getOtherQuantity

      public FundamentalDiagram.Quantity getOtherQuantity()
      Get the other (non domain; vertical axis) quantity.
      Returns:
      the quantity for the vertical axis
    • setOtherQuantity

      public void setOtherQuantity(FundamentalDiagram.Quantity otherQuantity)
      Set the other (non domain; vertical axis) quantity.
      Parameters:
      otherQuantity - the quantity for the vertical axis
    • getRangeQuantity

      public FundamentalDiagram.Quantity getRangeQuantity()
      Get the range quantity.
      Returns:
      the range quantity
    • setRangeQuantity

      public void setRangeQuantity(FundamentalDiagram.Quantity rangeQuantity)
      Set the range quantity.
      Parameters:
      rangeQuantity - the new range quantity
    • getTimeInfo

      public String getTimeInfo()
      Retrieve the time info.
      Returns:
      the time info
    • setTimeInfo

      public void setTimeInfo(String timeInfo)
      Set the time info.
      Parameters:
      timeInfo - the new time info
    • hasLineFD

      public boolean hasLineFD()
      Return whether the plot has a fundamental diagram line.
      Returns:
      whether the plot has a fundamental diagram line
    • toString

      public String toString()
      Overrides:
      toString in class Object