public class BoundsPaintScale extends Object implements ColorPaintScale, Serializable
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Field and Description |
---|---|
static Color[] |
GREEN_RED
3-color scale from green to red.
|
static Color[] |
GREEN_RED_DARK
5-color scale from green to red with dark edges.
|
Constructor and Description |
---|
BoundsPaintScale(double[] bounds,
Color[] boundColors)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
getLowerBound() |
Color |
getPaint(double value) |
double |
getUpperBound() |
static Color[] |
hue(int n)
Creates an array of
n colors with varying hue. |
static Color[] |
reverse(Color[] colors)
Reverses the color array.
|
String |
toString() |
public static final Color[] GREEN_RED
public static final Color[] GREEN_RED_DARK
public BoundsPaintScale(double[] bounds, Color[] boundColors) throws IllegalArgumentException
bounds
- double[]; value boundsboundColors
- Color[]; colors at boundsIllegalArgumentException
- if less than 2 bounds, unequal number of bounds and colors, or duplicate boundspublic static Color[] reverse(Color[] colors)
colors
- Color[]; array of colorspublic static Color[] hue(int n)
n
colors with varying hue.n
- int; number of colors.n
colors with varying huepublic Color getPaint(double value)
getPaint
in interface PaintScale
getPaint
in interface ColorPaintScale
public final double getLowerBound()
getLowerBound
in interface PaintScale
public final double getUpperBound()
getUpperBound
in interface PaintScale
Copyright © 2014–2019 Delft University of Technology. All rights reserved.