1 package org.opentrafficsim.road.network.lane;
2
3 import java.awt.Color;
4 import java.awt.Graphics2D;
5 import java.awt.geom.Rectangle2D;
6 import java.awt.image.ImageObserver;
7 import java.rmi.RemoteException;
8
9 import javax.naming.NamingException;
10
11 import nl.tudelft.simulation.dsol.animation.D2.Renderable2D;
12
13 import org.opentrafficsim.core.dsol.OTSSimulatorInterface;
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public class SinkAnimation extends Renderable2D
28 {
29
30 private final double halfWidth;
31
32
33
34
35
36
37
38
39 public SinkAnimation(final SinkSensor source, final OTSSimulatorInterface simulator) throws NamingException,
40 RemoteException
41 {
42 super(source, simulator);
43 this.halfWidth = 0.4 * source.getLane().getWidth(0.0).getSI();
44 }
45
46
47 @Override
48 public final void paint(final Graphics2D graphics, final ImageObserver observer)
49 {
50 graphics.setColor(Color.YELLOW);
51 Rectangle2D rectangle = new Rectangle2D.Double(-0.25, -this.halfWidth, 0.5, 2 * this.halfWidth);
52 graphics.fill(rectangle);
53 }
54
55
56 @Override
57 public final String toString()
58 {
59 return "SinkAnimation [getSource()=" + this.getSource() + "]";
60 }
61 }