|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.util.quadtree.QuadTree<T>
public class QuadTree<T>
The QuadTree lets you organize objects in a grid, that redefines itself and refines the gridding over locations where more objects are gathered.
Field Summary | |
---|---|
protected QuadTreeNode<T> |
top
|
Constructor Summary | |
---|---|
QuadTree()
|
|
QuadTree(double north,
double west,
double south,
double east,
int maxItems)
|
|
QuadTree(double north,
double west,
double south,
double east,
int maxItems,
double minSize)
|
|
QuadTree(int up,
int left,
int down,
int right,
int maxItems)
|
Method Summary | |
---|---|
void |
clear()
Clear the tree. |
T |
get(double lat,
double lon)
Get an object closest to a lat/lon. |
T |
get(double lat,
double lon,
double withinDistance)
Get an object closest to a lat/lon, within a maximum distance. |
java.util.Collection |
get(double north,
double west,
double south,
double east)
Get all the objects within a bounding box. |
java.util.Collection |
get(double north,
double west,
double south,
double east,
java.util.Collection collection)
Get all the objects within a bounding box, and return the objects in the provided Collection. |
boolean |
put(double lat,
double lon,
T obj)
Add a object into the tree at a location. |
T |
remove(double lat,
double lon,
T obj)
Remove a object out of the tree at a location. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected QuadTreeNode<T> top
Constructor Detail |
---|
public QuadTree()
public QuadTree(double north, double west, double south, double east, int maxItems)
public QuadTree(int up, int left, int down, int right, int maxItems)
public QuadTree(double north, double west, double south, double east, int maxItems, double minSize)
Method Detail |
---|
public boolean put(double lat, double lon, T obj)
put
in interface DataOrganizer<T>
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)obj
- the object to insert into the tree
public T remove(double lat, double lon, T obj)
remove
in interface DataOrganizer<T>
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)obj
- the object to remove
public void clear()
clear
in interface DataOrganizer<T>
public T get(double lat, double lon)
get
in interface DataOrganizer<T>
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)
public T get(double lat, double lon, double withinDistance)
get
in interface DataOrganizer<T>
lat
- up-down location in QuadTree Grid (latitude, y)lon
- left-right location in QuadTree Grid (longitude, x)withinDistance
- the maximum distance to get a hit, in decimal
degrees.
public java.util.Collection get(double north, double west, double south, double east)
get
in interface DataOrganizer<T>
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.Collection get(double north, double west, double south, double east, java.util.Collection collection)
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)collection
- a Collection to add objects to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |