/** * Get the union. * * @param r the other geometry * @return the union of this geometry envelope and another geometry envelope */ public Value getEnvelopeUnion(ValueGeometry r) { GeometryFactory gf = new GeometryFactory(); Envelope mergedEnvelope = new Envelope(getGeometryNoCopy().getEnvelopeInternal()); mergedEnvelope.expandToInclude(r.getGeometryNoCopy().getEnvelopeInternal()); return get(gf.toGeometry(mergedEnvelope)); }
/** {@inheritDoc} */ public Geometry toGeometry() { return geomFactory.toGeometry(envelope); }
public Geometry toGeometry(Envelope envelope) { return delegate.toGeometry(envelope); }
public DBObject toObject(Envelope envelope) { return toObject(geometryFactory.toGeometry(envelope)); }
List<Polygon> polys = new ArrayList<Polygon>(); // points that are Geometry displayGeometry = gf.toGeometry(toEnvelope(displayArea));
@Override public void handleGranule( Object source, GridCoverage2DReader inputReader, SimpleFeature targetFeature, SimpleFeatureType targetFeatureType, SimpleFeature feature, SimpleFeatureType inputFeatureType, MosaicConfigurationBean mosaicConfiguration) { if (inputReader instanceof StructuredGridCoverage2DReader) { handleStructuredGranule( source, inputReader, targetFeature, targetFeatureType, feature, inputFeatureType, mosaicConfiguration); } else { Envelope coverageEnvelope = inputReader.getOriginalEnvelope(); targetFeature.setAttribute( targetFeatureType.getGeometryDescriptor().getLocalName(), GEOM_FACTORY.toGeometry(new ReferencedEnvelope(coverageEnvelope))); } } }
extentGeometry = (new GeometryFactory()).toGeometry(extent);
/** * This "pages" through standard geo boundaries offset by multiples of 360 * longitudinally that intersect geom, and the intersecting results of a page * and the geom are shifted into the standard -180 to +180 and added to a new * geometry that is returned. */ private static Geometry cutUnwrappedGeomInto360(Geometry geom) { Envelope geomEnv = geom.getEnvelopeInternal(); if (geomEnv.getMinX() >= -180 && geomEnv.getMaxX() <= 180) return geom; assert geom.isValid() : "geom"; //TODO opt: support geom's that start at negative pages -- // ... will avoid need to previously shift in unwrapDateline(geom). List<Geometry> geomList = new ArrayList<Geometry>(); //page 0 is the standard -180 to 180 range for (int page = 0; true; page++) { double minX = -180 + page * 360; if (geomEnv.getMaxX() <= minX) break; Geometry rect = geom.getFactory().toGeometry(new Envelope(minX, minX + 360, -90, 90)); assert rect.isValid() : "rect"; Geometry pageGeom = rect.intersection(geom);//JTS is doing some hard work assert pageGeom.isValid() : "pageGeom"; shiftGeomByX(pageGeom, page * -360); geomList.add(pageGeom); } return UnaryUnionOp.union(geomList); }
if (r.getCrossesDateLine()) { Collection<Geometry> pair = new ArrayList<>(2); pair.add(geometryFactory.toGeometry(new Envelope( r.getMinX(), ctx.getWorldBounds().getMaxX(), r.getMinY(), r.getMaxY()))); pair.add(geometryFactory.toGeometry(new Envelope( ctx.getWorldBounds().getMinX(), r.getMaxX(), r.getMinY(), r.getMaxY()))); return geometryFactory.buildGeometry(pair);//a MultiPolygon or MultiLineString } else { return geometryFactory.toGeometry(new Envelope(r.getMinX(), r.getMaxX(), r.getMinY(), r.getMaxY()));
feature.setAttribute( CoverageSlice.Attributes.GEOMETRY, NetCDFCRSUtilities.GEOM_FACTORY.toGeometry( reader.georeferencing.getBoundingBox(variableDS.getShortName()))); feature.setAttribute(CoverageSlice.Attributes.INDEX, imageIndex);
private PreparedGeometry getEnvelopeGeometry(GeometryFactory geomFactory) { if (envPrepGeom == null) { Geometry envGeom = geomFactory.toGeometry(env); envPrepGeom = PreparedGeometryFactory.prepare(envGeom); } return envPrepGeom; } }
private static void addBounds(Boundable bnd, List bounds, GeometryFactory factory) { // don't include bounds of leaf nodes if (! (bnd instanceof AbstractNode)) return; Envelope env = (Envelope) bnd.getBounds(); bounds.add(factory.toGeometry(env)); if (bnd instanceof AbstractNode) { AbstractNode node = (AbstractNode) bnd; List children = node.getChildBoundables(); for (Iterator i = children.iterator(); i.hasNext(); ) { Boundable child = (Boundable) i.next(); addBounds(child, bounds, factory); } } }
protected Geometry getBox() { return JTSTestBuilder.getGeometryFactory().toGeometry(getEnvelope()); }
@Override public Geometry getResult() throws SQLException { if(aggregatedEnvelope.isNull()) { return null; } else { return new GeometryFactory().toGeometry(aggregatedEnvelope); } } }
private void getBoxGeom() { geom = new GeometryFactory().toGeometry(new Envelope(west, east, south, north)); }
/** * * @see org.locationtech.jts.generator.GeometryGenerator#create() * * @throws NoSuchElementException when all the grids have been created (@see #create()) * @throws NullPointerException when either the Geometry Factory, or the Bounding Box are undefined. */ public Geometry create() { return geometryFactory.toGeometry(createEnv()); } /**
private Geometry createAOI(Coordinate queryPt, double tolerance) { Envelope env = new Envelope(queryPt); env.expandBy(2 * tolerance); return parentGeom.getFactory().toGeometry(env); }
public Geometry composeGeometry(final CoordinateReferenceSystem system) { final Envelope bounds = new Envelope(getMinX(), getMaxX(), getMinY(), getMaxY()); return new GeometryFactory().toGeometry(bounds); }
public Geometry getGeometry() { int level = recursionLevelForSize(numPts); LineSegment baseLine = getSquareBaseLine(); Coordinate origin = baseLine.getCoordinate(0); LinearRing[] holes = getHoles(level, origin.x, origin.y, getDiameter()); LinearRing shell = ((Polygon) geomFactory.toGeometry(getSquareExtent())).getExteriorRing(); return geomFactory.createPolygon( shell, holes); }
void checkExpectedEnvelopeGeometry(String wktInput, String wktEnvGeomExpected) throws ParseException { Geometry input = reader.read(wktInput); Geometry envGeomExpected = reader.read(wktEnvGeomExpected); Envelope env = input.getEnvelopeInternal(); Geometry envGeomActual = geometryFactory.toGeometry(env); boolean isEqual = envGeomActual.equalsNorm(envGeomExpected); assertTrue(isEqual); }