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