View Javadoc

1   
2   	 	/**
3            IMPORTANT !!!
4   
5            DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbcommands BY
6            THE JavaClassesGenerator.xslt. MODIFY THAT FILE INSTEAD OF THIS ONE.
7            
8            Use Ant task process-gb-messages after that to generate .java files again.
9            
10           IMPORTANT END !!!
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   		 * Representation of the GameBots2004 command ADDRAY.
15   		 *
16   		 * 
17  		Add custom ray for automatic ray tracing. If you send Id =
18  		Default, all rays will be erased and default set of rays will be
19  		loaded (straight ahead (1,0,0) with 250 length, 45 degrees left
20  		(1,–1,0) with 200 length, 45 degrees right (1,1,0) with 200
21  		length). This set of rays is also loaded by default. If you want
22  		to change existing ray, just support its Id in ADDRAY command
23  		along with new parameters. Direction of the rays work as
24  		follows. Bot is looking to x axis, that means if I want ray
25  		straight ahead I specify some vector on positive x axis (vectors
26  		in unreal are specified by (x,y,z) so it would look like this
27  		(1,0,0) or this (123,0,0) – numbers doesn't matter, its about
28  		direction - vectors will be normalized). If I want ray behind it
29  		would be (–1,0,0). 90 degrees right (0,1,0) etc.
30  	
31           */
32   	public class AddRay 
33  		extends CommandMessage
34  	        {
35  	        	
36  		        
37      	/** Example how the message looks like - used during parser tests. */
38      	public static final String PROTOTYPE =
39      		" {Id text}  {Direction 0,0,0}  {Length 0}  {FastTrace False}  {FloorCorrection False}  {TraceActors False} ";
40      
41  		/**
42  		 * Creates new instance of command AddRay.
43  		 * 
44  		Add custom ray for automatic ray tracing. If you send Id =
45  		Default, all rays will be erased and default set of rays will be
46  		loaded (straight ahead (1,0,0) with 250 length, 45 degrees left
47  		(1,–1,0) with 200 length, 45 degrees right (1,1,0) with 200
48  		length). This set of rays is also loaded by default. If you want
49  		to change existing ray, just support its Id in ADDRAY command
50  		along with new parameters. Direction of the rays work as
51  		follows. Bot is looking to x axis, that means if I want ray
52  		straight ahead I specify some vector on positive x axis (vectors
53  		in unreal are specified by (x,y,z) so it would look like this
54  		(1,0,0) or this (123,0,0) – numbers doesn't matter, its about
55  		direction - vectors will be normalized). If I want ray behind it
56  		would be (–1,0,0). 90 degrees right (0,1,0) etc.
57  	
58  		 * Corresponding GameBots message for this command is
59  		 * ADDRAY.
60  		 *
61  		 * 
62  		 *    @param Id 
63  			User set Id of the ray, so the ray can be identified.
64  		
65  		 *    @param Direction 
66  			Vector direction of the ray (it will be relative - added to
67  			the vector, where the bot is looking, also takes into
68  			account angle of the floor the bot is standing on).
69  		
70  		 *    @param Length 
71  			Specifies the length of the ray (in UT units).
72  		
73  		 *    @param FastTrace 
74  			True if we want to use FastTrace function instead of Trace
75  			function (a bit faster but less information provided - just
76  			information if we hit something or not).
77  		
78  		 *    @param FloorCorrection 
79        If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
80  		
81  		 *    @param TraceActors 
82  			If we want to trace also actors – bots, monsters, players,
83  			items. False if we want to trace just level geometry.
84  		
85  		 */
86  		public AddRay(
87  			String Id,  Vector3d Direction,  Integer Length,  Boolean FastTrace,  Boolean FloorCorrection,  Boolean TraceActors
88  		) {
89  			
90  				this.Id = Id;
91              
92  				this.Direction = Direction;
93              
94  				this.Length = Length;
95              
96  				this.FastTrace = FastTrace;
97              
98  				this.FloorCorrection = FloorCorrection;
99              
100 				this.TraceActors = TraceActors;
101             
102 		}
103 
104 		
105 			/**
106 			 * Creates new instance of command AddRay.
107 			 * 
108 		Add custom ray for automatic ray tracing. If you send Id =
109 		Default, all rays will be erased and default set of rays will be
110 		loaded (straight ahead (1,0,0) with 250 length, 45 degrees left
111 		(1,–1,0) with 200 length, 45 degrees right (1,1,0) with 200
112 		length). This set of rays is also loaded by default. If you want
113 		to change existing ray, just support its Id in ADDRAY command
114 		along with new parameters. Direction of the rays work as
115 		follows. Bot is looking to x axis, that means if I want ray
116 		straight ahead I specify some vector on positive x axis (vectors
117 		in unreal are specified by (x,y,z) so it would look like this
118 		(1,0,0) or this (123,0,0) – numbers doesn't matter, its about
119 		direction - vectors will be normalized). If I want ray behind it
120 		would be (–1,0,0). 90 degrees right (0,1,0) etc.
121 	
122 			 * Corresponding GameBots message for this command is
123 			 * ADDRAY.
124 			 * <p></p>
125 			 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
126 		     */
127 		    public AddRay() {
128 		    }
129 			
130 		
131 		/**
132 		 * Cloning constructor.
133 		 *
134 		 * @param original
135 		 */
136 		public AddRay(AddRay original) {
137 		   
138 		        this.Id = original.Id;
139 		   
140 		        this.Direction = original.Direction;
141 		   
142 		        this.Length = original.Length;
143 		   
144 		        this.FastTrace = original.FastTrace;
145 		   
146 		        this.FloorCorrection = original.FloorCorrection;
147 		   
148 		        this.TraceActors = original.TraceActors;
149 		   
150 		}
151     
152 	        /**
153 	        
154 			User set Id of the ray, so the ray can be identified.
155 		 
156 	        */
157 	        protected
158 	         String Id =
159 	       	
160 	        		null
161 	        	;
162 	
163 	        
164 	        
165  		/**
166          * 
167 			User set Id of the ray, so the ray can be identified.
168 		 
169          */
170         public String getId()
171  	
172 	        {
173 	            return
174 	        	 Id;
175 	        }
176 	        
177 	        
178 	        
179  		
180  		/**
181          * 
182 			User set Id of the ray, so the ray can be identified.
183 		 
184          */
185         public AddRay 
186         setId(String Id)
187  	
188 			{
189 				this.Id = Id;
190 				return this;
191 			}
192 		
193 	        /**
194 	        
195 			Vector direction of the ray (it will be relative - added to
196 			the vector, where the bot is looking, also takes into
197 			account angle of the floor the bot is standing on).
198 		 
199 	        */
200 	        protected
201 	         Vector3d Direction =
202 	       	
203 	        		null
204 	        	;
205 	
206 	        
207 	        
208  		/**
209          * 
210 			Vector direction of the ray (it will be relative - added to
211 			the vector, where the bot is looking, also takes into
212 			account angle of the floor the bot is standing on).
213 		 
214          */
215         public Vector3d getDirection()
216  	
217 	        {
218 	            return
219 	        	 Direction;
220 	        }
221 	        
222 	        
223 	        
224  		
225  		/**
226          * 
227 			Vector direction of the ray (it will be relative - added to
228 			the vector, where the bot is looking, also takes into
229 			account angle of the floor the bot is standing on).
230 		 
231          */
232         public AddRay 
233         setDirection(Vector3d Direction)
234  	
235 			{
236 				this.Direction = Direction;
237 				return this;
238 			}
239 		
240 	        /**
241 	        
242 			Specifies the length of the ray (in UT units).
243 		 
244 	        */
245 	        protected
246 	         Integer Length =
247 	       	
248 	        		null
249 	        	;
250 	
251 	        
252 	        
253  		/**
254          * 
255 			Specifies the length of the ray (in UT units).
256 		 
257          */
258         public Integer getLength()
259  	
260 	        {
261 	            return
262 	        	 Length;
263 	        }
264 	        
265 	        
266 	        
267  		
268  		/**
269          * 
270 			Specifies the length of the ray (in UT units).
271 		 
272          */
273         public AddRay 
274         setLength(Integer Length)
275  	
276 			{
277 				this.Length = Length;
278 				return this;
279 			}
280 		
281 	        /**
282 	        
283 			True if we want to use FastTrace function instead of Trace
284 			function (a bit faster but less information provided - just
285 			information if we hit something or not).
286 		 
287 	        */
288 	        protected
289 	         Boolean FastTrace =
290 	       	
291 	        		null
292 	        	;
293 	
294 	        
295 	        
296  		/**
297          * 
298 			True if we want to use FastTrace function instead of Trace
299 			function (a bit faster but less information provided - just
300 			information if we hit something or not).
301 		 
302          */
303         public Boolean isFastTrace()
304  	
305 	        {
306 	            return
307 	        	 FastTrace;
308 	        }
309 	        
310 	        
311 	        
312  		
313  		/**
314          * 
315 			True if we want to use FastTrace function instead of Trace
316 			function (a bit faster but less information provided - just
317 			information if we hit something or not).
318 		 
319          */
320         public AddRay 
321         setFastTrace(Boolean FastTrace)
322  	
323 			{
324 				this.FastTrace = FastTrace;
325 				return this;
326 			}
327 		
328 	        /**
329 	        
330       If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
331 		 
332 	        */
333 	        protected
334 	         Boolean FloorCorrection =
335 	       	
336 	        		null
337 	        	;
338 	
339 	        
340 	        
341  		/**
342          * 
343       If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
344 		 
345          */
346         public Boolean isFloorCorrection()
347  	
348 	        {
349 	            return
350 	        	 FloorCorrection;
351 	        }
352 	        
353 	        
354 	        
355  		
356  		/**
357          * 
358       If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
359 		 
360          */
361         public AddRay 
362         setFloorCorrection(Boolean FloorCorrection)
363  	
364 			{
365 				this.FloorCorrection = FloorCorrection;
366 				return this;
367 			}
368 		
369 	        /**
370 	        
371 			If we want to trace also actors – bots, monsters, players,
372 			items. False if we want to trace just level geometry.
373 		 
374 	        */
375 	        protected
376 	         Boolean TraceActors =
377 	       	
378 	        		null
379 	        	;
380 	
381 	        
382 	        
383  		/**
384          * 
385 			If we want to trace also actors – bots, monsters, players,
386 			items. False if we want to trace just level geometry.
387 		 
388          */
389         public Boolean isTraceActors()
390  	
391 	        {
392 	            return
393 	        	 TraceActors;
394 	        }
395 	        
396 	        
397 	        
398  		
399  		/**
400          * 
401 			If we want to trace also actors – bots, monsters, players,
402 			items. False if we want to trace just level geometry.
403 		 
404          */
405         public AddRay 
406         setTraceActors(Boolean TraceActors)
407  	
408 			{
409 				this.TraceActors = TraceActors;
410 				return this;
411 			}
412 		
413  	    public String toString() {
414             return toMessage();
415         }
416  	
417  		public String toHtmlString() {
418 			return super.toString() + "[<br/>" +
419             	
420             	"<b>Id</b> = " +
421             	String.valueOf(getId()
422  	) +
423             	" <br/> " +
424             	
425             	"<b>Direction</b> = " +
426             	String.valueOf(getDirection()
427  	) +
428             	" <br/> " +
429             	
430             	"<b>Length</b> = " +
431             	String.valueOf(getLength()
432  	) +
433             	" <br/> " +
434             	
435             	"<b>FastTrace</b> = " +
436             	String.valueOf(isFastTrace()
437  	) +
438             	" <br/> " +
439             	
440             	"<b>FloorCorrection</b> = " +
441             	String.valueOf(isFloorCorrection()
442  	) +
443             	" <br/> " +
444             	
445             	"<b>TraceActors</b> = " +
446             	String.valueOf(isTraceActors()
447  	) +
448             	" <br/> " +
449             	 
450             	"<br/>]"
451             ;
452 		}
453  	
454 		public String toMessage() {
455      		StringBuffer buf = new StringBuffer();
456      		buf.append("ADDRAY");
457      		
458 						if (Id != null) {
459 							buf.append(" {Id " + Id + "}");
460 						}
461 					
462 						if (Direction != null) {
463 							buf.append(" {Direction " +
464 								Direction.getX() + "," +
465 								Direction.getY() + "," +
466 								Direction.getZ() + "}");
467 						}
468 					
469 						if (Length != null) {
470 							buf.append(" {Length " + Length + "}");
471 						}
472 					
473 						if (FastTrace != null) {
474 							buf.append(" {FastTrace " + FastTrace + "}");
475 						}
476 					
477 						if (FloorCorrection != null) {
478 							buf.append(" {FloorCorrection " + FloorCorrection + "}");
479 						}
480 					
481 						if (TraceActors != null) {
482 							buf.append(" {TraceActors " + TraceActors + "}");
483 						}
484 					
485    			return buf.toString();
486    		}
487  	
488  		// --- Extra Java from XML BEGIN (extra/code/java)
489         	
490 		// --- Extra Java from XML END (extra/code/java)
491  	
492 	        }
493