Package org.opentrafficsim.draw
Class BoundsPaintScale
java.lang.Object
org.opentrafficsim.draw.BoundsPaintScale
- All Implemented Interfaces:
Serializable
,org.jfree.chart.renderer.PaintScale
,ColorPaintScale
Paint scale interpolating between colors at values.
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
- See Also:
-
Field Details
-
GREEN_RED
3-color scale from green to red. -
GREEN_RED_DARK
5-color scale from green to red with dark edges.
-
-
Constructor Details
-
BoundsPaintScale
Constructor.- Parameters:
bounds
- double[]; value boundsboundColors
- Color[]; colors at bounds- Throws:
IllegalArgumentException
- if less than 2 bounds, unequal number of bounds and colors, or duplicate bounds
-
-
Method Details
-
reverse
Reverses the color array.- Parameters:
colors
- Color[]; array of colors- Returns:
- Color[]; reversed color array
-
hue
Creates an array ofn
colors with varying hue.- Parameters:
n
- int; number of colors.- Returns:
- Color[]; array of
n
colors with varying hue
-
getPaint
- Specified by:
getPaint
in interfaceColorPaintScale
- Specified by:
getPaint
in interfaceorg.jfree.chart.renderer.PaintScale
-
getLowerBound
public final double getLowerBound()- Specified by:
getLowerBound
in interfaceorg.jfree.chart.renderer.PaintScale
-
getUpperBound
public final double getUpperBound()- Specified by:
getUpperBound
in interfaceorg.jfree.chart.renderer.PaintScale
-
toString
-