Class Cell
Represents a grid cell. These are not necessarily thread-safe, although new Cell("") (world cell) must be.
Note
This API is experimental and might change in incompatible ways in the next release.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Spatial.Prefix.Tree
Assembly: Lucene.Net.Spatial.dll
Syntax
public abstract class Cell : IComparable<Cell>
Constructors
| Improve this Doc View SourceCell(SpatialPrefixTree, Byte[], Int32, Int32)
Initializes a new instance of Cell for the
spatialPrefixTree
with the specified bytes
, offset
and length
.
Declaration
protected Cell(SpatialPrefixTree spatialPrefixTree, byte[] bytes, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
SpatialPrefixTree | spatialPrefixTree | The SpatialPrefixTree this instance belongs to. |
System.Byte[] | bytes | The representation of this Cell. |
System.Int32 | offset | The offset into |
System.Int32 | length | The count of |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Cell(SpatialPrefixTree, String)
Initializes a new instance of Cell for the
spatialPrefixTree
with the specified token
.
Declaration
protected Cell(SpatialPrefixTree spatialPrefixTree, string token)
Parameters
Type | Name | Description |
---|---|---|
SpatialPrefixTree | spatialPrefixTree | The SpatialPrefixTree this instance belongs to. |
System.String | token | The string representation of this Cell. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Fields
| Improve this Doc View SourceLEAF_BYTE
Declaration
public const byte LEAF_BYTE = 43
Field Value
Type | Description |
---|---|
System.Byte |
m_leaf
Always false for points.
Declaration
protected bool m_leaf
Field Value
Type | Description |
---|---|
System.Boolean |
Remarks
Always false for points. Otherwise, indicate no further sub-cells are going to be provided because shapeRel is WITHIN or maxLevels or a detailLevel is hit.
m_shapeRel
When set via GetSubCells(IShape), it is the relationship between this cell and the given shape filter.
Declaration
protected SpatialRelation m_shapeRel
Field Value
Type | Description |
---|---|
Spatial4n.Shapes.SpatialRelation |
m_spatialPrefixTree
LUCENENET specific - we need to set the SpatialPrefixTree before calling overridden members of this class, just in case those overridden members require it. This is not possible from the subclass because the constructor of the base class runs first. So we need to move the reference here and also set it before running the normal constructor logic.
Declaration
protected readonly SpatialPrefixTree m_spatialPrefixTree
Field Value
Type | Description |
---|---|
SpatialPrefixTree |
Properties
| Improve this Doc View SourceCenter
Declaration
public virtual IPoint Center { get; }
Property Value
Type | Description |
---|---|
Spatial4n.Shapes.IPoint |
IsLeaf
For points, this is always false.
Declaration
public virtual bool IsLeaf { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
For points, this is always false. Otherwise this is true if there are no further cells with this prefix for the shape (always true at maxLevels).
Level
Declaration
public virtual int Level { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Shape
Declaration
public abstract IShape Shape { get; }
Property Value
Type | Description |
---|---|
Spatial4n.Shapes.IShape |
ShapeRel
Declaration
public virtual SpatialRelation ShapeRel { get; }
Property Value
Type | Description |
---|---|
Spatial4n.Shapes.SpatialRelation |
SubCellsSize
GetSubCells().Count -- usually a constant. Should be >=2
Declaration
public abstract int SubCellsSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TokenString
Note: doesn't contain a trailing leaf byte.
Declaration
public virtual string TokenString { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceCompareTo(Cell)
Declaration
public virtual int CompareTo(Cell other)
Parameters
Type | Name | Description |
---|---|---|
Cell | other |
Returns
Type | Description |
---|---|
System.Int32 |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
GetSubCell(IPoint)
Performant implementations are expected to implement this efficiently by considering the current cell's boundary.
Declaration
public abstract Cell GetSubCell(IPoint p)
Parameters
Type | Name | Description |
---|---|---|
Spatial4n.Shapes.IPoint | p |
Returns
Type | Description |
---|---|
Cell |
Remarks
Performant implementations are expected to implement this efficiently by considering the current cell's boundary. Precondition: Never called when Level == maxLevel.
Precondition: this.Shape.Relate(p) != SpatialRelation.DISJOINT.
GetSubCells()
Gets the cells at the next grid cell level that cover this cell.
Declaration
protected abstract ICollection<Cell> GetSubCells()
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<Cell> | A set of cells (no dups), sorted, modifiable, not empty, not null. |
Remarks
Gets the cells at the next grid cell level that cover this cell. Precondition: Never called when Level == maxLevel.
GetSubCells(IShape)
Like GetSubCells() but with the results filtered by a shape. If
that shape is a Spatial4n.Shapes.IPoint then it must call
GetSubCell(IPoint). The returned cells
should have ShapeRel set to their relation with
shapeFilter
. In addition, IsLeaf
must be true when that relation is Spatial4n.Shapes.SpatialRelation.WITHIN.
Precondition: Never called when Level == maxLevel.
Declaration
public virtual ICollection<Cell> GetSubCells(IShape shapeFilter)
Parameters
Type | Name | Description |
---|---|---|
Spatial4n.Shapes.IShape | shapeFilter | an optional filter for the returned cells. |
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<Cell> | A set of cells (no dups), sorted. Not Modifiable. |
GetTokenBytes()
Note: doesn't contain a trailing leaf byte.
Declaration
public virtual byte[] GetTokenBytes()
Returns
Type | Description |
---|---|
System.Byte[] |
Reset(Byte[], Int32, Int32)
Declaration
public virtual void Reset(byte[] bytes, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | |
System.Int32 | offset | |
System.Int32 | length |
SetLeaf()
Note: not supported at level 0.
Declaration
public virtual void SetLeaf()
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |