spatial
Class NearestNeighborQuery

java.lang.Object
  |
  +--index.Query
        |
        +--spatial.NearestNeighborQuery

public class NearestNeighborQuery
extends Query

Nearest neighbor query for search trees


Field Summary
static int ALLLAYERS
          all layers.
static int ALLSCALES
          all scales.
protected  double bestDist
          the distance of the nearest object until now.
protected  SpatialSearchTreeObject bestObject
          nearest object until now.
protected  int[] index
          the actual serach indices for the different heights of the tree.
protected  int layer
          layer.
protected static int MAXHEIGHT
          maximum allowed height of the subtree.
protected  SpatialSearchTreeNode[] node
          the actual nodes from the different heights of the tree.
protected  int operation
          remove mode.
protected  int pathLength
          length of the path.
protected  int[] point
          coordinates of query point.
static int QUERY
          normal query.
protected  int scale
          scale, required for testing the visibility
protected  double tolerance
          tolerance.
protected  SpatialSearchTreeObject typeObject
          object for type selection.
protected  SpatialSearchTreeObject unequal
          new rectangle for move.
 
Fields inherited from class index.Query
queryNum, REMOVEALL, REMOVEEXACT, resultNum, timer, UPDATEALL, UPDATEEXACT
 
Constructor Summary
NearestNeighborQuery()
          Nearest Neighbor query constructor.
 
Method Summary
 SpatialSearchTreeObject getNearestObject()
          Returns the next object fulfilling the query condition.
protected  void getNextObject(int actHeight)
          Returns (or removes or moves) the next object(s) fulfilling the query condition.
 void initWithPoint(SpatialSearchTree tree, int[] point)
          Initializes a new query point.
 void initWithPoint(SpatialSearchTree tree, int[] point, int scale, int tolerance, int layer, SpatialSearchTreeObject typeObject)
          Initializes a new query point.
 void initWithPoint(SpatialSearchTree tree, int[] point, int scale, int layer, SpatialSearchTreeObject typeObject, int operation, SpatialSearchTreeObject unequal)
          Initializes a new query point.
protected  void reset()
          Resets the query.
 
Methods inherited from class index.Query
getQueryNum, getQueryTime, getResultNum, resetCounters, setCounters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLLAYERS

public static final int ALLLAYERS
all layers.

See Also:
Constant Field Values

ALLSCALES

public static final int ALLSCALES
all scales.

See Also:
Constant Field Values

QUERY

public static final int QUERY
normal query.

See Also:
Constant Field Values

point

protected int[] point
coordinates of query point.


tolerance

protected double tolerance
tolerance.


scale

protected int scale
scale, required for testing the visibility


layer

protected int layer
layer.


operation

protected int operation
remove mode.


unequal

protected SpatialSearchTreeObject unequal
new rectangle for move.


typeObject

protected SpatialSearchTreeObject typeObject
object for type selection.


bestObject

protected SpatialSearchTreeObject bestObject
nearest object until now.


bestDist

protected double bestDist
the distance of the nearest object until now.


MAXHEIGHT

protected static final int MAXHEIGHT
maximum allowed height of the subtree.

See Also:
Constant Field Values

node

protected SpatialSearchTreeNode[] node
the actual nodes from the different heights of the tree.


index

protected int[] index
the actual serach indices for the different heights of the tree.


pathLength

protected int pathLength
length of the path.

Constructor Detail

NearestNeighborQuery

public NearestNeighborQuery()
Nearest Neighbor query constructor.

Method Detail

getNearestObject

public SpatialSearchTreeObject getNearestObject()
Returns the next object fulfilling the query condition. Will return null if no object is found.

Returns:
the found object

getNextObject

protected void getNextObject(int actHeight)
Returns (or removes or moves) the next object(s) fulfilling the query condition. Will return null if no object is found.

Parameters:
actHeight - actual height
Returns:
the found object

initWithPoint

public void initWithPoint(SpatialSearchTree tree,
                          int[] point)
Initializes a new query point.

Parameters:
tree - the searchtree
point - coordinates of the query point

initWithPoint

public void initWithPoint(SpatialSearchTree tree,
                          int[] point,
                          int scale,
                          int tolerance,
                          int layer,
                          SpatialSearchTreeObject typeObject)
Initializes a new query point.

Parameters:
tree - the searchtree
point - coordinates of the query point
scale - scale
tolerance - tolerance
layer - layer

initWithPoint

public void initWithPoint(SpatialSearchTree tree,
                          int[] point,
                          int scale,
                          int layer,
                          SpatialSearchTreeObject typeObject,
                          int operation,
                          SpatialSearchTreeObject unequal)
Initializes a new query point.

Parameters:
tree - the searchtree
point - coordinates of the query point
scale - scale
layer - layer
operation - operation
unequal - unequal object

reset

protected void reset()
Resets the query.