@SqlNullable @Description("Returns TRUE if this Geometry is an empty geometrycollection, polygon, point etc") @ScalarFunction("ST_IsEmpty") @SqlType(BOOLEAN) public static Boolean stIsEmpty(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); return envelope == null || envelope.isEmpty(); }
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(); }
/** * The output of this method can be only used for debugging. It is subject to change without notice. */ @Override public String toString() { if (isEmpty()) return "Envelope: []"; String s = "Envelope: [" + m_envelope.xmin + ", " + m_envelope.ymin + ", " + m_envelope.xmax + ", " + m_envelope.ymax +"]"; return s; }
/** * The output of this method can be only used for debugging. It is subject to change without notice. */ @Override public String toString() { if (isEmpty()) return "Envelope: []"; String s = "Envelope: [" + m_envelope.xmin + ", " + m_envelope.ymin + ", " + m_envelope.xmax + ", " + m_envelope.ymax +"]"; return s; }
/** * Returns TRUE when this geometry has exactly same type, properties, and * coordinates as the other geometry. */ @Override public boolean equals(Object _other) { if (_other == this) return true; if (!(_other instanceof Envelope)) return false; Envelope other = (Envelope) _other; if (m_description != other.m_description) return false; if (isEmpty()) if (other.isEmpty()) return true; else return false; if (!this.m_envelope.equals(other.m_envelope)) return false; for (int i = 0, n = (m_description.getTotalComponentCount() - 2) * 2; i < n; i++) if (m_attributes[i] != other.m_attributes[i]) return false; return true; }
@Override public void replaceNaNs(int semantics, double value) { addAttribute(semantics); if (isEmpty()) return; int ncomps = VertexDescription.getComponentCount(semantics); for (int i = 0; i < ncomps; i++) { Envelope1D interval = queryInterval(semantics, i); if (interval.isEmpty()) { interval.vmin = value; interval.vmax = value; setInterval(semantics, i, interval); } } }
/** * Returns a hash code value for this envelope. * * @return A hash code value for this envelope. */ @Override public int hashCode() { int hashCode = m_description.hashCode(); hashCode = NumberUtils.hash(hashCode, m_envelope.hashCode()); if (!isEmpty() && m_attributes != null) { for (int i = 0, n = (m_description.getTotalComponentCount() - 2) * 2; i < n; i++) { hashCode = NumberUtils.hash(hashCode, m_attributes[i]); } } return hashCode; }
@Override public void replaceNaNs(int semantics, double value) { addAttribute(semantics); if (isEmpty()) return; int ncomps = VertexDescription.getComponentCount(semantics); for (int i = 0; i < ncomps; i++) { Envelope1D interval = queryInterval(semantics, i); if (interval.isEmpty()) { interval.vmin = value; interval.vmax = value; setInterval(semantics, i, interval); } } }
/** * Returns a hash code value for this envelope. * * @return A hash code value for this envelope. */ @Override public int hashCode() { int hashCode = m_description.hashCode(); hashCode = NumberUtils.hash(hashCode, m_envelope.hashCode()); if (!isEmpty() && m_attributes != null) { for (int i = 0, n = (m_description.getTotalComponentCount() - 2) * 2; i < n; i++) { hashCode = NumberUtils.hash(hashCode, m_attributes[i]); } } return hashCode; }
@SqlNullable @Description("Returns TRUE if this Geometry is an empty geometrycollection, polygon, point etc") @ScalarFunction("ST_IsEmpty") @SqlType(BOOLEAN) public static Boolean stIsEmpty(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); return envelope == null || envelope.isEmpty(); }
@SqlNullable @Description("Returns TRUE if this Geometry is an empty geometrycollection, polygon, point etc") @ScalarFunction("ST_IsEmpty") @SqlType(BOOLEAN) public static Boolean stIsEmpty(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); return envelope == null || envelope.isEmpty(); }
/** * adds a rectangular closed Path to the MultiPathImpl. * * @param envSrc * is the source rectangle. * @param bReverse * Creates reversed path. */ public void addEnvelope(Envelope envSrc, boolean bReverse) { if (envSrc.isEmpty()) return; boolean bWasEmpty = m_pointCount == 0; Point pt = new Point(m_description);// getDescription()); for (int i = 0, n = 4; i < n; i++) { int j = bReverse ? n - i - 1 : i; envSrc.queryCornerByVal(j, pt); if (i == 0) startPath(pt); else lineTo(pt); } closePathWithLine(); m_bPathStarted = false; if (bWasEmpty && !bReverse) _setDirtyFlag(DirtyFlags.DirtyIsEnvelope, false);// now we know the // polypath is // envelope }
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(); }
public void getCenter(Point point_out) { point_out.assignVertexDescription(m_description); if (isEmpty()) { point_out.setEmpty(); return; } int nattrib = m_description.getAttributeCount(); for (int i = 1; i < nattrib; i++) { int semantics = m_description.getSemantics(i); int ncomp = VertexDescription.getComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { double v = 0.5 * (getAttributeAsDblImpl_(0, semantics, iord) + getAttributeAsDblImpl_( 1, semantics, iord)); point_out.setAttribute(semantics, iord, v); } } point_out.setXY(m_envelope.getCenter()); }
public void getCenter(Point point_out) { point_out.assignVertexDescription(m_description); if (isEmpty()) { point_out.setEmpty(); return; } int nattrib = m_description.getAttributeCount(); for (int i = 1; i < nattrib; i++) { int semantics = m_description.getSemantics(i); int ncomp = VertexDescription.getComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { double v = 0.5 * (getAttributeAsDblImpl_(0, semantics, iord) + getAttributeAsDblImpl_( 1, semantics, iord)); point_out.setAttribute(semantics, iord, v); } } point_out.setXY(m_envelope.getCenter()); }
/** * Returns the center point of the envelope. * * @return The center point of the envelope. */ public Point getCenter() { Point pointOut = new Point(m_description); if (isEmpty()) { return pointOut; } int nattrib = m_description.getAttributeCount(); for (int i = 1; i < nattrib; i++) { int semantics = m_description._getSemanticsImpl(i); int ncomp = VertexDescription.getComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { double v = 0.5 * (_getAttributeAsDbl(0, semantics, iord) + _getAttributeAsDbl( 1, semantics, iord)); pointOut.setAttribute(semantics, iord, v); } } pointOut.setXY(m_envelope.getCenterX(), m_envelope.getCenterY()); return pointOut; }
/** * Returns the center point of the envelope. * * @return The center point of the envelope. */ public Point getCenter() { Point pointOut = new Point(m_description); if (isEmpty()) { return pointOut; } int nattrib = m_description.getAttributeCount(); for (int i = 1; i < nattrib; i++) { int semantics = m_description._getSemanticsImpl(i); int ncomp = VertexDescription.getComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { double v = 0.5 * (_getAttributeAsDbl(0, semantics, iord) + _getAttributeAsDbl( 1, semantics, iord)); pointOut.setAttribute(semantics, iord, v); } } pointOut.setXY(m_envelope.getCenterX(), m_envelope.getCenterY()); return pointOut; }
/** * Merges this envelope with the extent of the given envelope. If this * envelope is empty, the coordinates of the given envelope * are assigned. If the given envelope is empty, this envelope is unchanged. * * @param other * The envelope to merge. */ public void merge(Envelope other) { _touch(); if (other.isEmpty()) return; VertexDescription otherVD = other.m_description; if (otherVD != m_description) mergeVertexDescription(otherVD); m_envelope.merge(other.m_envelope); for (int iattrib = 1, nattrib = otherVD.getAttributeCount(); iattrib < nattrib; iattrib++) { int semantics = otherVD.getSemantics(iattrib); int ncomps = VertexDescription.getComponentCount(semantics); for (int iord = 0; iord < ncomps; iord++) { Envelope1D intervalOther = other.queryInterval(semantics, iord); Envelope1D interval = queryInterval(semantics, iord); interval.merge(intervalOther); setInterval(semantics, iord, interval); } } }