Package com.google.common.geometry
Class S2TaggedShapeCoder
java.lang.Object
com.google.common.geometry.S2TaggedShapeCoder
@GwtIncompatible("S2LaxPolylineShape and S2LaxPolygonShape")
public class S2TaggedShapeCoder
extends Object
implements S2Coder<S2Shape>
An encoder/decoder of tagged
S2Shape
s.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A builder for creatingS2TaggedShapeCoder
instances. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IdentityHashMap
<Class<? extends S2Shape>, Integer> static final S2TaggedShapeCoder
An instance of aS2TaggedShapeCoder
which encodes/decodesS2Shape
s in the COMPACT encoding format.private static final S2Coder
<S2Polygon.Shape> static final S2TaggedShapeCoder
An instance of aS2TaggedShapeCoder
which encodes/decodesS2Shape
s in the FAST encoding format.private static final S2Coder
<S2Polygon.Shape> private static final S2Coder
<S2Polyline> private static final com.google.common.collect.ImmutableList
<Class<? extends S2LaxPolygonShape>> private static final int
private static final com.google.common.collect.ImmutableList
<Class<? extends S2LaxPolylineShape>> private static final int
private static final com.google.common.collect.ImmutableList
<Class<? extends S2Point.Shape>> private static final int
private static final com.google.common.collect.ImmutableList
<Class<? extends S2Polygon.Shape>> private static final int
private static final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
S2TaggedShapeCoder
(IdentityHashMap<Class<? extends S2Shape>, Integer> classToTypeTag, Map<Integer, S2Coder<? extends S2Shape>> typeTagToCoder) -
Method Summary
Modifier and TypeMethodDescriptionstatic S2TaggedShapeCoder.Builder
builder()
Returns a newS2TaggedShapeCoder.Builder
.decode
(PrimitiveArrays.Bytes data, PrimitiveArrays.Cursor cursor) void
encode
(S2Shape value, OutputStream output) Encodesvalue
tooutput
.Returns a newS2TaggedShapeCoder.Builder
initialized with the currentS2TaggedShapeCoder
.
-
Field Details
-
POLYGON_TYPE_TAG
private static final int POLYGON_TYPE_TAG- See Also:
-
POLYLINE_TYPE_TAG
private static final int POLYLINE_TYPE_TAG- See Also:
-
POINT_TYPE_TAG
private static final int POINT_TYPE_TAG- See Also:
-
LAX_POLYLINE_TYPE_TAG
private static final int LAX_POLYLINE_TYPE_TAG- See Also:
-
LAX_POLYGON_TYPE_TAG
private static final int LAX_POLYGON_TYPE_TAG- See Also:
-
FAST_POLYGON_SHAPE_CODER
-
COMPACT_POLYGON_SHAPE_CODER
-
FAST_POLYLINE_SHAPE_CODER
-
POLYGON_SHAPE_CLASSES
private static final com.google.common.collect.ImmutableList<Class<? extends S2Polygon.Shape>> POLYGON_SHAPE_CLASSES -
POINT_SHAPE_CLASSES
private static final com.google.common.collect.ImmutableList<Class<? extends S2Point.Shape>> POINT_SHAPE_CLASSES -
LAX_POLYLINE_SHAPE_CLASSES
private static final com.google.common.collect.ImmutableList<Class<? extends S2LaxPolylineShape>> LAX_POLYLINE_SHAPE_CLASSES -
LAX_POLYGON_SHAPE_CLASSES
private static final com.google.common.collect.ImmutableList<Class<? extends S2LaxPolygonShape>> LAX_POLYGON_SHAPE_CLASSES -
FAST
An instance of aS2TaggedShapeCoder
which encodes/decodesS2Shape
s in the FAST encoding format. The FAST format is optimized for fast encoding/decoding. -
COMPACT
An instance of aS2TaggedShapeCoder
which encodes/decodesS2Shape
s in the COMPACT encoding format. The COMPACT format is optimized for disk usage and memory footprint. -
classToTypeTag
-
typeTagToCoder
-
-
Constructor Details
-
S2TaggedShapeCoder
-
-
Method Details
-
encode
Description copied from interface:S2Coder
Encodesvalue
tooutput
.- Specified by:
encode
in interfaceS2Coder<S2Shape>
- Throws:
IOException
-
decode
Description copied from interface:S2Coder
Decodes a value of typeS2Coder
fromdata
starting atcursor.position
.cursor.position
is updated to the position of the first byte indata
following the encoded value. -
builder
Returns a newS2TaggedShapeCoder.Builder
. -
toBuilder
Returns a newS2TaggedShapeCoder.Builder
initialized with the currentS2TaggedShapeCoder
.
-