Package org.opentrafficsim.draw.graphs
Class ContourDataSource.Axis
java.lang.Object
org.opentrafficsim.draw.graphs.ContourDataSource.Axis
- Enclosing class:
- ContourDataSource
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
ConstructorDescriptionAxis
(double minValue, double maxValue, double granularity, double[] granularities) Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) int
Calculates the number of bins.(package private) double
getBinValue
(int bin) Calculates the center value of a bin.(package private) double[]
getTicks()
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.toString()
-
Constructor Details
-
Axis
Axis(double minValue, double maxValue, double granularity, double[] granularities) Constructor.- Parameters:
minValue
- double; minimum valuemaxValue
- double; maximum valuegranularity
- double; initial granularitygranularities
- 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
-