Class S2PointCompression
java.lang.Object
com.google.common.geometry.S2PointCompression
-
Method Summary
Modifier and TypeMethodDescriptiondecodePointsCompressed(int numVertices, int level, InputStream input) Decode a list of points that were encoded usingencodePointsCompressed(List, int, OutputStream).static voidencodePointsCompressed(List<S2Point> points, int level, OutputStream output) Encode a list of points into an efficient, lossless binary representation, which can be decoded by callingdecodePointsCompressed(int, int, InputStream).
-
Method Details
-
encodePointsCompressed
public static void encodePointsCompressed(List<S2Point> points, int level, OutputStream output) throws IOException Encode a list of points into an efficient, lossless binary representation, which can be decoded by callingdecodePointsCompressed(int, int, InputStream). The encoding is byte-compatible with the C++ version of the S2 library.Points that are snapped to the specified level will require approximately 4 bytes per point, while other points will require 24 bytes per point.
- Parameters:
points- The list of points to encode.level- TheS2Celllevel at which points should be encoded.output- The output stream into which the encoding should be written.- Throws:
IOException- if there was a problem writing into the output stream.
-
decodePointsCompressed
public static List<S2Point> decodePointsCompressed(int numVertices, int level, InputStream input) throws IOException Decode a list of points that were encoded usingencodePointsCompressed(List, int, OutputStream).Points that are snapped to the specified level will require approximately 4 bytes per point, while other points will require 24 bytes per point.
- Parameters:
numVertices- The number of points to decode.level- TheS2Celllevel at which points are encoded.input- The input stream containing the encoded point data.- Returns:
- the list of decoded points.
- Throws:
IOException- if there was a problem reading from the input stream.
-