Package com.google.common.geometry
Class S2ShapeIndexCoder.EncodedS2ShapeIndex
java.lang.Object
com.google.common.geometry.S2ShapeIndex
com.google.common.geometry.S2ShapeIndexCoder.EncodedS2ShapeIndex
- All Implemented Interfaces:
Serializable
- Enclosing class:
S2ShapeIndexCoder
Represents an encoded
S2ShapeIndex.
This class is thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classA lazy implementation ofS2ShapeIndex.Cellwhich decodes members on demand.Nested classes/interfaces inherited from class com.google.common.geometry.S2ShapeIndex
S2ShapeIndex.Cell, S2ShapeIndex.CellRelation, S2ShapeIndex.InteriorTracker, S2ShapeIndex.Options, S2ShapeIndex.RangeIterator, S2ShapeIndex.S2ClippedShape -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final S2Shape[]The array of not-yet-decoded and decoded shapes.private final S2Coder<S2ShapeIndex.S2ClippedShape[]> A coder ofS2ClippedShape[]s.private final List<S2ShapeIndex.Cell> The list ofS2ShapeIndex.Cells.private final S2CellIdVectorThe encoded vector of cell IDs of this index.private final List<S2ShapeIndex.S2ClippedShape[]> The encoded cells of this index.private final S2ShapeIndex.OptionsThe decoded options of this index.private static final S2ShapeInternal representation of an undecoded shape, which must be distinguished from a null shape.Fields inherited from class com.google.common.geometry.S2ShapeIndex
CELL_PADDING, CURRENT_ENCODING_VERSION, DEFAULT_CELL_SIZE_TO_LONG_EDGE_RATIO, DEFAULT_MAX_EDGES_PER_CELL, MIN_SHORT_EDGE_FRACTION, shapes -
Constructor Summary
ConstructorsConstructorDescriptionEncodedS2ShapeIndex(PrimitiveArrays.Bytes data, PrimitiveArrays.Cursor cursor, List<S2Shape> shapeFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given shape to this index.(package private) voidEnsures pending updates have been applied, returning immediately if the index is fresh as reported byS2ShapeIndex.isFresh(), and otherwise blocking while the index is built.booleanisFresh()Returns true if there are no pending updates that need to be applied.iterator()Returns a new iterator over the cells of this index, positioned at the first cell in the index, after initializing any pending updates.options()Returns the options used for this index.voidCurrently not implemented.voidreset()Clears the contents of the index and resets it to its original state.Methods inherited from class com.google.common.geometry.S2ShapeIndex
createList, getEdgeMaxLevel, getShapes, makeIndexCell
-
Field Details
-
UNDECODED_SHAPE
Internal representation of an undecoded shape, which must be distinguished from a null shape. -
options
The decoded options of this index. -
cachedShapes
The array of not-yet-decoded and decoded shapes. The default value isUNDECODED_SHAPE. A value ofnullrepresents a null shape. -
encodedCellIds
The encoded vector of cell IDs of this index. -
encodedCells
The encoded cells of this index. -
decodedCells
The list ofS2ShapeIndex.Cells. -
clippedShapeArrayCoder
A coder ofS2ClippedShape[]s.
-
-
Constructor Details
-
EncodedS2ShapeIndex
EncodedS2ShapeIndex(PrimitiveArrays.Bytes data, PrimitiveArrays.Cursor cursor, List<S2Shape> shapeFactory) Initializes anS2ShapeIndexCoder.EncodedS2ShapeIndexbacked bydataatoffset.Values are decoded only when they are accessed. This allows for very fast initialization and little additional memory use beyond the encoded data.
-
-
Method Details
-
options
Description copied from class:S2ShapeIndexReturns the options used for this index.- Overrides:
optionsin classS2ShapeIndex
-
add
Description copied from class:S2ShapeIndexAdds the given shape to this index. Invalidates all iterators and their associated data.- Overrides:
addin classS2ShapeIndex
-
remove
Description copied from class:S2ShapeIndexCurrently not implemented. Will eventually remove the given shape from the index, and invalidate all iterators and their associated data.- Overrides:
removein classS2ShapeIndex- Parameters:
shape- the shape to remove
-
reset
public void reset()Description copied from class:S2ShapeIndexClears the contents of the index and resets it to its original state.- Overrides:
resetin classS2ShapeIndex
-
iterator
Description copied from class:S2ShapeIndexReturns a new iterator over the cells of this index, positioned at the first cell in the index, after initializing any pending updates.- Overrides:
iteratorin classS2ShapeIndex
-
isFresh
public boolean isFresh()Description copied from class:S2ShapeIndexReturns true if there are no pending updates that need to be applied. This can be useful to avoid building the index unnecessarily, or for choosing between two different algorithms depending on whether the index is available.- Overrides:
isFreshin classS2ShapeIndex
-
applyUpdates
void applyUpdates()Description copied from class:S2ShapeIndexEnsures pending updates have been applied, returning immediately if the index is fresh as reported byS2ShapeIndex.isFresh(), and otherwise blocking while the index is built.This operation is thread safe, guarded by 'this'.
- Overrides:
applyUpdatesin classS2ShapeIndex
-