org.jdesktop.wonderland.client.cell
Class ProximityComponent

java.lang.Object
  extended by org.jdesktop.wonderland.client.cell.CellComponent
      extended by org.jdesktop.wonderland.client.cell.ProximityComponent
All Implemented Interfaces:
ViewManager.ViewManagerListener

public class ProximityComponent
extends CellComponent
implements ViewManager.ViewManagerListener

Provides a mechanism for listener notification when the local 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

Field Summary
 
Fields inherited from class org.jdesktop.wonderland.client.cell.CellComponent
cell, status
 
Constructor Summary
ProximityComponent(Cell cell)
          Set a list of bounds for which the system will track view enter/exit for this cell.
 
Method Summary
 void addProximityListener(ProximityListener listener, com.jme.bounding.BoundingVolume[] localBounds)
          Add a proximity listener.
 void primaryViewCellChanged(ViewCell oldViewCell, ViewCell newViewCell)
          When the view changes, update our listeners
 void removeProximityListener(ProximityListener listener)
          Remove the specified listener.
protected  void setStatus(CellStatus status, boolean increasing)
          Set the status of the component.
 
Methods inherited from class org.jdesktop.wonderland.client.cell.CellComponent
setClientState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProximityComponent

public ProximityComponent(Cell 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
Method Detail

addProximityListener

public void addProximityListener(ProximityListener listener,
                                 com.jme.bounding.BoundingVolume[] localBounds)
Add a proximity listener.

Parameters:
listener - the listener that will be notified
localBounds - the array of bounds (in cell local coordinates) for which the listener will be notified

removeProximityListener

public void removeProximityListener(ProximityListener listener)
Remove the specified listener. Does nothing if the listener is not already attached to this ProximityComponent

Parameters:
listener - the listener to remove

setStatus

protected void setStatus(CellStatus status,
                         boolean increasing)
Description copied from class: CellComponent
Set the status of the component. This method is overridden by subclasses of cell component. However, if you wish to set the status of a cell component, invoke setComponentStatus() instead.

Overrides:
setStatus in class CellComponent
Parameters:
status - The new status of the component

primaryViewCellChanged

public void primaryViewCellChanged(ViewCell oldViewCell,
                                   ViewCell newViewCell)
When the view changes, update our listeners

Specified by:
primaryViewCellChanged in interface ViewManager.ViewManagerListener
Parameters:
oldViewCell - old view
newViewCell - new view


Open Wonderland - http://openwonderland.org