T
- the data type stored in the PRTreepublic class PRTree<T> extends Object
Constructor and Description |
---|
PRTree(MBRConverter<T> converter,
int branchFactor)
Create a new PRTree using the specified branch factor.
|
Modifier and Type | Method and Description |
---|---|
Iterable<T> |
find(double xmin,
double ymin,
double xmax,
double ymax)
Find all objects that intersect the given rectangle.
|
void |
find(double xmin,
double ymin,
double xmax,
double ymax,
List<T> resultNodes)
Finds all objects that intersect the given rectangle and stores
the found node in the given list.
|
void |
find(double xmin,
double ymin,
double xmax,
double ymax,
List<T> resultNodes,
NodeFilter<T> filter)
Finds all objects that intersect the given rectangle and stores
the found node in the given list.
|
Iterable<T> |
find(double xmin,
double ymin,
double xmax,
double ymax,
NodeFilter<T> filter)
Find all objects that intersect the given rectangle.
|
Iterable<T> |
find(MBR query)
Find all objects that intersect the given rectangle.
|
void |
find(MBR query,
List<T> resultNodes)
Finds all objects that intersect the given rectangle and stores
the found node in the given list.
|
void |
find(MBR query,
List<T> resultNodes,
NodeFilter<T> filter)
Finds all objects that intersect the given rectangle and stores
the found node in the given list.
|
Iterable<T> |
find(MBR query,
NodeFilter<T> filter)
Find all objects that intersect the given rectangle.
|
int |
getHeight()
Get the height of this tree.
|
MBR |
getMBR()
Get an N dimensional minimum bounding box of the data stored
in this tree.
|
MBR2D |
getMBR2D()
Get a 2 dimensional minimum bounding rectangle of the data
stored in this tree.
|
int |
getNumberOfLeaves()
Get the number of data leafs in this tree.
|
boolean |
isEmpty()
Check if this tree is empty
|
void |
load(Collection<? extends T> data)
Bulk load data into this tree.
|
List<DistanceResult<T>> |
nearestNeighbour(DistanceCalculator<T> dc,
NodeFilter<T> filter,
int maxHits,
PointND p)
Get the nearest neighbour of the given point
|
public PRTree(MBRConverter<T> converter, int branchFactor)
converter
- the MBRConverter to use for this treebranchFactor
- the number of child nodes for each internal node.public void load(Collection<? extends T> data)
data
- the collection of data to store in the tree.IllegalStateException
- if the tree is already loadedpublic MBR2D getMBR2D()
public MBR getMBR()
public int getNumberOfLeaves()
public boolean isEmpty()
public int getHeight()
public void find(double xmin, double ymin, double xmax, double ymax, List<T> resultNodes)
xmin
- the minimum value of the x coordinate when searchingymin
- the minimum value of the y coordinate when searchingxmax
- the maximum value of the x coordinate when searchingymax
- the maximum value of the y coordinate when searchingresultNodes
- the list that will be filled with the resultpublic void find(double xmin, double ymin, double xmax, double ymax, List<T> resultNodes, NodeFilter<T> filter)
xmin
- the minimum value of the x coordinate when searchingymin
- the minimum value of the y coordinate when searchingxmax
- the maximum value of the x coordinate when searchingymax
- the maximum value of the y coordinate when searchingresultNodes
- the list that will be filled with the resultfilter
- a secondary filter to applypublic void find(MBR query, List<T> resultNodes)
query
- the bounds of the queryresultNodes
- the list that will be filled with the resultpublic void find(MBR query, List<T> resultNodes, NodeFilter<T> filter)
query
- the bounds of the queryresultNodes
- the list that will be filled with the resultfilter
- a secondary filter to apply to the found nodespublic Iterable<T> find(double xmin, double ymin, double xmax, double ymax)
xmin
- the minimum value of the x coordinate when searchingymin
- the minimum value of the y coordinate when searchingxmax
- the maximum value of the x coordinate when searchingymax
- the maximum value of the y coordinate when searchingIllegalArgumentException
- if xmin > xmax or ymin > ymaxpublic Iterable<T> find(double xmin, double ymin, double xmax, double ymax, NodeFilter<T> filter)
xmin
- the minimum value of the x coordinate when searchingymin
- the minimum value of the y coordinate when searchingxmax
- the maximum value of the x coordinate when searchingymax
- the maximum value of the y coordinate when searchingfilter
- a secondary filter to apply to the found nodesIllegalArgumentException
- if xmin > xmax or ymin > ymaxpublic Iterable<T> find(MBR query)
query
- the bounds of the queryIllegalArgumentException
- if xmin > xmax or ymin > ymaxpublic Iterable<T> find(MBR query, NodeFilter<T> filter)
query
- the bounds of the queryfilter
- a secondary filter to apply to the found nodesIllegalArgumentException
- if xmin > xmax or ymin > ymaxpublic List<DistanceResult<T>> nearestNeighbour(DistanceCalculator<T> dc, NodeFilter<T> filter, int maxHits, PointND p)
dc
- the DistanceCalculator to use.filter
- a NodeFilter that can be used to ignore some leaf nodes.maxHits
- the maximum number of entries to find.p
- the point to find the nearest neighbour to.