public class SwitchableGTUColorer extends Object implements GTUColorer, 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 | Class and Description |
|---|---|
static class |
SwitchableGTUColorer.Builder
Builder for SwitchableGTUColorer.
|
GTUColorer.LegendEntry| Constructor and Description |
|---|
SwitchableGTUColorer(int activeIndex,
GTUColorer... colorers)
Construct a new Switchable GTUColorer based on a list of colorers.
|
| Modifier and Type | Method and Description |
|---|---|
static SwitchableGTUColorer.Builder |
builder()
Returns a builder for SwitchableGTUColorer.
|
Color |
getColor(GTU gtu)
Get the color, based on the Drawable object.
|
List<GTUColorer> |
getColorers() |
List<GTUColorer.LegendEntry> |
getLegend()
Return a list of legend entries (useful to make a legend of the colors used to render the GTUs).
|
void |
setGTUColorer(int activeIndex)
Replace the currently active GTUColorer.
|
String |
toString() |
public SwitchableGTUColorer(int activeIndex,
GTUColorer... colorers)
throws IndexOutOfBoundsException
activeIndex - int; the index of the initially active colorer in the list (0-based).colorers - GTUColorer...; the list of GTUColorer. List cannot be empty.IndexOutOfBoundsException - when activeIndex < 0 or larger than or equal to the number of colorers.public final void setGTUColorer(int activeIndex)
throws IndexOutOfBoundsException
activeIndex - int; the index of the new active colorer in the list (0-based).IndexOutOfBoundsException - when activeIndex < 0 or larger than or equal to the number of colorers.public final List<GTUColorer.LegendEntry> getLegend()
getLegend in interface GTUColorerpublic final List<GTUColorer> getColorers()
public static final SwitchableGTUColorer.Builder builder()
Copyright © 2014–2019 Delft University of Technology. All rights reserved.