/** * Initialize an <code>Envelope</code> from an existing 3D Envelope. * * @param env the 3D Envelope to initialize from */ public void init(ReferencedEnvelope3D env) { super.init((Envelope) env); this.minz = env.minz; this.maxz = env.maxz; }
@Override public void init(Envelope env) { super.init(env); if (env instanceof BoundingBox3D) { this.minz = ((BoundingBox3D) env).getMinZ(); this.maxz = ((BoundingBox3D) env).getMaxZ(); } }
@Override public BoundingBox getBounds() { ReferencedEnvelope bounds = new ReferencedEnvelope(featureType.getCoordinateReferenceSystem()); Object value = getAttribute(index); if (value instanceof Geometry) { bounds.init(((Geometry) value).getEnvelopeInternal()); } return bounds; }
env.init(tinfo.getUBounds()); envs.add(env);
@Override protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException { // TODO: crs? FeatureReader<SimpleFeatureType, SimpleFeature> r = getReader(query); try { ReferencedEnvelope e = new ReferencedEnvelope(); if (r.hasNext()) { e.init(r.next().getBounds()); } while (r.hasNext()) { e.include(r.next().getBounds()); } return e; } finally { r.close(); } }
if (i.hasNext()) { SimpleFeature f = i.next(); bounds.init(f.getBounds());
@Override public BoundingBox getBounds() { ReferencedEnvelope bounds = new ReferencedEnvelope( featureType.getCoordinateReferenceSystem()); Object value = getAttribute(index); if (value instanceof Geometry) { bounds.init(((Geometry) value).getEnvelopeInternal()); } return bounds; }
@Override public BoundingBox getBounds() { ReferencedEnvelope bounds = new ReferencedEnvelope( featureType.getCoordinateReferenceSystem()); Object value = getAttribute(index); if (value instanceof Geometry) { bounds.init(((Geometry) value).getEnvelopeInternal()); } return bounds; }
@Override public BoundingBox getBounds() { ReferencedEnvelope bounds = new ReferencedEnvelope( featureType.getCoordinateReferenceSystem()); Object value = getAttribute(index); if (value instanceof Geometry) { bounds.init(((Geometry) value).getEnvelopeInternal()); } return bounds; }
@Override public BoundingBox getBounds() { ReferencedEnvelope bounds = new ReferencedEnvelope( featureType.getCoordinateReferenceSystem()); Object value = getAttribute(index); if (value instanceof Geometry) { bounds.init(((Geometry) value).getEnvelopeInternal()); } return bounds; }
private ReferencedEnvelope getEnv(@Nullable Bounded bounded, NodeRef ref, ObjectStore source) { ObjectId metadataId = md(ref); ReferencedEnvelope env = new ReferencedEnvelope(this.crs); if (bounded != null) { bounded.expand(env); if (!env.isNull() && !metadataId.isNull()) { MathTransform transform = getMathTransform(metadataId, source); if (!transform.isIdentity()) { Envelope targetEnvelope = new ReferencedEnvelope(crs); try { int densifyPoints = isPoint(env) ? 1 : 5; JTS.transform(env, targetEnvelope, transform, densifyPoints); env.init(targetEnvelope); } catch (TransformException e) { throw new RuntimeException(e); } } } } return env; }
public RectangularBinningVisitor(ReferencedEnvelope bbox, double width, double height) { int columns = (int) Math.floor((bbox.getWidth() / width) + 0.5d); int rows = (int) Math.floor((bbox.getHeight() / height) + 0.5d); columns = columns * width < bbox.getWidth() ? columns + 1 : columns; rows = rows * height < bbox.getHeight() ? rows + 1 : rows; // recalculate envelope : origin = lower left CoordinateReferenceSystem targetCRS = bbox.getCoordinateReferenceSystem(); ReferencedEnvelope finalBBox = new ReferencedEnvelope(targetCRS); finalBBox.init(bbox.getMinX(), bbox.getMinX() + (columns * width), bbox.getMinY(), bbox.getMinY() + (rows * height)); this.init(finalBBox, columns, rows); }
public BoundingBox getBounds() { //TODO: cache this value ReferencedEnvelope bounds = new ReferencedEnvelope( featureType.getCoordinateReferenceSystem() ); for ( Object o : values ) { if ( o instanceof Geometry ) { Geometry g = (Geometry) o; //TODO: check userData for crs... and ensure its of the same // crs as the feature type if ( bounds.isNull() ) { bounds.init(g.getEnvelopeInternal()); } else { bounds.expandToInclude(g.getEnvelopeInternal()); } } } return bounds; }
private ReferencedEnvelope getEnv(@Nullable Bounded bounded, NodeRef ref) { ObjectId metadataId = md(ref); ReferencedEnvelope env = new ReferencedEnvelope(this.crs); if (bounded != null) { bounded.expand(env); if (!env.isNull() && !metadataId.isNull()) { MathTransform transform = getMathTransform(metadataId); if (!transform.isIdentity()) { Envelope targetEnvelope = new ReferencedEnvelope(crs); try { int densifyPoints = isPoint(env) ? 1 : 5; JTS.transform(env, targetEnvelope, transform, densifyPoints); env.init(targetEnvelope); } catch (TransformException e) { throw Throwables.propagate(e); } } } } return env; }
public SimpleFeatureCollection execute(SimpleFeatureCollection features, Expression weight, ReferencedEnvelope bbox, double width, double height) throws IOException { if (bbox == null) { throw new NullPointerException("bbox parameter is null"); } int columns = (int) Math.floor((bbox.getWidth() / width) + 0.5d); int rows = (int) Math.floor((bbox.getHeight() / height) + 0.5d); columns = columns * width < bbox.getWidth() ? columns + 1 : columns; rows = rows * height < bbox.getHeight() ? rows + 1 : rows; // recalculate envelope : origin = lower left CoordinateReferenceSystem targetCRS = bbox.getCoordinateReferenceSystem(); ReferencedEnvelope finalBBox = new ReferencedEnvelope(targetCRS); finalBBox.init(bbox.getMinX(), bbox.getMinX() + (columns * width), bbox.getMinY(), bbox.getMinY() + (rows * height)); return execute(features, weight, finalBBox, columns, rows); }
private void init(ReferencedEnvelope bbox, int columns, int rows) { this.columns = columns; this.rows = rows; this.width = bbox.getWidth() / columns; this.height = bbox.getHeight() / rows; this.extent = bbox; this.minX = bbox.getMinX(); this.minY = bbox.getMinY(); this.gridValues = new Double[rows][columns]; CoordinateReferenceSystem targetCRS = bbox.getCoordinateReferenceSystem(); ReferencedEnvelope bounds = new ReferencedEnvelope(targetCRS); bounds.init(minX, minX + width, minY, minY + height); this.binTemplate = gf.toGeometry(bounds); }
public CircularBinningVisitor(ReferencedEnvelope bbox, double radius) { this.diameter = radius * 2.0; columns = (int) Math.floor((bbox.getWidth() / diameter) + 0.5d); rows = (int) Math.floor((bbox.getHeight() / diameter) + 0.5d); this.columns = columns * diameter < bbox.getWidth() ? columns + 1 : columns; this.rows = rows * diameter < bbox.getHeight() ? rows + 1 : rows; // recalculate envelope : origin = lower left CoordinateReferenceSystem targetCRS = bbox.getCoordinateReferenceSystem(); ReferencedEnvelope finalBBox = new ReferencedEnvelope(targetCRS); finalBBox.init(bbox.getMinX(), bbox.getMinX() + (columns * diameter), bbox.getMinY(), bbox.getMinY() + (rows * diameter)); this.extent = finalBBox; this.minX = finalBBox.getMinX(); this.minY = finalBBox.getMinY(); this.gridValues = new Double[rows][columns]; Point center = gf.createPoint(new Coordinate(minX + radius, minY + radius)); this.binTemplate = center.buffer(radius, quadrantSegments); }
public SimpleFeatureCollection execute(ReferencedEnvelope bbox, Double width, Double height) throws IOException { int columns = (int) Math.floor((bbox.getWidth() / width) + 0.5d); int rows = (int) Math.floor((bbox.getHeight() / height) + 0.5d); columns = columns * width < bbox.getWidth() ? columns + 1 : columns; rows = rows * height < bbox.getHeight() ? rows + 1 : rows; // recalculate envelope : origin = lower left final double x1 = bbox.getMinX(); final double y1 = bbox.getMinY(); final double x2 = bbox.getMinX() + (columns * width); final double y2 = bbox.getMinY() + (rows * height); CoordinateReferenceSystem crs = bbox.getCoordinateReferenceSystem(); ReferencedEnvelope finalBBox = new ReferencedEnvelope(crs); finalBBox.init(x1, x2, y1, y2); return execute(finalBBox, columns, rows); }
/** * Computes and returns the area of validity for the given CoordinateReferenceSystem. * * <p>This method returns the prescribed area of validity for the CRS as computed by {@link * CRS#getEnvelope(CoordinateReferenceSystem)} with the exception that the following {@code * EPSG:900913} compatible CRS's return the GeoWebCache prescribed bounds so that they align * with Google Map tiles: {@code EPSG:900913, EPSG:3857, EPSG:3785}. * * @param coordSys the CRS to compute the area of validity for * @return the aov for the CRS, or {@code null} if the CRS does not provide such information * (with the exception of EPSG:900913, see above). */ public ReferencedEnvelope getAreaOfValidity(final CoordinateReferenceSystem coordSys) { Geometry aovGeom = getAreaOfValidityAsGeometry(coordSys, gridSetBroker); if (aovGeom == null) { return null; } Envelope envelope = aovGeom.getEnvelopeInternal(); double x1 = envelope.getMinX(); double x2 = envelope.getMaxX(); double y1 = envelope.getMinY(); double y2 = envelope.getMaxY(); ReferencedEnvelope aov = new ReferencedEnvelope(coordSys); aov.init(x1, x2, y1, y2); return aov; }
public HexagonalBinningVisitor(ReferencedEnvelope bbox, double size) { this.size = size; // width w = sqrt(3) * size : height h = 2 * size. // The horizontal distance between adjacent hexagon centers is w. // The vertical distance between adjacent hexagon centers is h * 3/4. this.yoffset = size * 1.5; this.xoffset = Math.sqrt(3.0) * size; this.half_xoffset = xoffset * 0.5; this.extent = new ReferencedEnvelope(bbox.getCoordinateReferenceSystem()); extent.init(bbox.getMinX() - half_xoffset, bbox.getMaxX(), bbox.getMinY() - yoffset, bbox.getMaxY()); this.minX = extent.getMinX(); this.minY = extent.getMinY(); this.yOrigin = minY + (size * 0.25); columns = (int) Math.floor((extent.getWidth() / xoffset) + 0.5d); rows = (int) Math.floor((extent.getHeight() / yoffset) + 0.5d); columns = columns * xoffset < extent.getWidth() ? columns + 1 : columns; rows = rows * yoffset < extent.getHeight() ? rows + 1 : rows; this.gridValues = new Double[rows][columns]; this.binTemplate = this.createHexagon(minX, minY, size); }