1 package org.opentrafficsim.road.animation;
2
3 import org.opentrafficsim.core.gtu.GTU;
4 import org.opentrafficsim.core.network.OTSLink;
5 import org.opentrafficsim.core.network.OTSNode;
6 import org.opentrafficsim.core.network.animation.LinkAnimation;
7 import org.opentrafficsim.core.network.animation.NodeAnimation;
8 import org.opentrafficsim.road.gtu.animation.DefaultCarAnimation;
9 import org.opentrafficsim.road.network.animation.LaneAnimation;
10 import org.opentrafficsim.road.network.animation.SensorAnimation;
11 import org.opentrafficsim.road.network.animation.TrafficLightAnimation;
12 import org.opentrafficsim.road.network.lane.Lane;
13 import org.opentrafficsim.road.network.lane.Shoulder;
14 import org.opentrafficsim.road.network.lane.Stripe;
15 import org.opentrafficsim.road.network.lane.conflict.Conflict;
16 import org.opentrafficsim.road.network.lane.object.sensor.Sensor;
17 import org.opentrafficsim.road.network.lane.object.sensor.SingleSensor;
18 import org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight;
19 import org.opentrafficsim.simulationengine.AbstractWrappableAnimation;
20
21
22
23
24
25
26
27
28
29
30
31
32
33 public final class AnimationToggles
34 {
35
36
37
38
39 private AnimationToggles()
40 {
41
42 }
43
44
45
46
47
48 public static void setTextAnimationTogglesFull(final AbstractWrappableAnimation aws)
49 {
50 aws.addToggleAnimationButtonText("Node", OTSNode.class, "Show/hide nodes", true);
51 aws.addToggleAnimationButtonText("NodeId", NodeAnimation.Text.class, "Show/hide node Ids", false);
52 aws.addToggleAnimationButtonText("Link", OTSLink.class, "Show/hide links", true);
53 aws.addToggleAnimationButtonText("LinkId", LinkAnimation.Text.class, "Show/hide link Ids", false);
54 aws.addToggleAnimationButtonText("Lane", Lane.class, "Show/hide lanes", true);
55 aws.addToggleAnimationButtonText("LaneId", LaneAnimation.Text.class, "Show/hide lane Ids", false);
56 aws.addToggleAnimationButtonText("Stripe", Stripe.class, "Show/hide stripes", true);
57 aws.addToggleAnimationButtonText("Shoulder", Shoulder.class, "Show/hide shoulders", true);
58 aws.addToggleAnimationButtonText("GTU", GTU.class, "Show/hide GTUs", true);
59 aws.addToggleAnimationButtonText("GTUId", DefaultCarAnimation.Text.class, "Show/hide GTU Ids", false);
60 aws.addToggleAnimationButtonText("Sensor", SingleSensor.class, "Show/hide sensors", true);
61 aws.addToggleAnimationButtonText("SensorId", SensorAnimation.Text.class, "Show/hide sensors Ids", false);
62 aws.addToggleAnimationButtonText("Light", TrafficLight.class, "Show/hide traffic lights", true);
63 aws.addToggleAnimationButtonText("LightId", TrafficLightAnimation.Text.class, "Show/hide sensors Ids", false);
64 aws.addToggleAnimationButtonText("Conflict", Conflict.class, "Show/hide conflicts", true);
65
66 }
67
68
69
70
71
72 public static void setTextAnimationTogglesStandard(final AbstractWrappableAnimation aws)
73 {
74 aws.addToggleAnimationButtonText("Node", OTSNode.class, "Show/hide nodes", false);
75 aws.addToggleAnimationButtonText("NodeId", NodeAnimation.Text.class, "Show/hide node Ids", false);
76 aws.addToggleAnimationButtonText("Link", OTSLink.class, "Show/hide links", false);
77 aws.addToggleAnimationButtonText("LinkId", LinkAnimation.Text.class, "Show/hide link Ids", false);
78 aws.addToggleAnimationButtonText("Lane", Lane.class, "Show/hide lanes", true);
79 aws.addToggleAnimationButtonText("LaneId", LaneAnimation.Text.class, "Show/hide lane Ids", false);
80 aws.addToggleAnimationButtonText("Stripe", Stripe.class, "Show/hide stripes", true);
81 aws.addToggleAnimationButtonText("Shoulder", Shoulder.class, "Show/hide shoulders", true);
82 aws.addToggleAnimationButtonText("GTU", GTU.class, "Show/hide GTUs", true);
83 aws.addToggleAnimationButtonText("GTUId", DefaultCarAnimation.Text.class, "Show/hide GTU Ids", false);
84 aws.addToggleAnimationButtonText("Sensor", Sensor.class, "Show/hide sensors", false);
85 aws.addToggleAnimationButtonText("SensorId", SensorAnimation.Text.class, "Show/hide sensors Ids", false);
86 aws.addToggleAnimationButtonText("Light", TrafficLight.class, "Show/hide traffic lights", true);
87 aws.addToggleAnimationButtonText("LightId", TrafficLightAnimation.Text.class, "Show/hide sensors Ids", false);
88 aws.addToggleAnimationButtonText("Conflict", Conflict.class, "Show/hide conflicts", false);
89
90 }
91
92
93
94
95
96 public static void setIconAnimationTogglesFull(final AbstractWrappableAnimation aws)
97 {
98 aws.addToggleAnimationButtonIcon("Node", OTSNode.class, "/icons/Node24.png", "Show/hide nodes", true, false);
99 aws.addToggleAnimationButtonIcon("NodeId", NodeAnimation.Text.class, "/icons/Id24.png", "Show/hide node Ids", false,
100 true);
101 aws.addToggleAnimationButtonIcon("Link", OTSLink.class, "/icons/Link24.png", "Show/hide links", true, false);
102 aws.addToggleAnimationButtonIcon("LinkId", LinkAnimation.Text.class, "/icons/Id24.png", "Show/hide link Ids", false,
103 true);
104 aws.addToggleAnimationButtonIcon("Lane", Lane.class, "/icons/Lane24.png", "Show/hide lanes", true, false);
105 aws.addToggleAnimationButtonIcon("LaneId", LaneAnimation.Text.class, "/icons/Id24.png", "Show/hide lane Ids", false,
106 true);
107 aws.addToggleAnimationButtonIcon("Stripe", Stripe.class, "/icons/Stripe24.png", "Show/hide stripes", true, false);
108 aws.addToggleAnimationButtonText("Shoulder", Shoulder.class, "Show/hide shoulders", true);
109 aws.addToggleAnimationButtonText("GTU", GTU.class, "Show/hide GTUs", true);
110 aws.addToggleAnimationButtonIcon("GTUId", DefaultCarAnimation.Text.class, "/icons/Id24.png", "Show/hide GTU Ids", false,
111 true);
112 aws.addToggleAnimationButtonIcon("Sensor", Sensor.class, "/icons/Sensor24.png", "Show/hide sensors", true, false);
113 aws.addToggleAnimationButtonIcon("SensorId", SensorAnimation.Text.class, "/icons/Id24.png", "Show/hide sensors Ids",
114 false, true);
115 aws.addToggleAnimationButtonIcon("Light", TrafficLight.class, "/icons/TrafficLight24.png", "Show/hide traffic lights",
116 true, false);
117 aws.addToggleAnimationButtonIcon("LightId", TrafficLightAnimation.Text.class, "/icons/Id24.png",
118 "Show/hide sensors Ids", false, true);
119 aws.addToggleAnimationButtonText("Conflict", Conflict.class, "Show/hide conflicts", true);
120
121 }
122
123
124
125
126
127 public static void setIconAnimationTogglesStandard(final AbstractWrappableAnimation aws)
128 {
129 aws.addToggleAnimationButtonIcon("Node", OTSNode.class, "/icons/Node24.png", "Show/hide nodes", false, false);
130 aws.addToggleAnimationButtonIcon("NodeId", NodeAnimation.Text.class, "/icons/Id24.png", "Show/hide node Ids", false,
131 true);
132 aws.addToggleAnimationButtonIcon("Link", OTSLink.class, "/icons/Link24.png", "Show/hide links", false, false);
133 aws.addToggleAnimationButtonIcon("LinkId", LinkAnimation.Text.class, "/icons/Id24.png", "Show/hide link Ids", false,
134 true);
135 aws.addToggleAnimationButtonIcon("Lane", Lane.class, "/icons/Lane24.png", "Show/hide lanes", true, false);
136 aws.addToggleAnimationButtonIcon("LaneId", LaneAnimation.Text.class, "/icons/Id24.png", "Show/hide lane Ids", false,
137 true);
138 aws.addToggleAnimationButtonIcon("Stripe", Stripe.class, "/icons/Stripe24.png", "Show/hide stripes", true, false);
139 aws.addToggleAnimationButtonIcon("Shoulder", Shoulder.class, "/icons/Shoulder24.png", "Show/hide shoulders", true,
140 false);
141 aws.addToggleAnimationButtonText("GTU", GTU.class, "Show/hide GTUs", true);
142 aws.addToggleAnimationButtonIcon("GTUId", DefaultCarAnimation.Text.class, "/icons/Id24.png", "Show/hide GTU Ids", false,
143 true);
144 aws.addToggleAnimationButtonIcon("Sensor", Sensor.class, "/icons/Sensor24.png", "Show/hide sensors", false, false);
145 aws.addToggleAnimationButtonIcon("SensorId", SensorAnimation.Text.class, "/icons/Id24.png", "Show/hide sensors Ids",
146 false, true);
147 aws.addToggleAnimationButtonIcon("Light", TrafficLight.class, "/icons/TrafficLight24.png", "Show/hide traffic lights",
148 true, false);
149 aws.addToggleAnimationButtonIcon("LightId", TrafficLightAnimation.Text.class, "/icons/Id24.png",
150 "Show/hide sensors Ids", false, true);
151 aws.addToggleAnimationButtonText("Conflict", Conflict.class, "Show/hide conflicts", false);
152
153 }
154
155
156
157
158
159 public static void showAnimationFull(final AbstractWrappableAnimation aws)
160 {
161 aws.showAnimationClass(OTSNode.class);
162 aws.hideAnimationClass(NodeAnimation.Text.class);
163 aws.showAnimationClass(OTSLink.class);
164 aws.hideAnimationClass(LinkAnimation.Text.class);
165 aws.showAnimationClass(Lane.class);
166 aws.hideAnimationClass(LaneAnimation.Text.class);
167 aws.showAnimationClass(Stripe.class);
168 aws.showAnimationClass(Shoulder.class);
169 aws.showAnimationClass(GTU.class);
170 aws.hideAnimationClass(DefaultCarAnimation.Text.class);
171 aws.showAnimationClass(SingleSensor.class);
172 aws.hideAnimationClass(SensorAnimation.Text.class);
173 aws.showAnimationClass(TrafficLight.class);
174 aws.hideAnimationClass(TrafficLightAnimation.Text.class);
175 aws.showAnimationClass(Conflict.class);
176
177 }
178
179
180
181
182
183 public static void showAnimationStandard(final AbstractWrappableAnimation aws)
184 {
185 aws.hideAnimationClass(OTSNode.class);
186 aws.hideAnimationClass(NodeAnimation.Text.class);
187 aws.hideAnimationClass(OTSLink.class);
188 aws.hideAnimationClass(LinkAnimation.Text.class);
189 aws.showAnimationClass(Lane.class);
190 aws.hideAnimationClass(LaneAnimation.Text.class);
191 aws.showAnimationClass(Stripe.class);
192 aws.showAnimationClass(Shoulder.class);
193 aws.showAnimationClass(GTU.class);
194 aws.hideAnimationClass(DefaultCarAnimation.Text.class);
195 aws.hideAnimationClass(SingleSensor.class);
196 aws.hideAnimationClass(SensorAnimation.Text.class);
197 aws.showAnimationClass(TrafficLight.class);
198 aws.hideAnimationClass(TrafficLightAnimation.Text.class);
199 aws.hideAnimationClass(Conflict.class);
200
201 }
202
203 }