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 public class LocationUpdate
28 extends InfoMessage
29 implements IWorldEvent, IWorldChangeEvent
30
31 {
32
33
34 public static final String PROTOTYPE =
35 "UPD {Loc 0,0,0} {Vel 0,0,0} {Rot 0,0,0} ";
36
37
38
39
40
41
42 public LocationUpdate()
43 {
44 }
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 public LocationUpdate(
81 Location Loc, Velocity Vel, Rotation Rot
82 ) {
83
84 this.Loc = Loc;
85
86 this.Vel = Vel;
87
88 this.Rot = Rot;
89
90 }
91
92
93
94
95
96
97 public LocationUpdate(LocationUpdate original) {
98
99 this.Loc = original.getLoc()
100 ;
101
102 this.Vel = original.getVel()
103 ;
104
105 this.Rot = original.getRot()
106 ;
107
108 this.SimTime = original.getSimTime();
109 }
110
111
112 protected long SimTime;
113
114
115
116
117 @Override
118 public long getSimTime() {
119 return SimTime;
120 }
121
122
123
124
125 protected void setSimTime(long SimTime) {
126 this.SimTime = SimTime;
127 }
128
129
130
131
132
133
134
135 protected
136 Location Loc =
137 null;
138
139
140
141
142
143
144 public Location getLoc()
145 {
146 return Loc;
147 }
148
149
150
151
152
153
154
155
156 protected
157 Velocity Vel =
158 null;
159
160
161
162
163
164
165
166 public Velocity getVel()
167 {
168 return Vel;
169 }
170
171
172
173
174
175
176
177 protected
178 Rotation Rot =
179 null;
180
181
182
183
184
185
186 public Rotation getRot()
187 {
188 return Rot;
189 }
190
191
192 public String toString() {
193 return
194 super.toString() + "[" +
195
196 "Loc = " + String.valueOf(getLoc()
197 ) + " | " +
198
199 "Vel = " + String.valueOf(getVel()
200 ) + " | " +
201
202 "Rot = " + String.valueOf(getRot()
203 ) + " | " +
204
205 "]";
206 }
207
208
209 public String toHtmlString() {
210 return super.toString() + "[<br/>" +
211
212 "<b>Loc</b> = " + String.valueOf(getLoc()
213 ) + " <br/> " +
214
215 "<b>Vel</b> = " + String.valueOf(getVel()
216 ) + " <br/> " +
217
218 "<b>Rot</b> = " + String.valueOf(getRot()
219 ) + " <br/> " +
220
221 "<br/>]";
222 }
223
224 public String toJsonLiteral() {
225 return "locationupdate( "
226 +
227 (getLoc()
228 == null ? "null" :
229 "[" + getLoc()
230 .getX() + ", " + getLoc()
231 .getY() + ", " + getLoc()
232 .getZ() + "]"
233 )
234 + ", " +
235 (getVel()
236 == null ? "null" :
237 "[" + getVel()
238 .getX() + ", " + getVel()
239 .getY() + ", " + getVel()
240 .getZ() + "]"
241 )
242 + ", " +
243 (getRot()
244 == null ? "null" :
245 "[" + getRot()
246 .getPitch() + ", " + getRot()
247 .getYaw() + ", " + getRot()
248 .getRoll() + "]"
249 )
250
251 + ")";
252 }
253
254
255
256
257
258
259
260
261
262
263 }
264