Class ContourDataSource.Axis

java.lang.Object
org.opentrafficsim.draw.graphs.ContourDataSource.Axis
Enclosing class:
ContourDataSource

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

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 Summary

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

    Modifier and Type
    Method
    Description
    (package private) int
    Calculates the number of bins.
    (package private) double
    getBinValue(int bin)
    Calculates the center value of a bin.
    (package private) double[]
    Returns the ticks, which are calculated if needed.
    (package private) int
    getValueBin(double value)
    Looks up the bin number of the value.
    boolean
    Retrieve the interpolate flag.
    (package private) void
    setGranularity(double granularity)
    Sets the granularity.
    (package private) void
    setInterpolate(boolean interpolate)
    Sets interpolation, important is it required the data to have an additional row or column.
    (package private) void
    setMaxValue(double maxValue)
    Sets the maximum value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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 Details

    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object