View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2    		
3    		// --- IMPORTS FROM /messages/settings/javasettings/javaimport BEGIN
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   		// --- IMPORTS FROM /messages/settings/javasettings/javaimport END
6   		
7   		
8   		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] BEGIN
9   				
10  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] END
11  		
12  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=local]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=local]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the local part of the GameBots2004 message ATR.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. Contains the results of automatically
25  		casted rays. One ATR message is for one casted ray. New
26  		automatically casted rays can be defined by ADDRAY command and
27  		removed by REMOVERAY command.
28  	
29           */
30   	public abstract class AutoTraceRayLocal 
31    						extends InfoMessage
32    						implements ILocalWorldObject
33    						
34  	    {
35   	
36      	
37      	
38      	/**
39      	 * Parameter-less contructor for the message.
40      	 */
41  		public AutoTraceRayLocal()
42  		{
43  		}
44  		
45  				// abstract definition of the local-part of the message, no more constructors is needed
46  			
47  	   		
48  			protected long SimTime;
49  				
50  			/**
51  			 * Simulation time in MILLI SECONDS !!!
52  			 */	
53  			@Override
54  			public long getSimTime() {
55  				return SimTime;
56  			}
57  						
58  			/**
59  			 * Used by Yylex to slip correct time of the object or programmatically.
60  			 */
61  			protected void setSimTime(long SimTime) {
62  				this.SimTime = SimTime;
63  			}
64  	   	
65  	    			
66  	    				@Override
67  		    			public abstract 
68  		    			AutoTraceRayLocal clone();
69  		    			
70  						@Override
71  						public Class getCompositeClass() {
72  							return AutoTraceRay.class;
73  						}
74  	
75  						
76  		    			
77   		/**
78           * 
79  			An Id for this ray (should be unique), assigned by the user
80  			when adding ray.
81  		 
82           */
83          public abstract UnrealId getId()
84   	;
85  		    			
86   		/**
87           * 
88  			Location from which the ray is emitted.
89  		 
90           */
91          public abstract Location getFrom()
92   	;
93  		    			
94   		/**
95           * 
96  			Location to which the ray is sent.
97  		 
98           */
99          public abstract Location getTo()
100  	;
101 		    			
102  		/**
103          * 
104 			True if it is a fast trace, false if not (fast trace is a
105 			bit faster version of UT2004 ray trace - but provides us
106 			with less information - just true/false if we hit something
107 			on the way or not).
108 		 
109          */
110         public abstract boolean isFastTrace()
111  	;
112 		    			
113  		/**
114          * 
115       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.
116 		 
117          */
118         public abstract boolean isFloorCorrection()
119  	;
120 		    			
121  		/**
122          * 
123 			True if it hit something, false if not.
124 		 
125          */
126         public abstract boolean isResult()
127  	;
128 		    			
129  		/**
130          * 
131 			Vector with normal of the plane we have hit (not sent if
132 			FastTrace is True).
133 		 
134          */
135         public abstract Vector3d getHitNormal()
136  	;
137 		    			
138  		/**
139          * 
140 			Vector with location of the collision (not sent if FastTrace
141 			is True).
142 		 
143          */
144         public abstract Location getHitLocation()
145  	;
146 		    			
147  		/**
148          * 
149 			If we traced also actors with this ray (actors – moving
150 			things in a game – bots, players, monsters, pickup …) (only
151 			if NOT using FastTrace)
152 		 
153          */
154         public abstract boolean isTraceActors()
155  	;
156 		    			
157  		/**
158          * 
159 			Id of the actor we have hit. (Sent if FastTrace is False and
160 			TraceActors is True).
161 		 
162          */
163         public abstract UnrealId getHitId()
164  	;
165 		    			
166     	
167     	
168     	
169     	public AutoTraceRayLocal getLocal() {
170 			return this;
171     	}
172 		public ISharedWorldObject getShared() {
173 		 	throw new UnsupportedOperationException("Could not return LOCAL");
174 		}
175 		public IStaticWorldObject getStatic() {
176 		    throw new UnsupportedOperationException("Could not return LOCAL");
177 		}
178  	
179  		
180  		
181  	    public String toString() {
182             return
183             	super.toString() + "[" +
184             	
185 		              			"Id = " + String.valueOf(getId()
186  	) + " | " + 
187 		              		
188 		              			"From = " + String.valueOf(getFrom()
189  	) + " | " + 
190 		              		
191 		              			"To = " + String.valueOf(getTo()
192  	) + " | " + 
193 		              		
194 		              			"FastTrace = " + String.valueOf(isFastTrace()
195  	) + " | " + 
196 		              		
197 		              			"FloorCorrection = " + String.valueOf(isFloorCorrection()
198  	) + " | " + 
199 		              		
200 		              			"Result = " + String.valueOf(isResult()
201  	) + " | " + 
202 		              		
203 		              			"HitNormal = " + String.valueOf(getHitNormal()
204  	) + " | " + 
205 		              		
206 		              			"HitLocation = " + String.valueOf(getHitLocation()
207  	) + " | " + 
208 		              		
209 		              			"TraceActors = " + String.valueOf(isTraceActors()
210  	) + " | " + 
211 		              		
212 		              			"HitId = " + String.valueOf(getHitId()
213  	) + " | " + 
214 		              		
215 				"]";           		
216         }
217  	
218  		
219  		public String toHtmlString() {
220  			return super.toString() + "[<br/>" +
221             	
222 		              			"<b>Id</b> = " + String.valueOf(getId()
223  	) + " <br/> " + 
224 		              		
225 		              			"<b>From</b> = " + String.valueOf(getFrom()
226  	) + " <br/> " + 
227 		              		
228 		              			"<b>To</b> = " + String.valueOf(getTo()
229  	) + " <br/> " + 
230 		              		
231 		              			"<b>FastTrace</b> = " + String.valueOf(isFastTrace()
232  	) + " <br/> " + 
233 		              		
234 		              			"<b>FloorCorrection</b> = " + String.valueOf(isFloorCorrection()
235  	) + " <br/> " + 
236 		              		
237 		              			"<b>Result</b> = " + String.valueOf(isResult()
238  	) + " <br/> " + 
239 		              		
240 		              			"<b>HitNormal</b> = " + String.valueOf(getHitNormal()
241  	) + " <br/> " + 
242 		              		
243 		              			"<b>HitLocation</b> = " + String.valueOf(getHitLocation()
244  	) + " <br/> " + 
245 		              		
246 		              			"<b>TraceActors</b> = " + String.valueOf(isTraceActors()
247  	) + " <br/> " + 
248 		              		
249 		              			"<b>HitId</b> = " + String.valueOf(getHitId()
250  	) + " <br/> " + 
251 		              		
252 				"<br/>]";     
253 		}
254  	
255  		
256  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
257         	
258 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
259 		
260 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=local+classtype[@name=abstract]) ---
261 	        
262 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=local+classtype[@name=abstract]) ---        	            	
263  	
264 		}
265