C# Class Lucene.Net.Spatial.Prefix.Tree.SpatialPrefixTree

A Spatial Prefix Tree, or Trie, which decomposes shapes into prefixed strings at variable lengths corresponding to variable precision. Each string corresponds to a spatial region. Implementations of this class should be thread-safe and immutable once initialized.
ファイルを表示 Open project: apache/lucenenet Class Usage Examples

Protected Properties

Property Type Description
ctx Spatial4n.Core.Context.SpatialContext
maxLevels int

Public Methods

Method Description
GetCell ( byte bytes, int offset, int len ) : Cell
GetCell ( byte bytes, int offset, int len, Cell target ) : Cell
GetCell ( string token ) : Cell

The cell for the specified token.

The cell for the specified token. The empty string should be equal to WorldCell. Precondition: Never called when token length > maxLevel.

GetCells ( IPoint p, int detailLevel, bool inclParents ) : IList

A Point-optimized implementation of GetCells(Shape, int, bool, bool). That method in facts calls this for points. This implementation depends on GetCell(string) being fast, as its called repeatedly when incPlarents is true.

GetCells ( IShape shape, int detailLevel, bool inclParents, bool simplify ) : IList

Gets the intersecting cells for the specified shape, without exceeding detail level.

Gets the intersecting cells for the specified shape, without exceeding detail level. If a cell is within the query shape then it's marked as a leaf and none of its children are added. This implementation checks if shape is a IPoint and if so returns GetCells(Point, int, bool).

GetDistanceForLevel ( int level ) : double

Given a cell having the specified level, returns the distance from opposite corners.

Given a cell having the specified level, returns the distance from opposite corners. Since this might very depending on where the cell is, this method may over-estimate.

GetLevelForDistance ( double dist ) : int

Returns the level of the largest grid in which its longest side is less than or equal to the provided distance (in degrees).

Returns the level of the largest grid in which its longest side is less than or equal to the provided distance (in degrees). Consequently dist 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.

SpatialPrefixTree ( SpatialContext ctx, int maxLevels ) : Spatial4n.Core.Context
ToString ( ) : string

Protected Methods

Method Description
GetCell ( IPoint p, int level ) : Cell

Returns the cell containing point p at the specified level.

Private Methods

Method Description
CellsToTokenStrings ( ICollection cells ) : IList
RecursiveGetCells ( Cell cell, IShape shape, int detailLevel, bool inclParents, bool simplify, IList result ) : bool

Returns true if cell was added as a leaf.

Returns true if cell was added as a leaf. If it wasn't it recursively descends.

Method Details

GetCell() protected method

Returns the cell containing point p at the specified level.
protected GetCell ( IPoint p, int level ) : Cell
p IPoint
level int
return Cell

GetCell() public abstract method

public abstract GetCell ( byte bytes, int offset, int len ) : Cell
bytes byte
offset int
len int
return Cell

GetCell() public method

public GetCell ( byte bytes, int offset, int len, Cell target ) : Cell
bytes byte
offset int
len int
target Cell
return Cell

GetCell() public abstract method

The cell for the specified token.
The cell for the specified token. The empty string should be equal to WorldCell. Precondition: Never called when token length > maxLevel.
public abstract GetCell ( string token ) : Cell
token string
return Cell

GetCells() public method

A Point-optimized implementation of GetCells(Shape, int, bool, bool). That method in facts calls this for points. This implementation depends on GetCell(string) being fast, as its called repeatedly when incPlarents is true.
public GetCells ( IPoint p, int detailLevel, bool inclParents ) : IList
p IPoint
detailLevel int
inclParents bool
return IList

GetCells() public method

Gets the intersecting cells for the specified shape, without exceeding detail level.
Gets the intersecting cells for the specified shape, without exceeding detail level. If a cell is within the query shape then it's marked as a leaf and none of its children are added. This implementation checks if shape is a IPoint and if so returns GetCells(Point, int, bool).
public GetCells ( IShape shape, int detailLevel, bool inclParents, bool simplify ) : IList
shape IShape the shape; non-null
detailLevel int the maximum detail level to get cells for
inclParents bool /// if true then all parent cells of leaves are returned /// too. The top world cell is never returned. ///
simplify bool /// for non-point shapes, this will simply/aggregate sets of /// complete leaves in a cell to its parent, resulting in /// ~20-25% fewer cells. ///
return IList

GetDistanceForLevel() public method

Given a cell having the specified level, returns the distance from opposite corners.
Given a cell having the specified level, returns the distance from opposite corners. Since this might very depending on where the cell is, this method may over-estimate.
public GetDistanceForLevel ( int level ) : double
level int [1 to maxLevels]
return double

GetLevelForDistance() public abstract method

Returns the level of the largest grid in which its longest side is less than or equal to the provided distance (in degrees).
Returns the level of the largest grid in which its longest side is less than or equal to the provided distance (in degrees). Consequently dist 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.
public abstract GetLevelForDistance ( double dist ) : int
dist double >= 0
return int

SpatialPrefixTree() public method

public SpatialPrefixTree ( SpatialContext ctx, int maxLevels ) : Spatial4n.Core.Context
ctx Spatial4n.Core.Context.SpatialContext
maxLevels int
return Spatial4n.Core.Context

ToString() public method

public ToString ( ) : string
return string

Property Details

ctx protected_oe property

protected SpatialContext,Spatial4n.Core.Context ctx
return Spatial4n.Core.Context.SpatialContext

maxLevels protected_oe property

protected int maxLevels
return int