public interface Cell
SpatialPrefixTree.getWorldCell()
.
And from there you could either traverse down the tree with getNextLevelCells(org.locationtech.spatial4j.shape.Shape)
,
or you could read an indexed term via SpatialPrefixTree.readCell(org.apache.lucene.util.BytesRef,Cell)
.
When a cell is read from a term, it is comprised of just the base bytes plus optionally a leaf flag.Modifier and Type | Method and Description |
---|---|
int |
compareToNoLeaf(Cell fromCell)
Equivalent to
this.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null)) . |
int |
getLevel()
Level 0 is the world (and has no parent), from then on a higher level means a smaller
cell than the level before it.
|
CellIterator |
getNextLevelCells(org.locationtech.spatial4j.shape.Shape shapeFilter)
Gets the cells at the next grid cell level underneath this one, optionally filtered by
shapeFilter . |
org.locationtech.spatial4j.shape.Shape |
getShape()
Gets the shape for this cell; typically a Rectangle.
|
org.locationtech.spatial4j.shape.SpatialRelation |
getShapeRel()
Gets the relationship this cell has with the shape from which it was filtered from, assuming it came from a
CellIterator . |
BytesRef |
getTokenBytesNoLeaf(BytesRef result)
Returns the bytes for this cell, without a leaf set.
|
BytesRef |
getTokenBytesWithLeaf(BytesRef result)
Returns the bytes for this cell, with a leaf byte if this is a leaf cell.
|
boolean |
isLeaf()
Some cells are flagged as leaves, which are indexed as such.
|
boolean |
isPrefixOf(Cell c)
Returns if the target term is within/underneath this cell; not necessarily a direct
descendant.
|
void |
setLeaf()
Set this cell to be a leaf.
|
void |
setShapeRel(org.locationtech.spatial4j.shape.SpatialRelation rel)
See
getShapeRel() . |
org.locationtech.spatial4j.shape.SpatialRelation getShapeRel()
CellIterator
. Arguably it belongs there but it's very convenient here.void setShapeRel(org.locationtech.spatial4j.shape.SpatialRelation rel)
getShapeRel()
.boolean isLeaf()
void setLeaf()
BytesRef getTokenBytesWithLeaf(BytesRef result)
result
- where the result goes, or null to create newBytesRef getTokenBytesNoLeaf(BytesRef result)
getTokenBytesWithLeaf(org.apache.lucene.util.BytesRef)
.
The result param is used to save object allocation, though its bytes aren't used.result
- where the result goes, or null to create newint getLevel()
CellIterator getNextLevelCells(org.locationtech.spatial4j.shape.Shape shapeFilter)
shapeFilter
. The returned cells should have getShapeRel()
set to
their relation with shapeFilter
. In addition, for non-points isLeaf()
must be true when that relation is WITHIN.
IMPORTANT: Cells returned from this iterator can be shared, as well as the bytes.
Precondition: Never called when getLevel() == maxLevel.
shapeFilter
- an optional filter for the returned cells.org.locationtech.spatial4j.shape.Shape getShape()
boolean isPrefixOf(Cell c)
c
- the termint compareToNoLeaf(Cell fromCell)
this.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null))
.Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.