edu.umd.cs.jazz
Class ZSpatialIndex

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSpatialIndex
All Implemented Interfaces:
java.io.Serializable

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

ZSpatialIndex is a jazz utility class, supporting ZSpatialIndexGroup. See ZSpatialIndexGroup for details.

Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.

Author:
Ben Bederson
See Also:
ZSpatialIndexGroup, Serialized Form

Nested Class Summary
 class ZSpatialIndex.DrawOrderComp
           
 
Field Summary
protected  ZCamera camera
          Surface this r-tree indexes.
protected  java.util.Hashtable drawOrder
          List of r-tree nodes in draw-order order.
protected  edu.umd.cs.jazz.ZSpatialIndex.RTreeNode root
          Root of the r-tree.
 
Constructor Summary
ZSpatialIndex()
          Constructs a new ZSpatialIndex.
ZSpatialIndex(ZCamera aCamera)
          Constructs a new ZSpatialIndex with the given camera.
 
Method Summary
protected  void add(ZNode obj)
          internal method: Add a node to the rtree index.
 void addNode(ZNode node)
          Add a node to the rtree index.
 void displayTree(java.lang.String tree)
          For debugging, print a depiction of the RTree index tree.
 java.awt.geom.AffineTransform getGroupNodeTransform()
          Return the localToGlobal transform for the ZSpatialIndexGroup node associated with this index.
 int getMaxChildren()
          Get the maximum number of children per node.
 int getMinChildren()
          Get the minimum number of children per node.
 int getNodesSearched()
          Get number of nodes searched for most recent query.
 boolean getStatus()
          Return true if indexing is on, otherwise false.
 void queryPoint(java.util.ArrayList result, java.awt.geom.Point2D pt)
          Return all objects that overlap a point.
 void queryPoint(java.util.ArrayList result, java.awt.geom.Point2D pt, double minSize, double currentMag)
          Return objects larger than a minimum size that overlap a point.
 void queryWindow(java.util.ArrayList result, java.awt.geom.Rectangle2D queryBBox)
          Return all objects that overlap a bounding rectangle.
 void queryWindow(java.util.ArrayList result, java.awt.geom.Rectangle2D queryBBox, double minSize, double currentMag)
          Return all objects larger than a minimum size that overlap a bounding rectangle.
 void reIndex()
          Completely re-index all objects
protected  boolean remove(ZNode obj)
          internal method: Remove an object from the index.
 boolean removeNode(ZNode node)
          Remove an object from the index.
 void setGroupNodeTransform(java.awt.geom.AffineTransform at)
          Set the localToGlobal transform for the ZSpatialIndexGroup node associated with this index.
 void setMaxChildren(int aMaxChildren)
          Set the maximum number of children per node.
 void setMinChildren(int aMinChildren)
          Set the minimum number of children per node.
 void setStatus(boolean aStatus)
          Turn RTree indexing on and off.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

camera

protected ZCamera camera
Surface this r-tree indexes.


root

protected edu.umd.cs.jazz.ZSpatialIndex.RTreeNode root
Root of the r-tree.


drawOrder

protected java.util.Hashtable drawOrder
List of r-tree nodes in draw-order order.

Constructor Detail

ZSpatialIndex

public ZSpatialIndex()
Constructs a new ZSpatialIndex.


ZSpatialIndex

public ZSpatialIndex(ZCamera aCamera)
Constructs a new ZSpatialIndex with the given camera.

Parameters:
aCamera - A camera.
Method Detail

getNodesSearched

public int getNodesSearched()
Get number of nodes searched for most recent query.


setStatus

public void setStatus(boolean aStatus)
Turn RTree indexing on and off.

Parameters:
aStatus - true to turn indexing on, false otherwise.

getStatus

public boolean getStatus()
Return true if indexing is on, otherwise false.

Returns:
status true or false.

setGroupNodeTransform

public void setGroupNodeTransform(java.awt.geom.AffineTransform at)
Set the localToGlobal transform for the ZSpatialIndexGroup node associated with this index.


getGroupNodeTransform

public java.awt.geom.AffineTransform getGroupNodeTransform()
Return the localToGlobal transform for the ZSpatialIndexGroup node associated with this index.


reIndex

public void reIndex()
Completely re-index all objects


addNode

public void addNode(ZNode node)
Add a node to the rtree index.


add

protected void add(ZNode obj)
internal method: Add a node to the rtree index.

Parameters:
obj - the object.

removeNode

public boolean removeNode(ZNode node)
Remove an object from the index. Return true if object was found, and thus removed.


remove

protected boolean remove(ZNode obj)
internal method: Remove an object from the index. Return true if object was found, and thus removed.

Parameters:
obj - the object to be removed.

queryPoint

public void queryPoint(java.util.ArrayList result,
                       java.awt.geom.Point2D pt)
Return all objects that overlap a point. Objects are returned sorted by the order in which they were drawn.

Parameters:
result - the objects found.
pt - the point.

queryPoint

public void queryPoint(java.util.ArrayList result,
                       java.awt.geom.Point2D pt,
                       double minSize,
                       double currentMag)
Return objects larger than a minimum size that overlap a point. Objects are returned sorted by the order in which they were drawn.

Parameters:
result - the objects found.
pt - the point.
minSize - miminum size of the objects to be found.
currentMag - the current magnification.

queryWindow

public void queryWindow(java.util.ArrayList result,
                        java.awt.geom.Rectangle2D queryBBox)
Return all objects that overlap a bounding rectangle. Objects are returned sorted by the order in which they were drawn.

Parameters:
result - the objects found.
queryBBox - the bounding box.

queryWindow

public void queryWindow(java.util.ArrayList result,
                        java.awt.geom.Rectangle2D queryBBox,
                        double minSize,
                        double currentMag)
Return all objects larger than a minimum size that overlap a bounding rectangle.

Parameters:
result - the objects found.
queryBBox - the bounding box.
minSize - miminum size of the objects to be found.
currentMag - the current magnification.

displayTree

public void displayTree(java.lang.String tree)
For debugging, print a depiction of the RTree index tree.

Parameters:
tree - a name for this tree.

getMinChildren

public int getMinChildren()
Get the minimum number of children per node.


getMaxChildren

public int getMaxChildren()
Get the maximum number of children per node.


setMinChildren

public void setMinChildren(int aMinChildren)
Set the minimum number of children per node.

Parameters:
aMinChildren - the minimum number of children.

setMaxChildren

public void setMaxChildren(int aMaxChildren)
Set the maximum number of children per node.

Parameters:
aMaxChildren - the maximum number of children.


Copyright � 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.