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