public static Slice serialize(Envelope envelope) { requireNonNull(envelope, "envelope is null"); verify(!envelope.isEmpty()); DynamicSliceOutput output = new DynamicSliceOutput(100); output.appendByte(GeometrySerializationType.ENVELOPE.code()); output.appendDouble(envelope.getXMin()); output.appendDouble(envelope.getYMin()); output.appendDouble(envelope.getXMax()); output.appendDouble(envelope.getYMax()); return output.slice(); }
private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry) { Geometry esriGeometry = geometry.getEsriGeometry(); verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point"); Point point = (Point) esriGeometry; verify(!point.hasAttribute(VertexDescription.Semantics.Z) && !point.hasAttribute(VertexDescription.Semantics.M) && !point.hasAttribute(VertexDescription.Semantics.ID), "Only 2D points with no ID nor M attribute are supported"); output.appendByte(GeometrySerializationType.POINT.code()); if (!point.isEmpty()) { output.appendDouble(point.getX()); output.appendDouble(point.getY()); } else { output.appendDouble(NaN); output.appendDouble(NaN); } }
public static Slice serialize(Envelope envelope) { requireNonNull(envelope, "envelope is null"); verify(!envelope.isEmpty()); DynamicSliceOutput output = new DynamicSliceOutput(100); output.appendByte(GeometrySerializationType.ENVELOPE.code()); output.appendDouble(envelope.getXMin()); output.appendDouble(envelope.getYMin()); output.appendDouble(envelope.getXMax()); output.appendDouble(envelope.getYMax()); return output.slice(); }
public static Slice serialize(Envelope envelope) { requireNonNull(envelope, "envelope is null"); verify(!envelope.isEmpty()); DynamicSliceOutput output = new DynamicSliceOutput(100); output.appendByte(GeometrySerializationType.ENVELOPE.code()); output.appendDouble(envelope.getXMin()); output.appendDouble(envelope.getYMin()); output.appendDouble(envelope.getXMax()); output.appendDouble(envelope.getYMax()); return output.slice(); }
public static Slice serialize(Envelope envelope) { requireNonNull(envelope, "envelope is null"); verify(!envelope.isEmpty()); DynamicSliceOutput output = new DynamicSliceOutput(100); output.appendByte(GeometrySerializationType.ENVELOPE.code()); output.appendDouble(envelope.getXMin()); output.appendDouble(envelope.getYMin()); output.appendDouble(envelope.getXMax()); output.appendDouble(envelope.getYMax()); return output.slice(); }
private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry) { Geometry esriGeometry = geometry.getEsriGeometry(); verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point"); Point point = (Point) esriGeometry; verify(!point.hasAttribute(VertexDescription.Semantics.Z) && !point.hasAttribute(VertexDescription.Semantics.M) && !point.hasAttribute(VertexDescription.Semantics.ID), "Only 2D points with no ID nor M attribute are supported"); output.appendByte(GeometrySerializationType.POINT.code()); if (!point.isEmpty()) { output.appendDouble(point.getX()); output.appendDouble(point.getY()); } else { output.appendDouble(NaN); output.appendDouble(NaN); } }
private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry) { Geometry esriGeometry = geometry.getEsriGeometry(); verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point"); Point point = (Point) esriGeometry; verify(!point.hasAttribute(VertexDescription.Semantics.Z) && !point.hasAttribute(VertexDescription.Semantics.M) && !point.hasAttribute(VertexDescription.Semantics.ID), "Only 2D points with no ID nor M attribute are supported"); output.appendByte(GeometrySerializationType.POINT.code()); if (!point.isEmpty()) { output.appendDouble(point.getX()); output.appendDouble(point.getY()); } else { output.appendDouble(NaN); output.appendDouble(NaN); } }
private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry) { Geometry esriGeometry = geometry.getEsriGeometry(); verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point"); Point point = (Point) esriGeometry; verify(!point.hasAttribute(VertexDescription.Semantics.Z) && !point.hasAttribute(VertexDescription.Semantics.M) && !point.hasAttribute(VertexDescription.Semantics.ID), "Only 2D points with no ID nor M attribute are supported"); output.appendByte(GeometrySerializationType.POINT.code()); if (!point.isEmpty()) { output.appendDouble(point.getX()); output.appendDouble(point.getY()); } else { output.appendDouble(NaN); output.appendDouble(NaN); } }
@Override public void serialize(DigestAndPercentileArrayState state, BlockBuilder out) { if (state.getDigest() == null) { out.appendNull(); } else { DynamicSliceOutput sliceOutput = new DynamicSliceOutput(state.getDigest().estimatedSerializedSizeInBytes() + (state.getPercentiles().size() * SIZE_OF_DOUBLE) + SIZE_OF_LONG); // write digest state.getDigest().serialize(sliceOutput); // write percentiles List<Double> percentiles = state.getPercentiles(); sliceOutput.appendLong(percentiles.size()); for (Double percentile : percentiles) { sliceOutput.appendDouble(percentile); } VARBINARY.writeSlice(out, sliceOutput.slice()); } }
@Override public void serialize(DigestAndPercentileState state, BlockBuilder out) { if (state.getDigest() == null) { out.appendNull(); } else { DynamicSliceOutput sliceOutput = new DynamicSliceOutput(state.getDigest().estimatedSerializedSizeInBytes() + SIZE_OF_DOUBLE); // write digest state.getDigest().serialize(sliceOutput); // write percentile sliceOutput.appendDouble(state.getPercentile()); Slice slice = sliceOutput.slice(); VARCHAR.writeSlice(out, slice); } }