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 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); } }
@Test public void testDeserializeEnvelope() { assertDeserializeEnvelope("MULTIPOINT (20 20, 25 25)", new Envelope(20, 20, 25, 25)); assertDeserializeEnvelope("MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))", new Envelope(1, 1, 5, 4)); assertDeserializeEnvelope("POLYGON ((0 0, 0 4, 4 0))", new Envelope(0, 0, 4, 4)); assertDeserializeEnvelope("MULTIPOLYGON (((0 0 , 0 2, 2 2, 2 0)), ((2 2, 2 4, 4 4, 4 2)))", new Envelope(0, 0, 4, 4)); assertDeserializeEnvelope("GEOMETRYCOLLECTION (POINT (3 7), LINESTRING (4 6, 7 10))", new Envelope(3, 6, 7, 10)); assertDeserializeEnvelope("POLYGON EMPTY", null); assertDeserializeEnvelope("POINT (1 2)", new Envelope(1, 2, 1, 2)); assertDeserializeEnvelope("POINT EMPTY", null); assertDeserializeEnvelope("GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (2 7), LINESTRING (4 6, 7 10)), POINT (3 7), LINESTRING (4 6, 7 10))", new Envelope(2, 6, 7, 10)); }
private static Envelope readEnvelope(SliceInput input) { verify(input.available() > 0); double xMin = input.readDouble(); double yMin = input.readDouble(); double xMax = input.readDouble(); double yMax = input.readDouble(); return new Envelope(xMin, yMin, xMax, yMax); }
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()); }
private static Envelope getEnvelope(OGCGeometry ogcGeometry, double radius) { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); ogcGeometry.getEsriGeometry().queryEnvelope(envelope); return new Envelope(envelope.getXMin() - radius, envelope.getXMax() + radius, envelope.getYMin() - radius, envelope.getYMax() + radius); }
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(); } } }
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(); } } }
private String getSpatialPartitioning(Rectangle extent, List<OGCGeometry> geometries, int partitionCount) { ImmutableList.Builder<Rectangle> rectangles = ImmutableList.builder(); for (OGCGeometry geometry : geometries) { Envelope envelope = new Envelope(); geometry.getEsriGeometry().queryEnvelope(envelope); rectangles.add(new Rectangle(envelope.getXMin(), envelope.getYMin(), envelope.getXMax(), envelope.getYMax())); } return KdbTreeUtils.toJson(buildKdbTree(roundToInt(geometries.size() * 1.0 / partitionCount, CEILING), extent, rectangles.build())); } }
private static Envelope tileToEnvelope(BingTile tile) { Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel()); Point lowerRightCorner = tileXYToLatitudeLongitude(tile.getX() + 1, tile.getY() + 1, tile.getZoomLevel()); return new Envelope(upperLeftCorner.getX(), lowerRightCorner.getY(), lowerRightCorner.getX(), upperLeftCorner.getY()); }
private static Envelope getSimpleGeometryEnvelope(BasicSliceInput input, int length) { // skip type injected by esri input.readInt(); double xMin = input.readDouble(); double yMin = input.readDouble(); double xMax = input.readDouble(); double yMax = input.readDouble(); int skipLength = length - (4 * Double.BYTES) - Integer.BYTES; verify(input.skip(skipLength) == skipLength); if (isEsriNaN(xMin) || isEsriNaN(yMin) || isEsriNaN(xMax) || isEsriNaN(yMax)) { // TODO: isn't it better to return empty envelope instead? return null; } return new Envelope(xMin, yMin, xMax, yMax); }
@Test public void testDeserializeType() { assertDeserializeType("POINT (1 2)", POINT); assertDeserializeType("POINT EMPTY", POINT); assertDeserializeType("MULTIPOINT (20 20, 25 25)", MULTI_POINT); assertDeserializeType("MULTIPOINT EMPTY", MULTI_POINT); assertDeserializeType("LINESTRING (1 1, 5 1, 6 2))", LINE_STRING); assertDeserializeType("LINESTRING EMPTY", LINE_STRING); assertDeserializeType("MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))", MULTI_LINE_STRING); assertDeserializeType("MULTILINESTRING EMPTY", MULTI_LINE_STRING); assertDeserializeType("POLYGON ((0 0, 0 4, 4 0))", POLYGON); assertDeserializeType("POLYGON EMPTY", POLYGON); assertDeserializeType("MULTIPOLYGON (((0 0 , 0 2, 2 2, 2 0)), ((2 2, 2 4, 4 4, 4 2)))", MULTI_POLYGON); assertDeserializeType("MULTIPOLYGON EMPTY", MULTI_POLYGON); assertDeserializeType("GEOMETRYCOLLECTION (POINT (3 7), LINESTRING (4 6, 7 10))", GEOMETRY_COLLECTION); assertDeserializeType("GEOMETRYCOLLECTION EMPTY", GEOMETRY_COLLECTION); assertEquals(deserializeType(serialize(new Envelope(1, 2, 3, 4))), ENVELOPE); }
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; }
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; }
public OGCGeometry envelope() { com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(); getEsriGeometry().queryEnvelope(env); com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.addEnvelope(env, false); return new OGCPolygon(polygon, esriSR); }
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()); }
private static Envelope getEnvelope(OGCGeometry ogcGeometry, double radius) { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); ogcGeometry.getEsriGeometry().queryEnvelope(envelope); return new Envelope(envelope.getXMin() - radius, envelope.getXMax() + radius, envelope.getYMin() - radius, envelope.getYMax() + radius); }