DefaultSwitchableGTUColorer.java

  1. package org.opentrafficsim.road.gtu.animation;

  2. import org.djunits.unit.SpeedUnit;
  3. import org.djunits.value.vdouble.scalar.Acceleration;
  4. import org.djunits.value.vdouble.scalar.Speed;
  5. import org.opentrafficsim.core.gtu.animation.AccelerationGTUColorer;
  6. import org.opentrafficsim.core.gtu.animation.GTUColorer;
  7. import org.opentrafficsim.core.gtu.animation.IDGTUColorer;
  8. import org.opentrafficsim.core.gtu.animation.SpeedGTUColorer;
  9. import org.opentrafficsim.core.gtu.animation.SwitchableGTUColorer;

  10. /**
  11.  * A simple way to construct a SwitchableGTUColorer set up with the "standard" set of GTUColorers. <br>
  12.  * Do not assume that the set of GTUColorers in the result will never change.
  13.  * <p>
  14.  * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  15.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  16.  * <p>
  17.  * @version $Revision: 1378 $, $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $,
  18.  *          initial version Jun 18, 2015 <br>
  19.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  20.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  21.  */
  22. // TODO same class name as in core, w\o additional functionality, while the core one is used in AbstractWrappableAnimation
  23. public class DefaultSwitchableGTUColorer extends SwitchableGTUColorer
  24. {
  25.     /** */
  26.     private static final long serialVersionUID = 20150000L;
  27.    
  28.     /** The initial set of GTU colorers in the default list. */
  29.     private static final GTUColorer[] COLORERS;

  30.     static
  31.     {
  32.         COLORERS = new GTUColorer[3];
  33.         COLORERS[0] = new IDGTUColorer();
  34.         COLORERS[1] = new SpeedGTUColorer(new Speed(150, SpeedUnit.KM_PER_HOUR));
  35.         COLORERS[2] = new AccelerationGTUColorer(Acceleration.createSI(-6.0), Acceleration.createSI(2));
  36.     }

  37.     /**
  38.      * create a default list of GTU colorers.
  39.      */
  40.     public DefaultSwitchableGTUColorer()
  41.     {
  42.         super(0, DefaultSwitchableGTUColorer.COLORERS);
  43.     }

  44. }