1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3
4 import java.util.*;import javax.vecmath.*;import cz.cuni.amis.pogamut.base.communication.messages.*;import cz.cuni.amis.pogamut.base.communication.worldview.*;import cz.cuni.amis.pogamut.base.communication.worldview.event.*;import cz.cuni.amis.pogamut.base.communication.worldview.object.*;import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;import cz.cuni.amis.pogamut.base.communication.translator.event.*;import cz.cuni.amis.pogamut.multi.communication.translator.event.*;import cz.cuni.amis.pogamut.base3d.worldview.object.*;import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.*;import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;import cz.cuni.amis.utils.exception.*;import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;import cz.cuni.amis.utils.SafeEquals;import cz.cuni.amis.pogamut.base.agent.*;import cz.cuni.amis.pogamut.multi.agent.*;import cz.cuni.amis.pogamut.multi.communication.worldview.property.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.property.*;import cz.cuni.amis.utils.token.*;import cz.cuni.amis.utils.*;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public abstract class AutoTraceRay
31 extends
32 InfoMessage
33 implements IWorldEvent, IWorldChangeEvent, ICompositeWorldObject
34
35 {
36
37
38 public static final String PROTOTYPE =
39 "ATR {Id unreal_id} {From 0,0,0} {To 0,0,0} {FastTrace False} {FloorCorrection False} {Result False} {HitNormal 0,0,0} {HitLocation 0,0,0} {TraceActors False} {HitId unreal_id} ";
40
41
42
43
44
45
46 public AutoTraceRay()
47 {
48 }
49
50
51
52
53 protected long SimTime;
54
55
56
57
58 @Override
59 public long getSimTime() {
60 return SimTime;
61 }
62
63
64
65
66 protected void setSimTime(long SimTime) {
67 this.SimTime = SimTime;
68 }
69
70
71
72
73
74
75
76 public abstract UnrealId getId()
77 ;
78
79
80
81
82
83
84 public abstract Location getFrom()
85 ;
86
87
88
89
90
91
92 public abstract Location getTo()
93 ;
94
95
96
97
98
99
100
101
102
103 public abstract boolean isFastTrace()
104 ;
105
106
107
108
109
110
111 public abstract boolean isFloorCorrection()
112 ;
113
114
115
116
117
118
119 public abstract boolean isResult()
120 ;
121
122
123
124
125
126
127
128 public abstract Vector3d getHitNormal()
129 ;
130
131
132
133
134
135
136
137 public abstract Location getHitLocation()
138 ;
139
140
141
142
143
144
145
146
147 public abstract boolean isTraceActors()
148 ;
149
150
151
152
153
154
155
156 public abstract UnrealId getHitId()
157 ;
158
159
160 public static class AutoTraceRayUpdate
161 extends GBObjectUpdate implements ICompositeWorldObjectUpdatedEvent, IGBWorldObjectEvent {
162 private AutoTraceRay object;
163 private long time;
164 private ITeamId teamId;
165
166 public AutoTraceRayUpdate
167 (AutoTraceRay source, long eventTime, ITeamId teamId) {
168 this.object = source;
169 this.time = eventTime;
170 this.teamId = teamId;
171 }
172
173
174
175
176 @Override
177 public long getSimTime() {
178 return time;
179 }
180
181 @Override
182 public IWorldObject getObject() {
183 return object;
184 }
185
186 @Override
187 public WorldObjectId getId() {
188 return object.getId();
189 }
190
191 @Override
192 public ILocalWorldObjectUpdatedEvent getLocalEvent() {
193 return new AutoTraceRayLocalImpl.AutoTraceRayLocalUpdate
194 ((AutoTraceRayLocal)object.getLocal(), time);
195 }
196
197 @Override
198 public ISharedWorldObjectUpdatedEvent getSharedEvent() {
199 return new AutoTraceRaySharedImpl.AutoTraceRaySharedUpdate
200 ((AutoTraceRayShared)object.getShared(), time, teamId);
201 }
202
203 @Override
204 public IStaticWorldObjectUpdatedEvent getStaticEvent() {
205 return new AutoTraceRayStaticImpl.AutoTraceRayStaticUpdate
206 ((AutoTraceRayStatic)object.getStatic(), time);
207 }
208
209 }
210
211
212 public String toString() {
213 return
214 super.toString() + "[" +
215
216 "Id = " + String.valueOf(getId()
217 ) + " | " +
218
219 "From = " + String.valueOf(getFrom()
220 ) + " | " +
221
222 "To = " + String.valueOf(getTo()
223 ) + " | " +
224
225 "FastTrace = " + String.valueOf(isFastTrace()
226 ) + " | " +
227
228 "FloorCorrection = " + String.valueOf(isFloorCorrection()
229 ) + " | " +
230
231 "Result = " + String.valueOf(isResult()
232 ) + " | " +
233
234 "HitNormal = " + String.valueOf(getHitNormal()
235 ) + " | " +
236
237 "HitLocation = " + String.valueOf(getHitLocation()
238 ) + " | " +
239
240 "TraceActors = " + String.valueOf(isTraceActors()
241 ) + " | " +
242
243 "HitId = " + String.valueOf(getHitId()
244 ) + " | " +
245
246 "]";
247 }
248
249
250 public String toHtmlString() {
251 return super.toString() + "[<br/>" +
252
253 "<b>Id</b> = " + String.valueOf(getId()
254 ) + " <br/> " +
255
256 "<b>From</b> = " + String.valueOf(getFrom()
257 ) + " <br/> " +
258
259 "<b>To</b> = " + String.valueOf(getTo()
260 ) + " <br/> " +
261
262 "<b>FastTrace</b> = " + String.valueOf(isFastTrace()
263 ) + " <br/> " +
264
265 "<b>FloorCorrection</b> = " + String.valueOf(isFloorCorrection()
266 ) + " <br/> " +
267
268 "<b>Result</b> = " + String.valueOf(isResult()
269 ) + " <br/> " +
270
271 "<b>HitNormal</b> = " + String.valueOf(getHitNormal()
272 ) + " <br/> " +
273
274 "<b>HitLocation</b> = " + String.valueOf(getHitLocation()
275 ) + " <br/> " +
276
277 "<b>TraceActors</b> = " + String.valueOf(isTraceActors()
278 ) + " <br/> " +
279
280 "<b>HitId</b> = " + String.valueOf(getHitId()
281 ) + " <br/> " +
282
283 "<br/>]";
284 }
285
286 public String toJsonLiteral() {
287 return "autotraceray( "
288 +
289 (getId()
290 == null ? "null" :
291 "\"" + getId()
292 .getStringId() + "\""
293 )
294 + ", " +
295 (getFrom()
296 == null ? "null" :
297 "[" + getFrom()
298 .getX() + ", " + getFrom()
299 .getY() + ", " + getFrom()
300 .getZ() + "]"
301 )
302 + ", " +
303 (getTo()
304 == null ? "null" :
305 "[" + getTo()
306 .getX() + ", " + getTo()
307 .getY() + ", " + getTo()
308 .getZ() + "]"
309 )
310 + ", " +
311 String.valueOf(isFastTrace()
312 )
313 + ", " +
314 String.valueOf(isFloorCorrection()
315 )
316 + ", " +
317 String.valueOf(isResult()
318 )
319 + ", " +
320 (getHitNormal()
321 == null ? "null" :
322 "[" + getHitNormal()
323 .getX() + ", " + getHitNormal()
324 .getY() + ", " + getHitNormal()
325 .getZ() + "]"
326 )
327 + ", " +
328 (getHitLocation()
329 == null ? "null" :
330 "[" + getHitLocation()
331 .getX() + ", " + getHitLocation()
332 .getY() + ", " + getHitLocation()
333 .getZ() + "]"
334 )
335 + ", " +
336 String.valueOf(isTraceActors()
337 )
338 + ", " +
339 (getHitId()
340 == null ? "null" :
341 "\"" + getHitId()
342 .getStringId() + "\""
343 )
344
345 + ")";
346 }
347
348
349
350
351
352
353
354
355
356
357 }
358