private static Envelope getEnvelope(OGCGeometry ogcGeometry) { com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(); ogcGeometry.getEsriGeometry().queryEnvelope(env); return new Envelope(env.getXMin(), env.getXMax(), env.getYMin(), env.getYMax()); }
@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 Envelope getEnvelope(OGCGeometry ogcGeometry) { GeometryCursor cursor = ogcGeometry.getEsriGeometryCursor(); Envelope overallEnvelope = new Envelope(); while (true) { Geometry geometry = cursor.next(); if (geometry == null) { return overallEnvelope; } Envelope envelope = new Envelope(); geometry.queryEnvelope(envelope); overallEnvelope.merge(envelope); } }
private static BingTile getTileCoveringLowerRightCorner(Envelope envelope, int zoomLevel) { BingTile tile = latitudeLongitudeToTile(envelope.getYMin(), envelope.getXMax(), zoomLevel); // If the tile covering the lower right corner of the envelope overlaps the envelope only // at the border then return a tile shifted to the left and/or top int deltaX = 0; int deltaY = 0; Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel()); if (upperLeftCorner.getX() == envelope.getXMax()) { deltaX = -1; } if (upperLeftCorner.getY() == envelope.getYMin()) { deltaY = -1; } if (deltaX != 0 || deltaY != 0) { return BingTile.fromCoordinates(tile.getX() + deltaX, tile.getY() + deltaY, tile.getZoomLevel()); } return tile; }
int precision = 17 - (7 & (export_flags >> 13)); boolean b_export_zs = envelope .hasAttribute(VertexDescription.Semantics.Z) && (export_flags & WktExportFlags.wktExportStripZs) == 0; boolean b_export_ms = envelope .hasAttribute(VertexDescription.Semantics.M) && (export_flags & WktExportFlags.wktExportStripMs) == 0; Envelope1D interval; if (!envelope.isEmpty()) { xmin = envelope.getXMin(); ymin = envelope.getYMin(); xmax = envelope.getXMax(); ymax = envelope.getYMax(); interval = envelope.queryInterval( VertexDescription.Semantics.Z, 0); zmin = interval.vmin; interval = envelope.queryInterval( VertexDescription.Semantics.M, 0); mmin = interval.vmin;
VertexDescription vd = env.getDescription(); descriptionBitMask = vd.m_semanticsBitArray; if (env.isEmpty()) { return; attribs[0] = env.getXMin(); attribs[1] = env.getYMin(); attribs[2] = env.getXMax(); attribs[3] = env.getYMax(); int index = 4; for (int i = 1, n = vd.getAttributeCount(); i < n; i++) { int comps = VertexDescription.getComponentCount(semantics); for (int ord = 0; ord < comps; ord++) { Envelope1D e = env.queryInterval(semantics, ord); attribs[index++] = e.vmin; attribs[index++] = e.vmax;
private static Envelope getPointEnvelope(BasicSliceInput input) { double x = input.readDouble(); double y = input.readDouble(); if (isNaN(x) || isNaN(y)) { // TODO: isn't it better to return empty envelope instead? return null; } return new Envelope(x, y, x, y); }
public void eval() { com.esri.core.geometry.ogc.OGCGeometry geom1; geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).Y(); } else { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); geom1.getEsriGeometry().queryEnvelope(envelope); out.value = envelope.getYMax(); } } }
public void eval() { com.esri.core.geometry.ogc.OGCGeometry geom1; geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).X(); } else { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); geom1.getEsriGeometry().queryEnvelope(envelope); out.value = envelope.getXMax(); } } }
public void eval() { com.esri.core.geometry.ogc.OGCGeometry geom1; geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).X(); } else { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); geom1.getEsriGeometry().queryEnvelope(envelope); out.value = envelope.getXMin(); } } }
public void eval() { com.esri.core.geometry.ogc.OGCGeometry geom1; geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).Y(); } else { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); geom1.getEsriGeometry().queryEnvelope(envelope); out.value = envelope.getYMin(); } } }
Geometry _OffsetEnvelope() { Envelope envelope = (Envelope) m_inputGeometry; if ((m_distance > 0) && (m_joins != OperatorOffset.JoinType.Miter)) { Polygon poly = new Polygon(); poly.addEnvelope(envelope, false); m_inputGeometry = poly; return _ConstructOffset(); } Envelope resEnv = new Envelope(envelope.m_envelope); resEnv.inflate(m_distance, m_distance); return resEnv; }
@SqlNullable @Description("Returns X minima of a bounding box of a Geometry") @ScalarFunction("ST_XMin") @SqlType(DOUBLE) public static Double stXMin(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); if (envelope == null) { return null; } return envelope.getXMin(); }
@SqlNullable @Description("Returns X maxima of a bounding box of a Geometry") @ScalarFunction("ST_XMax") @SqlType(DOUBLE) public static Double stXMax(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); if (envelope == null) { return null; } return envelope.getXMax(); }
@SqlNullable @Description("Returns Y minima of a bounding box of a Geometry") @ScalarFunction("ST_YMin") @SqlType(DOUBLE) public static Double stYMin(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); if (envelope == null) { return null; } return envelope.getYMin(); }
@SqlNullable @Description("Returns Y maxima of a bounding box of a Geometry") @ScalarFunction("ST_YMax") @SqlType(DOUBLE) public static Double stYMax(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); if (envelope == null) { return null; } return envelope.getYMax(); }
/** * 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); } } }
@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); } } }
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; }