org.xith3d.picking
Class PickDispatcher

java.lang.Object
  extended by org.xith3d.picking.PickDispatcher
All Implemented Interfaces:
AllPickListener, NearestPickListener, PickListener, PickListenerBase

public class PickDispatcher
extends java.lang.Object
implements PickListener

This class acts as a proxy for pick events and can dispatch the pick events to multiple listeners.

Since:
1.0

Constructor Summary
PickDispatcher()
           
 
Method Summary
 void addPickListener(PickListener listener)
           
 void onObjectPicked(PickResult nearest, java.lang.Object userObject, long pickTime)
          This event is fired when a picking was successful
It is very important to be aware of the fact, that the PickResult is not guaranteed to be valid after this method has been left.
 void onObjectsPicked(java.util.List<PickResult> pickResults, java.lang.Object userObject, long pickTime)
          This event is fired when a picking was successful.
 void onPickingMissed(java.lang.Object userObject, long pickTime)
          this Event is fired when a pickray didn't hit any node
 void removePickListener(PickListener listener)
           
 boolean testIntersectionsInWorldSpaceForPicking()
          By default this method should return false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PickDispatcher

public PickDispatcher()
Method Detail

addPickListener

public void addPickListener(PickListener listener)

removePickListener

public void removePickListener(PickListener listener)

testIntersectionsInWorldSpaceForPicking

public boolean testIntersectionsInWorldSpaceForPicking()
By default this method should return false.
If it returns true, ray triangle intersections are tested in world space instead of object space.

Specified by:
testIntersectionsInWorldSpaceForPicking in interface PickListenerBase
Returns:
whether or not to test picking intersections in world space

onObjectPicked

public void onObjectPicked(PickResult nearest,
                           java.lang.Object userObject,
                           long pickTime)
This event is fired when a picking was successful
It is very important to be aware of the fact, that the PickResult is not guaranteed to be valid after this method has been left.

Specified by:
onObjectPicked in interface NearestPickListener
Parameters:
nearest - the neares result.
userObject - this userObject is passed to the Picker and back to this method
pickTime - the needed time to do this picking

onObjectsPicked

public void onObjectsPicked(java.util.List<PickResult> pickResults,
                            java.lang.Object userObject,
                            long pickTime)
This event is fired when a picking was successful.
It is very important to be aware of the fact, that the List of PickResults is not guaranteed to be valid after this method has been left.

Specified by:
onObjectsPicked in interface AllPickListener
Parameters:
pickResults - all PickResults from this picking operation
userObject - this userObject is passed to the Picker and back to this method
pickTime - the needed time to do this picking

onPickingMissed

public void onPickingMissed(java.lang.Object userObject,
                            long pickTime)
this Event is fired when a pickray didn't hit any node

Specified by:
onPickingMissed in interface PickListenerBase
Parameters:
userObject - this userObject is passed to the Picker and back to this method
pickTime - the needed time to do this picking