com.vividsolutions.jts.index.quadtree

Class NodeBase

Known Direct Subclasses:
Node, Root

public abstract class NodeBase
extends java.lang.Object

The base class for nodes in a Quadtree.
Version:
1.7

Field Summary

protected List
items
protected Node[]
subnode
subquads are numbered as follows:
  2 | 3
  --+--
  0 | 1
 

Constructor Summary

NodeBase()

Method Summary

void
add(Object item)
List
addAllItems(List resultItems)
void
addAllItemsFromOverlapping(Envelope searchEnv, List resultItems)
List
getItems()
static int
getSubnodeIndex(Envelope env, Coordinate centre)
Returns the index of the subquad that wholly contains the given envelope.
boolean
hasChildren()
boolean
hasItems()
boolean
isEmpty()
boolean
isPrunable()
protected abstract boolean
isSearchMatch(Envelope searchEnv)
boolean
remove(Envelope itemEnv, Object item)
Removes a single item from this subtree.
void
visit(Envelope searchEnv, ItemVisitor visitor)

Field Details

items

protected List items

subnode

protected Node[] subnode
subquads are numbered as follows:
  2 | 3
  --+--
  0 | 1
 

Constructor Details

NodeBase

public NodeBase()

Method Details

add

public void add(Object item)

addAllItems

public List addAllItems(List resultItems)

addAllItemsFromOverlapping

public void addAllItemsFromOverlapping(Envelope searchEnv,
                                       List resultItems)

getItems

public List getItems()

getSubnodeIndex

public static int getSubnodeIndex(Envelope env,
                                  Coordinate centre)
Returns the index of the subquad that wholly contains the given envelope. If none does, returns -1.

hasChildren

public boolean hasChildren()

hasItems

public boolean hasItems()

isEmpty

public boolean isEmpty()

isPrunable

public boolean isPrunable()

isSearchMatch

protected abstract boolean isSearchMatch(Envelope searchEnv)

remove

public boolean remove(Envelope itemEnv,
                      Object item)
Removes a single item from this subtree.
Parameters:
item - the item to remove
Returns:
true if the item was found and removed

visit

public void visit(Envelope searchEnv,
                  ItemVisitor visitor)