Class FixedColorer<D extends org.opentrafficsim.core.animation.Drawable>

java.lang.Object
org.opentrafficsim.animation.FixedColorer<D>
Type Parameters:
D - the Drawable type
All Implemented Interfaces:
Colorer<D>

public class FixedColorer<D extends org.opentrafficsim.core.animation.Drawable> extends Object implements Colorer<D>
FixedColorer stores a fixed color for drawing.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck
  • Constructor Details

    • FixedColorer

      protected FixedColorer(Color color)
      Initialize the FixedColorer with a color.
      Parameters:
      color - Color; the fixed color to use
  • Method Details

    • getColor

      public Color getColor(D drawable)
      Get the color, based on the Drawable object.
      Specified by:
      getColor in interface Colorer<D extends org.opentrafficsim.core.animation.Drawable>
      Parameters:
      drawable - D; the object to determine the color for
      Returns:
      the (fill, line) color of the drawable object
    • create

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> create(Color color)
      Instantiate a singleton fixed colorer for a certain color.
      Type Parameters:
      D - the Drawable type
      Parameters:
      color - Color; the fixed color to use
      Returns:
      the FixedColorer
    • black

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> black()
      Type Parameters:
      D - the Drawable type
      Returns:
      black color
    • blue

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> blue()
      Type Parameters:
      D - the Drawable type
      Returns:
      blue color
    • cyan

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> cyan()
      Type Parameters:
      D - the Drawable type
      Returns:
      cyan color
    • darkGray

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> darkGray()
      Type Parameters:
      D - the Drawable type
      Returns:
      darkGray color
    • gray

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> gray()
      Type Parameters:
      D - the Drawable type
      Returns:
      gray color
    • green

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> green()
      Type Parameters:
      D - the Drawable type
      Returns:
      green color
    • lightGray

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> lightGray()
      Type Parameters:
      D - the Drawable type
      Returns:
      lightGray color
    • magenta

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> magenta()
      Type Parameters:
      D - the Drawable type
      Returns:
      magenta color
    • orange

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> orange()
      Type Parameters:
      D - the Drawable type
      Returns:
      orange color
    • pink

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> pink()
      Type Parameters:
      D - the Drawable type
      Returns:
      pink color
    • red

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> red()
      Type Parameters:
      D - the Drawable type
      Returns:
      red color
    • white

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> white()
      Type Parameters:
      D - the Drawable type
      Returns:
      white color
    • yellow

      public static <D extends org.opentrafficsim.core.animation.Drawable> FixedColorer<D> yellow()
      Type Parameters:
      D - the Drawable type
      Returns:
      yellow color