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=composite]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=composite]+classtype[@name=impl] END
15      
16   		/**
17           *  
18              		Composite implementation of the ATR abstract message. It wraps Local/Shared/Static parts in single object
19              		allowing to presenting a nice facade for users.
20              	
21           *
22           *  <p></p><p></p>
23           *  Complete message documentation:               
24           *  
25  		Synchronous message. Contains the results of automatically
26  		casted rays. One ATR message is for one casted ray. New
27  		automatically casted rays can be defined by ADDRAY command and
28  		removed by REMOVERAY command.
29  	
30           */
31   	public class AutoTraceRayCompositeImpl 
32    				extends AutoTraceRay
33  	    {
34   	
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public AutoTraceRayCompositeImpl()
41  		{
42  		}
43  	
44  		
45  		/**
46  		 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
47  		 *
48  		 * @param partLocal local-part of the message
49  		 * @param partShared shared-part of the message
50  		 * @param partStatic static-part of the message
51  		 */
52  		public AutoTraceRayCompositeImpl(
53  			AutoTraceRayLocalImpl partLocal,
54  			AutoTraceRaySharedImpl partShared,
55  			AutoTraceRayStaticImpl partStatic
56  		) {
57  			this.partLocal  = partLocal;
58  			this.partShared = partShared;
59  			this.partStatic = partStatic;
60  		}
61  		
62  		/**
63  		 * Cloning constructor.
64  		 *
65  		 * @param original		 
66  		 */
67  		public AutoTraceRayCompositeImpl(AutoTraceRayCompositeImpl original) {
68  			this.partLocal = partLocal;
69  			this.partShared = partShared;
70  			this.partStatic = partStatic;
71  		}
72      
73     				
74     				@Override
75     				public void setSimTime(long SimTime) {
76  					super.setSimTime(SimTime);
77  				}
78     			
79      			
80      			protected 
81      			AutoTraceRayStaticImpl
82      			partStatic;
83      			
84      			@Override
85  				public AutoTraceRayStatic getStatic() {
86  					return partStatic;
87  				}
88      			
89      			protected
90      			AutoTraceRayLocalImpl
91      			partLocal;
92      	
93      			@Override
94  				public AutoTraceRayLocal getLocal() {
95  					return partLocal;
96  				}
97  			
98      			AutoTraceRaySharedImpl
99      			partShared;
100     			
101 				@Override
102 				public AutoTraceRayShared getShared() {
103 					return partShared;
104 				}
105 			
106 				
107   				
108   					@Override
109     				
110  		/**
111          * 
112 			An Id for this ray (should be unique), assigned by the user
113 			when adding ray.
114 		 
115          */
116         public  UnrealId getId()
117  	 {
118     					return 
119     						
120     								partStatic.
121     							getId()
122  	;
123     				}
124     			
125   					@Override
126     				
127  		/**
128          * 
129 			Location from which the ray is emitted.
130 		 
131          */
132         public  Location getFrom()
133  	 {
134     					return 
135     						
136     								partLocal.
137     							getFrom()
138  	;
139     				}
140     			
141   					@Override
142     				
143  		/**
144          * 
145 			Location to which the ray is sent.
146 		 
147          */
148         public  Location getTo()
149  	 {
150     					return 
151     						
152     								partLocal.
153     							getTo()
154  	;
155     				}
156     			
157   					@Override
158     				
159  		/**
160          * 
161 			True if it is a fast trace, false if not (fast trace is a
162 			bit faster version of UT2004 ray trace - but provides us
163 			with less information - just true/false if we hit something
164 			on the way or not).
165 		 
166          */
167         public  boolean isFastTrace()
168  	 {
169     					return 
170     						
171     								partLocal.
172     							isFastTrace()
173  	;
174     				}
175     			
176   					@Override
177     				
178  		/**
179          * 
180       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.
181 		 
182          */
183         public  boolean isFloorCorrection()
184  	 {
185     					return 
186     						
187     								partLocal.
188     							isFloorCorrection()
189  	;
190     				}
191     			
192   					@Override
193     				
194  		/**
195          * 
196 			True if it hit something, false if not.
197 		 
198          */
199         public  boolean isResult()
200  	 {
201     					return 
202     						
203     								partLocal.
204     							isResult()
205  	;
206     				}
207     			
208   					@Override
209     				
210  		/**
211          * 
212 			Vector with normal of the plane we have hit (not sent if
213 			FastTrace is True).
214 		 
215          */
216         public  Vector3d getHitNormal()
217  	 {
218     					return 
219     						
220     								partLocal.
221     							getHitNormal()
222  	;
223     				}
224     			
225   					@Override
226     				
227  		/**
228          * 
229 			Vector with location of the collision (not sent if FastTrace
230 			is True).
231 		 
232          */
233         public  Location getHitLocation()
234  	 {
235     					return 
236     						
237     								partLocal.
238     							getHitLocation()
239  	;
240     				}
241     			
242   					@Override
243     				
244  		/**
245          * 
246 			If we traced also actors with this ray (actors – moving
247 			things in a game – bots, players, monsters, pickup …) (only
248 			if NOT using FastTrace)
249 		 
250          */
251         public  boolean isTraceActors()
252  	 {
253     					return 
254     						
255     								partLocal.
256     							isTraceActors()
257  	;
258     				}
259     			
260   					@Override
261     				
262  		/**
263          * 
264 			Id of the actor we have hit. (Sent if FastTrace is False and
265 			TraceActors is True).
266 		 
267          */
268         public  UnrealId getHitId()
269  	 {
270     					return 
271     						
272     								partLocal.
273     							getHitId()
274  	;
275     				}
276     			
277  		
278  	    public String toString() {
279             return
280             	super.toString() + "[" +
281             	
282             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
283             		
284 				"]";           		
285         }
286  	
287  		
288  		public String toHtmlString() {
289  			return super.toString() + "[<br/>" +
290             	
291             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
292             		
293 				"<br/>]";     
294 		}
295  	
296  		
297  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
298         	
299 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
300 		
301 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
302 	        
303 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
304  	
305 		}
306