1 package org.opentrafficsim.road.network.lane.object;
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 nl.tudelft.simulation.dsol.animation.D2.Renderable2D;
12 import nl.tudelft.simulation.language.d3.DirectedPoint;
13
14 import org.opentrafficsim.core.dsol.OTSSimulatorInterface;
15 import org.opentrafficsim.core.network.animation.PaintPolygons;
16
17
18
19
20
21
22
23
24
25
26
27
28 public class LaneBlockAnimation extends Renderable2D implements Serializable
29 {
30
31 private static final long serialVersionUID = 20160400L;
32
33
34 private Color fillColor;
35
36
37 private static final DirectedPoint POINT_000 = new DirectedPoint();
38
39
40
41
42
43
44
45
46
47 public LaneBlockAnimation(final LaneBlock source, final OTSSimulatorInterface simulator, final Color fillColor)
48 throws NamingException, RemoteException
49 {
50 super(source, simulator);
51 setFillColor(fillColor);
52 setTranslate(false);
53 setRotate(false);
54 }
55
56
57 @Override
58 public final void paint(final Graphics2D graphics, final ImageObserver observer)
59 {
60 graphics.setColor(this.fillColor);
61 PaintPolygons.paintMultiPolygon(graphics, this.fillColor, POINT_000, ((LaneBlock) this.source).getGeometry(),
62 true);
63 }
64
65
66
67
68 public final Color getFillColor()
69 {
70 return this.fillColor;
71 }
72
73
74
75
76 public final void setFillColor(final Color fillColor)
77 {
78 this.fillColor = fillColor;
79 }
80
81
82 @Override
83 public final String toString()
84 {
85 return "CSEBlockAnimation [getSource()=" + this.getSource() + "]";
86 }
87
88 }