Class ContourDataSource.Axis

  • Enclosing class:
    ContourDataSource<G extends org.opentrafficsim.kpi.interfaces.GtuDataInterface>

    static class ContourDataSource.Axis
    extends Object
    Class to store and determine axis information such as granularity, ticks, and range.

    Copyright (c) 2013-2022 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 10 okt. 2018
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Summary

      Constructors 
      Constructor Description
      Axis​(double minValue, double maxValue, double granularity, double[] granularities)
      Constructor.
    • Constructor Detail

      • Axis

        Axis​(double minValue,
             double maxValue,
             double granularity,
             double[] granularities)
        Constructor.
        Parameters:
        minValue - double; minimum value
        maxValue - double; maximum value
        granularity - double; initial granularity
        granularities - double[]; possible granularities
    • Method Detail

      • setMaxValue

        void setMaxValue​(double maxValue)
        Sets the maximum value.
        Parameters:
        maxValue - double; maximum value
      • setGranularity

        void setGranularity​(double granularity)
        Sets the granularity.
        Parameters:
        granularity - double; granularity
      • getTicks

        double[] getTicks()
        Returns the ticks, which are calculated if needed.
        Returns:
        double[]; ticks
      • getBinCount

        int getBinCount()
        Calculates the number of bins.
        Returns:
        int; number of bins
      • getBinValue

        double getBinValue​(int bin)
        Calculates the center value of a bin.
        Parameters:
        bin - int; bin number
        Returns:
        double; center value of the bin
      • getValueBin

        int getValueBin​(double value)
        Looks up the bin number of the value.
        Parameters:
        value - double; value
        Returns:
        int; bin number
      • setInterpolate

        void setInterpolate​(boolean interpolate)
        Sets interpolation, important is it required the data to have an additional row or column.
        Parameters:
        interpolate - boolean; interpolation
      • isInterpolate

        public boolean isInterpolate()
        Retrieve the interpolate flag.
        Returns:
        boolean; true if interpolation is on; false if interpolation is off