View Javadoc
1   package org.opentrafficsim.road.network.animation;
2   
3   import java.awt.Color;
4   import java.awt.Graphics2D;
5   import java.awt.image.ImageObserver;
6   import java.io.Serializable;
7   import java.rmi.RemoteException;
8   
9   import javax.naming.NamingException;
10  
11  import org.djunits.unit.LengthUnit;
12  import org.djunits.value.vdouble.scalar.Length;
13  import org.opentrafficsim.core.dsol.OTSSimulatorInterface;
14  import org.opentrafficsim.road.network.lane.object.sensor.SinkSensor;
15  
16  /**
17   * sink sensor animation.
18   * <p>
19   * Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands.<br>
20   * All rights reserved. <br>
21   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
22   * <p>
23   * $LastChangedDate: 2015-08-12 16:37:45 +0200 (Wed, 12 Aug 2015) $, @version $Revision: 1240 $, by $Author: averbraeck $,
24   * initial version Jan 30, 2015 <br>
25   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
26   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
27   */
28  public class SinkAnimation extends AbstractLineAnimation<SinkSensor> implements Serializable
29  {
30      /** */
31      private static final long serialVersionUID = 20150130L;
32  
33      /**
34       * Construct the Sink animation.
35       * @param source the Car to draw
36       * @param simulator the simulator to schedule on
37       * @throws NamingException in case of registration failure of the animation
38       * @throws RemoteException in case of remote registration failure of the animation
39       */
40      public SinkAnimation(final SinkSensor source, final OTSSimulatorInterface simulator) throws NamingException, RemoteException
41      {
42          super(source, simulator, 0.8, new Length(0.5, LengthUnit.SI));
43      }
44  
45      /** {@inheritDoc} */
46      @Override
47      public final void paint(final Graphics2D graphics, final ImageObserver observer) throws RemoteException
48      {
49          graphics.setColor(Color.YELLOW);
50          super.paint(graphics, observer);
51      }
52  
53      /** {@inheritDoc} */
54      @Override
55      public final String toString()
56      {
57          return "SinkAnimation [getSource()=" + this.getSource() + "]";
58      }
59  }