1
2
3
4
5
6
7
8
9
10
11
12 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands;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.*;
13
14
15
16
17
18
19
20 public class TurnTo
21 extends CommandMessage
22 {
23
24
25
26 public static final String PROTOTYPE =
27 " {Target unreal_id} {Rotation 0,0,0} {Location 0,0,0} ";
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 public TurnTo(
54 UnrealId Target, Rotation Rotation, Location Location
55 ) {
56
57 this.Target = Target;
58
59 this.Rotation = Rotation;
60
61 this.Location = Location;
62
63 }
64
65
66
67
68
69
70
71
72
73
74
75
76 public TurnTo() {
77 }
78
79
80
81
82
83
84
85 public TurnTo(TurnTo original) {
86
87 this.Target = original.Target;
88
89 this.Rotation = original.Rotation;
90
91 this.Location = original.Location;
92
93 }
94
95
96
97
98
99
100
101 protected
102 UnrealId Target =
103
104 null
105 ;
106
107
108
109
110
111
112
113
114
115 public UnrealId getTarget()
116
117 {
118 return
119 Target;
120 }
121
122
123
124
125
126
127
128
129
130
131 public TurnTo
132 setTarget(UnrealId Target)
133
134 {
135 this.Target = Target;
136 return this;
137 }
138
139
140
141
142
143
144
145
146
147 protected
148 Rotation Rotation =
149
150 null
151 ;
152
153
154
155
156
157
158
159
160
161
162
163 public Rotation getRotation()
164
165 {
166 return
167 Rotation;
168 }
169
170
171
172
173
174
175
176
177
178
179
180
181 public TurnTo
182 setRotation(Rotation Rotation)
183
184 {
185 this.Rotation = Rotation;
186 return this;
187 }
188
189
190
191
192
193
194
195 protected
196 Location Location =
197
198 null
199 ;
200
201
202
203
204
205
206
207
208
209 public Location getLocation()
210
211 {
212 return
213 Location;
214 }
215
216
217
218
219
220
221
222
223
224
225 public TurnTo
226 setLocation(Location Location)
227
228 {
229 this.Location = Location;
230 return this;
231 }
232
233 public String toString() {
234 return toMessage();
235 }
236
237 public String toHtmlString() {
238 return super.toString() + "[<br/>" +
239
240 "<b>Target</b> = " +
241 String.valueOf(getTarget()
242 ) +
243 " <br/> " +
244
245 "<b>Rotation</b> = " +
246 String.valueOf(getRotation()
247 ) +
248 " <br/> " +
249
250 "<b>Location</b> = " +
251 String.valueOf(getLocation()
252 ) +
253 " <br/> " +
254
255 "<br/>]"
256 ;
257 }
258
259 public String toMessage() {
260 StringBuffer buf = new StringBuffer();
261 buf.append("TURNTO");
262
263 if (Target != null) {
264 buf.append(" {Target " + Target.getStringId() + "}");
265 }
266
267 if (Rotation != null) {
268 buf.append(" {Rotation " +
269 Rotation.getPitch() + "," +
270 Rotation.getYaw() + "," +
271 Rotation.getRoll() + "}");
272 }
273
274 if (Location != null) {
275 buf.append(" {Location " +
276 Location.getX() + "," +
277 Location.getY() + "," +
278 Location.getZ() + "}");
279 }
280
281 return buf.toString();
282 }
283
284
285
286
287
288 }
289