Class S2ShapeIndex.Cell
java.lang.Object
com.google.common.geometry.S2ShapeIndex.Cell
- All Implemented Interfaces:
S2Iterator.Entry, Serializable
- Direct Known Subclasses:
S2ShapeIndex.S2ClippedShape
- Enclosing class:
S2ShapeIndex
public abstract static class S2ShapeIndex.Cell
extends Object
implements S2Iterator.Entry, Serializable
This class contains the set of clipped shapes within a particular index cell, sorted in
increasing order of shape id.
To be as memory efficient as possible, we specialize two very common cases.
- The Cell class is extended by S2ClippedShape, and in the *very* common case of a cell
containing just one clipped shape, we return the shape directly without wrapping it (this
requires that the clipped shapes contain the cell IDs, rather than the Cell; more about
that on
S2ShapeIndex.S2ClippedShape.) - In the fairly common case of a cell intersecting two shapes, we have a BinaryCell implementation that is half the size of the general purpose MultiCell in that case.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract S2ShapeIndex.S2ClippedShapeclipped(int i) Returns the clipped shape at the given index.longid()Returns the cell ID of this cell as a primitive.abstract intReturns the number of clipped shapes in this cell.
-
Constructor Details
-
Cell
public Cell()
-
-
Method Details
-
id
public long id()Description copied from interface:S2Iterator.EntryReturns the cell ID of this cell as a primitive.- Specified by:
idin interfaceS2Iterator.Entry
-
numShapes
public abstract int numShapes()Returns the number of clipped shapes in this cell. -
clipped
Returns the clipped shape at the given index.- Parameters:
i- must be at least 0 and less thannumShapes()
-