Class DesiredHeadwayColorer

  • All Implemented Interfaces:
    java.io.Serializable, Colorer<GTU>, GTUColorer

    public class DesiredHeadwayColorer
    extends java.lang.Object
    implements GTUColorer, java.io.Serializable
    Color on a scale from Tmin to Tmax parameters, or two given limits.

    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 20 apr. 2017
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Duration tMax
      Maximum value on input scale.
      Duration tMin
      Minimum value on input scale.
      protected static java.awt.Color UNKNOWN
      Unknown color.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Color getColor​(GTU gtu)
      Get the color, based on the Drawable object.
      java.util.List<GTUColorer.LegendEntry> getLegend()
      Return a list of legend entries (useful to make a legend of the colors used to render the GTUs).
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • tMin

        public final Duration tMin
        Minimum value on input scale.
      • tMax

        public final Duration tMax
        Maximum value on input scale.
      • UNKNOWN

        protected static final java.awt.Color UNKNOWN
        Unknown color.
    • Constructor Detail

      • DesiredHeadwayColorer

        public DesiredHeadwayColorer()
        Constructor using Tmin and Tmax parameters.
      • DesiredHeadwayColorer

        public DesiredHeadwayColorer​(Duration tMin,
                                     Duration tMax)
        Constructor using input Tmin and Tmax.
        Parameters:
        tMin - Duration; minimum headway
        tMax - Duration; maximum headway
    • Method Detail

      • getColor

        public final java.awt.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 java.util.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object