Class GtuTypeColorer
- java.lang.Object
-
- org.opentrafficsim.road.gtu.colorer.GtuTypeColorer
-
- All Implemented Interfaces:
Serializable,Colorer<Gtu>,GtuColorer
public class GtuTypeColorer extends Object implements GtuColorer, Serializable
Color by GTU type, based on the GTUType id or the enum id from the defaults.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 17 jan. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opentrafficsim.core.animation.gtu.colorer.GtuColorer
GtuColorer.LegendEntry
-
-
Field Summary
Fields Modifier and Type Field Description static GtuTypeColorerDEFAULTDefault instance with colors for common GTUTypes.
-
Constructor Summary
Constructors Constructor Description GtuTypeColorer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GtuTypeColoreradd(GtuType gtuType)Adds a GTU type to the list with color based on the type.GtuTypeColoreradd(GtuType.DEFAULTS gtuTypeEnum)Adds a GTU type to the list with color from the default list.GtuTypeColoreradd(GtuType.DEFAULTS gtuTypeEnum, Color color)Adds a GTU type based on its enum to the list with given color.GtuTypeColoreradd(GtuType gtuType, Color color)Adds a GTU type to the list with given color.ColorgetColor(Gtu gtu)Get the color, based on the Drawable object.List<GtuColorer.LegendEntry>getLegend()Return a list of legend entries (useful to make a legend of the colors used to render the GTUs).StringtoString()
-
-
-
Field Detail
-
DEFAULT
public static final GtuTypeColorer DEFAULT
Default instance with colors for common GTUTypes.
-
-
Method Detail
-
add
public GtuTypeColorer add(GtuType.DEFAULTS gtuTypeEnum)
Adds a GTU type to the list with color from the default list.- Parameters:
gtuTypeEnum- GtuType.DEFAULTS; GTU type- Returns:
- this GTUTypeColorer
-
add
public GtuTypeColorer add(GtuType gtuType)
Adds a GTU type to the list with color based on the type.- Parameters:
gtuType- GtuType; GTU type- Returns:
- this GTUTypeColorer
-
add
public GtuTypeColorer add(GtuType gtuType, Color color)
Adds a GTU type to the list with given color.- Parameters:
gtuType- GtuType; GTU typecolor- Color; color- Returns:
- this GTUTypeColorer
-
add
public GtuTypeColorer add(GtuType.DEFAULTS gtuTypeEnum, Color color)
Adds a GTU type based on its enum to the list with given color.- Parameters:
gtuTypeEnum- GtuType.DEFAULTS; GTU type default enumcolor- Color; color- Returns:
- this GTUTypeColorer
-
getLegend
public List<GtuColorer.LegendEntry> getLegend()
Return a list of legend entries (useful to make a legend of the colors used to render the GTUs).- Specified by:
getLegendin interfaceGtuColorer- Returns:
- List<LegendEntry>; the list of legend entries; the caller should not (try to) modify this List
-
-