public class QuadPrefixTree extends SpatialPrefixTree
SpatialPrefixTree which uses a
quad tree in which an
indexed term will be generated for each cell, 'A', 'B', 'C', 'D'.| Modifier and Type | Class and Description |
|---|---|
static class |
QuadPrefixTree.Factory
Factory for creating
QuadPrefixTree instances with useful defaults |
protected class |
QuadPrefixTree.QuadCell |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_LEVELS |
double |
gridH |
protected double |
gridW |
static int |
MAX_LEVELS_POSSIBLE |
protected boolean |
robust |
protected double |
xmax |
protected double |
xmid |
protected double |
xmin |
protected double |
ymax |
protected double |
ymid |
protected double |
ymin |
ctx, maxLevels| Constructor and Description |
|---|
QuadPrefixTree(org.locationtech.spatial4j.context.SpatialContext ctx) |
QuadPrefixTree(org.locationtech.spatial4j.context.SpatialContext ctx,
int maxLevels) |
QuadPrefixTree(org.locationtech.spatial4j.context.SpatialContext ctx,
org.locationtech.spatial4j.shape.Rectangle bounds,
int maxLevels) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
battenberg(double xmid,
double ymid,
double xp,
double yp)
Returns a Z-Order quadrant [0-3].
|
protected void |
checkBattenbergNotRobustly(char c,
double cx,
double cy,
int level,
List<Cell> matches,
BytesRef str,
org.locationtech.spatial4j.shape.Shape shape,
int maxLevel) |
Cell |
getCell(org.locationtech.spatial4j.shape.Point p,
int level)
Returns the cell containing point
p at the specified level. |
double |
getDistanceForLevel(int level)
Given a cell having the specified level, returns the distance from opposite
corners.
|
int |
getLevelForDistance(double dist)
Returns the level of the largest grid in which its longest side is less
than or equal to the provided distance (in degrees).
|
CellIterator |
getTreeCellIterator(org.locationtech.spatial4j.shape.Shape shape,
int detailLevel)
Gets the intersecting cells for the specified shape, without exceeding
detail level.
|
Cell |
getWorldCell()
Returns the level 0 cell which encompasses all spatial data.
|
void |
printInfo(PrintStream out) |
Cell |
readCell(BytesRef term,
Cell scratch)
This creates a new Cell (or re-using
scratch if provided), initialized to the state as read
by the bytes. |
getMaxLevels, getSpatialContext, toStringpublic static final int MAX_LEVELS_POSSIBLE
public static final int DEFAULT_MAX_LEVELS
protected final double xmin
protected final double xmax
protected final double ymin
protected final double ymax
protected final double xmid
protected final double ymid
protected final double gridW
public final double gridH
protected boolean robust
public QuadPrefixTree(org.locationtech.spatial4j.context.SpatialContext ctx,
org.locationtech.spatial4j.shape.Rectangle bounds,
int maxLevels)
public QuadPrefixTree(org.locationtech.spatial4j.context.SpatialContext ctx)
public QuadPrefixTree(org.locationtech.spatial4j.context.SpatialContext ctx,
int maxLevels)
public Cell getWorldCell()
SpatialPrefixTreeSpatialPrefixTree.readCell(BytesRef,Cell)
with no bytes.getWorldCell in class SpatialPrefixTreepublic void printInfo(PrintStream out)
public int getLevelForDistance(double dist)
SpatialPrefixTreedist acts as an error epsilon declaring the amount of detail needed in the
grid, such that you can get a grid with just the right amount of
precision.getLevelForDistance in class SpatialPrefixTreedist - >= 0public Cell getCell(org.locationtech.spatial4j.shape.Point p, int level)
p at the specified level.protected void checkBattenbergNotRobustly(char c,
double cx,
double cy,
int level,
List<Cell> matches,
BytesRef str,
org.locationtech.spatial4j.shape.Shape shape,
int maxLevel)
protected int battenberg(double xmid,
double ymid,
double xp,
double yp)
public double getDistanceForLevel(int level)
SpatialPrefixTreegetDistanceForLevel in class SpatialPrefixTreelevel - [1 to maxLevels]> 0public Cell readCell(BytesRef term, Cell scratch)
SpatialPrefixTreescratch if provided), initialized to the state as read
by the bytes.
Warning: An implementation may refer to the same byte array (no copy). If Cell.setLeaf() is
subsequently called, it would then modify these bytes.readCell in class SpatialPrefixTreepublic CellIterator getTreeCellIterator(org.locationtech.spatial4j.shape.Shape shape, int detailLevel)
SpatialPrefixTreeIMPORTANT: Cells returned from the iterator can be re-used for cells at the same level. So you can't simply iterate to subsequent cells and still refer to the former cell nor the bytes returned from the former cell, unless you know the former cell is a parent.
getTreeCellIterator in class SpatialPrefixTreeshape - the shape; possibly null but the caller should liberally call
remove() if so.detailLevel - the maximum detail level to get cells forCopyright © 2000-2024 Apache Software Foundation. All Rights Reserved.