1 package org.opentrafficsim.animation.data;
2
3 import java.awt.Color;
4
5 import org.opentrafficsim.draw.road.TrafficLightAnimation.TrafficLightData;
6 import org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight;
7
8
9
10
11
12
13
14
15
16
17 public class AnimationTrafficLightData extends AnimationLaneBasedObjectData<TrafficLight> implements TrafficLightData
18 {
19
20
21
22
23
24 public AnimationTrafficLightData(final TrafficLight trafficLight)
25 {
26 super(trafficLight);
27 }
28
29
30 @Override
31 public Color getColor()
32 {
33 switch (getObject().getTrafficLightColor())
34 {
35 case RED:
36 {
37 return Color.RED;
38 }
39 case GREEN:
40 case PREGREEN:
41 {
42 return Color.GREEN;
43 }
44 case YELLOW:
45 {
46 return Color.YELLOW;
47 }
48 default:
49 {
50 return Color.BLACK;
51 }
52 }
53 }
54
55
56 @Override
57 public String toString()
58 {
59 return "Traffic light " + getObject().getFullId();
60 }
61
62 }