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.core.dsol.OtsSimulatorInterface;
14  import org.opentrafficsim.road.network.lane.object.detector.SinkDetector;
15  
16  /**
17   * sink sensor animation.
18   * <p>
19   * Copyright (c) 2013-2023 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="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
22   * </p>
23   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
24   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
25   */
26  public class SinkAnimation extends AbstractLineAnimation<SinkDetector> implements Serializable
27  {
28      /** */
29      private static final long serialVersionUID = 20150130L;
30  
31      /**
32       * Construct the Sink animation.
33       * @param source SinkSensor; the Car to draw
34       * @param simulator OtsSimulatorInterface; the simulator to schedule on
35       * @throws NamingException in case of registration failure of the animation
36       * @throws RemoteException in case of remote registration failure of the animation
37       */
38      public SinkAnimation(final SinkDetector source, final OtsSimulatorInterface simulator) throws NamingException, RemoteException
39      {
40          super(source, simulator, 0.8, new Length(0.5, LengthUnit.SI));
41      }
42  
43      /** {@inheritDoc} */
44      @Override
45      public final void paint(final Graphics2D graphics, final ImageObserver observer)
46      {
47          graphics.setColor(Color.YELLOW);
48          super.paint(graphics, observer);
49      }
50  
51      /** {@inheritDoc} */
52      @Override
53      public final String toString()
54      {
55          return "SinkAnimation [getSource()=" + this.getSource() + "]";
56      }
57  }