Class DesiredSpeedColorer

java.lang.Object
org.opentrafficsim.road.gtu.colorer.DesiredSpeedColorer
All Implemented Interfaces:
Serializable, Colorer<GTU>, GTUColorer

public class DesiredSpeedColorer
extends Object
implements GTUColorer, Serializable

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 3 mrt. 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
See Also:
Serialized Form
  • Constructor Details

    • DesiredSpeedColorer

      public DesiredSpeedColorer​(Speed minimumSpeed, Speed maximumSpeed)
      Construct a new SpeedGTUColorer.
      Parameters:
      minimumSpeed - Speed; the speed at (and below) which the returned color will be red
      maximumSpeed - Speed; the speed at (and above) which the returned color will be green
  • Method Details

    • getColor

      public final Color getColor​(GTU gtu)
      Get the color, based on the Drawable object.
      Specified by:
      getColor in interface Colorer<GTU>
      Parameters:
      gtu - D; the object to determine the color for
      Returns:
      the (fill, line) color of the drawable object
    • getLegend

      public final 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:
      getLegend in interface GTUColorer
      Returns:
      List<LegendEntry>; the list of legend entries; the caller should not (try to) modify this List
    • toString

      public final String toString()
      Overrides:
      toString in class Object