public class SwitchableGTUColorer extends Object implements GTUColorer
Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
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 |
|---|---|
Color |
getColor(GTU gtu)
Return the fill color for a GTU.
|
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 - the index of the initially active colorer in the list (0-based).colorers - GTUColorers; 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 - 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 Color getColor(GTU gtu)
getColor in interface GTUColorergtu - GTU; the GTUpublic final List<GTUColorer.LegendEntry> getLegend()
getLegend in interface GTUColorerpublic final List<GTUColorer> getColorers()
Copyright © 2014–2015 Delft University of Technology. All rights reserved.