org.jdesktop.wonderland.common.cell
Class ProximityListenerRecord

java.lang.Object
  extended by org.jdesktop.wonderland.common.cell.ProximityListenerRecord
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ServerProximityListenerRecord

public class ProximityListenerRecord
extends java.lang.Object
implements java.io.Serializable

Utility class to help implement proximity listeners on both client and server

Author:
paulby, Drew Harry
See Also:
Serialized Form

Nested Class Summary
static interface ProximityListenerRecord.ProximityListenerWrapper
          Wrapper for the listener, client and server listeners have a slightly different interface
 
Field Summary
protected  java.util.Map<CellID,java.lang.Integer> lastContainerIndexMap
           
protected  java.io.Serializable lock
           
protected static java.util.logging.Logger logger
           
protected  ProximityListenerRecord.ProximityListenerWrapper proximityListener
           
 
Constructor Summary
ProximityListenerRecord()
           
ProximityListenerRecord(ProximityListenerRecord.ProximityListenerWrapper proximityListener, com.jme.bounding.BoundingVolume[] localBounds)
           
 
Method Summary
 void cleanup(CellID viewCellID)
          Cleanup this record, generating any exit events that needs to happen
 boolean equals(java.lang.Object o)
           
protected  java.util.Map<CellID,java.lang.Integer> getIndexMap()
          Get the index map for storing view-to-index mappings.
 com.jme.bounding.BoundingVolume[] getWorldBounds()
          Get the proximity bounds in world coordinates.
 int hashCode()
           
 void setProximityBounds(com.jme.bounding.BoundingVolume[] localBounds)
          Set a list of bounds for which the system will track view enter/exit for this cell.
 void updateWorldBounds(CellTransform worldTransform)
          The cell world bounds have been updated, so update our internal structures
 void viewCellExited(CellID viewCellID)
          The view cell has exited, so exit all bounds
 void viewCellMoved(CellID viewCellID, CellTransform viewCellTransform)
          The view cells transform has changed so update our internal structures
protected  void viewCellMoved(CellID viewCellID, CellTransform viewCellTransform, boolean cleanup)
          The view cells transform has changed so update our internal structures
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final java.util.logging.Logger logger

proximityListener

protected ProximityListenerRecord.ProximityListenerWrapper proximityListener

lastContainerIndexMap

protected java.util.Map<CellID,java.lang.Integer> lastContainerIndexMap

lock

protected final java.io.Serializable lock
Constructor Detail

ProximityListenerRecord

public ProximityListenerRecord()

ProximityListenerRecord

public ProximityListenerRecord(ProximityListenerRecord.ProximityListenerWrapper proximityListener,
                               com.jme.bounding.BoundingVolume[] localBounds)
Method Detail

setProximityBounds

public void setProximityBounds(com.jme.bounding.BoundingVolume[] localBounds)
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]. An IllegalArgumentException will be thrown if this is not the case.

Parameters:
bounds -

getWorldBounds

public com.jme.bounding.BoundingVolume[] getWorldBounds()
Get the proximity bounds in world coordinates.

Returns:
the proximit bounds translated to world coordinates

updateWorldBounds

public void updateWorldBounds(CellTransform worldTransform)
The cell world bounds have been updated, so update our internal structures


viewCellMoved

public void viewCellMoved(CellID viewCellID,
                          CellTransform viewCellTransform)
The view cells transform has changed so update our internal structures

Parameters:
cell -

cleanup

public void cleanup(CellID viewCellID)
Cleanup this record, generating any exit events that needs to happen


viewCellMoved

protected void viewCellMoved(CellID viewCellID,
                             CellTransform viewCellTransform,
                             boolean cleanup)
The view cells transform has changed so update our internal structures

Parameters:
cleanup - in cleanup mode, we are removing the record, so we force an

viewCellExited

public void viewCellExited(CellID viewCellID)
The view cell has exited, so exit all bounds


getIndexMap

protected java.util.Map<CellID,java.lang.Integer> getIndexMap()
Get the index map for storing view-to-index mappings. Subclasses may override to provide a map other than the default.

Returns:
the map from view cell ID to bounds index for all listeners

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Open Wonderland - http://openwonderland.org