|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bbn.openmap.util.quadtree.QuadTreeNode
The QuadTreeNode is the part of the QuadTree that either holds children nodes, or objects as leaves. Currently, the nodes that have children do not hold items that span across children boundaries, since this was designed to handle point data.
Field Summary | |
protected boolean |
allTheSamePoint
Added to avoid problems when a node is completely filled with a single point value. |
QuadTreeRect |
bounds
|
protected QuadTreeNode[] |
children
|
static float |
DEFAULT_MIN_SIZE
|
protected float |
firstLat
|
protected float |
firstLon
|
protected java.util.Vector |
items
|
protected int |
maxItems
|
protected float |
minSize
|
static float |
NO_MIN_SIZE
|
static int |
NORTHEAST
|
static int |
NORTHWEST
|
static int |
SOUTHEAST
|
static int |
SOUTHWEST
|
Constructor Summary | |
QuadTreeNode(float north,
float west,
float south,
float east,
int maximumItems)
Constructor to use if you are going to store the objects in lat/lon space, and there is really no smallest node size. |
|
QuadTreeNode(float north,
float west,
float south,
float east,
int maximumItems,
float minimumSize)
Constructor to use if you are going to store the objects in x/y space, and there is a smallest node size because you don't want the nodes to be smaller than a group of pixels. |
Method Summary | |
void |
clear()
Clear the tree below this node. |
java.lang.Object |
get(float lat,
float lon)
Get an object closest to a lat/lon. |
java.lang.Object |
get(float lat,
float lon,
double withinDistance)
Get an object closest to a lat/lon. |
java.util.Vector |
get(float north,
float west,
float south,
float east)
Get all the objects within a bounding box. |
java.util.Vector |
get(float north,
float west,
float south,
float east,
java.util.Vector vector)
Get all the objects within a bounding box. |
java.lang.Object |
get(float lat,
float lon,
MutableDistance bestDistance)
Get an object closest to a lat/lon. |
java.util.Vector |
get(QuadTreeRect rect,
java.util.Vector vector)
Get all the objects within a bounding box. |
protected QuadTreeNode |
getChild(float lat,
float lon)
Get the node that covers a certain lat/lon pair. |
boolean |
hasChildren()
Return true if the node has children. |
boolean |
put(float lat,
float lon,
java.lang.Object obj)
Add a object into the tree at a location. |
boolean |
put(QuadTreeLeaf leaf)
Add a QuadTreeLeaf into the tree at a location. |
java.lang.Object |
remove(float lat,
float lon,
java.lang.Object obj)
Remove a object out of the tree at a location. |
java.lang.Object |
remove(QuadTreeLeaf leaf)
Remove a QuadTreeLeaf out of the tree at a location. |
protected void |
split()
This method splits the node into four children, and disperses the items into the children. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NORTHWEST
public static final int NORTHEAST
public static final int SOUTHEAST
public static final int SOUTHWEST
public static final float NO_MIN_SIZE
public static final float DEFAULT_MIN_SIZE
protected java.util.Vector items
protected QuadTreeNode[] children
protected int maxItems
protected float minSize
public QuadTreeRect bounds
protected boolean allTheSamePoint
protected float firstLat
protected float firstLon
Constructor Detail |
public QuadTreeNode(float north, float west, float south, float east, int maximumItems)
north
- northern border of node coverage.west
- western border of node coverage.south
- southern border of node coverage.east
- eastern border of node coverage.maximumItems
- number of items to hold in a node before
splitting itself into four children and redispensing the
items into them.public QuadTreeNode(float north, float west, float south, float east, int maximumItems, float minimumSize)
north
- northern border of node coverage.west
- western border of node coverage.south
- southern border of node coverage.east
- eastern border of node coverage.maximumItems
- number of items to hold in a node before
splitting itself into four children and redispensing the
items into them.minimumSize
- the minimum difference between the
boundaries of the node.Method Detail |
public boolean hasChildren()
protected void split()
protected QuadTreeNode getChild(float lat, float lon)
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)
public boolean put(float lat, float lon, java.lang.Object obj)
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)obj
- object to add to the tree.
public boolean put(QuadTreeLeaf leaf)
leaf
- object-location composite
public java.lang.Object remove(float lat, float lon, java.lang.Object obj)
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)
public java.lang.Object remove(QuadTreeLeaf leaf)
leaf
- object-location composite
public void clear()
public java.lang.Object get(float lat, float lon)
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)
public java.lang.Object get(float lat, float lon, double withinDistance)
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)withinDistance
- maximum get distance.
public java.lang.Object get(float lat, float lon, MutableDistance bestDistance)
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)bestDistance
- the closest distance of the object found so
far.
public java.util.Vector get(float north, float west, float south, float east)
north
- top location in QuadTree Grid (latitude, y)west
- left location in QuadTree Grid (longitude, x)south
- lower location in QuadTree Grid (latitude, y)east
- right location in QuadTree Grid (longitude, x)
public java.util.Vector get(float north, float west, float south, float east, java.util.Vector vector)
north
- top location in QuadTree Grid (latitude, y)west
- left location in QuadTree Grid (longitude, x)south
- lower location in QuadTree Grid (latitude, y)east
- right location in QuadTree Grid (longitude, x)vector
- current vector of objects.
public java.util.Vector get(QuadTreeRect rect, java.util.Vector vector)
rect
- boundary of area to fill.vector
- current vector of objects.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |