View Javadoc
1   package org.opentrafficsim.road.gtu.animation;
2   
3   import org.djunits.unit.SpeedUnit;
4   import org.djunits.value.vdouble.scalar.Acceleration;
5   import org.djunits.value.vdouble.scalar.Speed;
6   import org.opentrafficsim.core.gtu.animation.AccelerationGTUColorer;
7   import org.opentrafficsim.core.gtu.animation.GTUColorer;
8   import org.opentrafficsim.core.gtu.animation.IDGTUColorer;
9   import org.opentrafficsim.core.gtu.animation.SpeedGTUColorer;
10  import org.opentrafficsim.core.gtu.animation.SwitchableGTUColorer;
11  
12  /**
13   * A simple way to construct a SwitchableGTUColorer set up with the "standard" set of GTUColorers. <br>
14   * Do not assume that the set of GTUColorers in the result will never change.
15   * <p>
16   * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
17   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
18   * <p>
19   * @version $Revision: 1378 $, $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $,
20   *          initial version Jun 18, 2015 <br>
21   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
22   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
23   */
24  // TODO same class name as in core, w\o additional functionality, while the core one is used in AbstractWrappableAnimation
25  public class DefaultSwitchableGTUColorer extends SwitchableGTUColorer
26  {
27      /** */
28      private static final long serialVersionUID = 20150000L;
29      
30      /** The initial set of GTU colorers in the default list. */
31      private static final GTUColorer[] COLORERS;
32  
33      static
34      {
35          COLORERS = new GTUColorer[3];
36          COLORERS[0] = new IDGTUColorer();
37          COLORERS[1] = new SpeedGTUColorer(new Speed(150, SpeedUnit.KM_PER_HOUR));
38          COLORERS[2] = new AccelerationGTUColorer(Acceleration.createSI(-6.0), Acceleration.createSI(2));
39      }
40  
41      /**
42       * create a default list of GTU colorers.
43       */
44      public DefaultSwitchableGTUColorer()
45      {
46          super(0, DefaultSwitchableGTUColorer.COLORERS);
47      }
48  
49  }