org.jdesktop.wonderland.server.cell
Class ProximityComponentMO

java.lang.Object
  extended by org.jdesktop.wonderland.server.cell.CellComponentMO
      extended by org.jdesktop.wonderland.server.cell.ProximityComponentMO
All Implemented Interfaces:
com.sun.sgs.app.ManagedObject, java.io.Serializable

public class ProximityComponentMO
extends CellComponentMO

Provides a mechanism for listener notification when the a view cell enters/exits a set of bounds for a cell. The bounds must be ordered from largest to smallest, thus localBounds[i] must enclose localBounds[i+1]. The listeners will be notified as the View enters each subsequent bounding volume and then notified the view exits each volume. For example given a set of Bounding Spheres with the same center and radii of 10, 5, 2. As the ViewCell moves from outside to the center of the spheres the listeners will be called with enter, 10 enter, 5 enter, 2 then as the user moves away from the center the following sequence of exits will be called exit, 2 exit, 5 exit, 10

Author:
paulby
See Also:
Serialized Form

Field Summary
protected  java.util.Map<ProximityListenerSrv,ServerProximityListenerRecord> proximityListeners
           
 
Fields inherited from class org.jdesktop.wonderland.server.cell.CellComponentMO
cellID, cellRef
 
Constructor Summary
ProximityComponentMO(CellMO cell)
          Set a list of bounds for which the system will track view enter/exit for this cell.
 
Method Summary
 void addProximityListener(ProximityListenerSrv listener, com.jme.bounding.BoundingVolume[] localBounds)
          Add a ProximityListener for the cell to which this component is attached.
protected  java.lang.String getClientClass()
          If this component has a client side component then return the fully qualified name of the client class.
 java.lang.String getIDFor(ProximityListenerSrv listener)
           
 void removeProximityListener(ProximityListenerSrv listener)
          Remove the specified ProximityListener
 void setLive(boolean isLive)
           
 void setProximityListenerBounds(ProximityListenerSrv listener, com.jme.bounding.BoundingVolume[] localBounds)
          Updates the bounds of the specified listener to be the specified local bounds.
 
Methods inherited from class org.jdesktop.wonderland.server.cell.CellComponentMO
getClientState, getServerState, isLive, setServerState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proximityListeners

protected final java.util.Map<ProximityListenerSrv,ServerProximityListenerRecord> proximityListeners
Constructor Detail

ProximityComponentMO

public ProximityComponentMO(CellMO cell)
Set a list of bounds for which the system will track view enter/exit for this cell. When the view enters/exits one of these bounds the listener will be called with the index of the bounds in the supplied array. The bounds must be ordered from largest to smallest, thus localBounds[i] must enclose localBounds[i+1]

Parameters:
cell - the cell
localProximityBounds - the proximity bounds in cell local coordinates
Method Detail

addProximityListener

public void addProximityListener(ProximityListenerSrv listener,
                                 com.jme.bounding.BoundingVolume[] localBounds)
Add a ProximityListener for the cell to which this component is attached. The listener will be called as View cells in the universe enter or exit the bounds specified. The bounds must be ordered from largest to smallest, thus localBounds[i] must enclose localBounds[i+1]. The listeners will be notified as the View enters each subsequent bounding volume and then notified the view exits each volume. For example given a set of Bounding Spheres with the same center and radii of 10, 5, 2. As the ViewCell moves from outside to the center of the spheres the listeners will be called with enter, 10 enter, 5 enter, 2 then as the user moves away from the center the following sequence of exits will be called exit, 2 exit, 5 exit, 10

Parameters:
listener -
localBounds - the set of bounds, in the local coordinate system of the cell

removeProximityListener

public void removeProximityListener(ProximityListenerSrv listener)
Remove the specified ProximityListener

Parameters:
listener -

setProximityListenerBounds

public void setProximityListenerBounds(ProximityListenerSrv listener,
                                       com.jme.bounding.BoundingVolume[] localBounds)
Updates the bounds of the specified listener to be the specified local bounds. If the specified listener object is not a registered listener, this method will have no effect.

Parameters:
listener - The listener object who's bounds you want to change.
localBounds - The new bounds list.

setLive

public void setLive(boolean isLive)
Overrides:
setLive in class CellComponentMO

getClientClass

protected java.lang.String getClientClass()
Description copied from class: CellComponentMO
If this component has a client side component then return the fully qualified name of the client class. If there is no client portion to this component, return null.

Specified by:
getClientClass in class CellComponentMO
Returns:

getIDFor

public java.lang.String getIDFor(ProximityListenerSrv listener)


Open Wonderland - http://openwonderland.org