/** * Initialize an <code>Envelope</code> to a region defined by two Coordinates. * * @param p1 the first Coordinate * @param p2 the second Coordinate */ public void init(Coordinate p1, Coordinate p2) { init(p1.x, p2.x, p1.y, p2.y, p1.z, p2.z); }
/** * Initialize an <code>Envelope</code> to a region defined by a single Coordinate. * * @param p the coordinate */ public void init(Coordinate p) { init(p.x, p.x, p.y, p.y, p.z, p.z); }
/** * Initialize an <code>Envelope</code> for a region defined by maximum and minimum values. * * @param x1 the first x-value * @param x2 the second x-value * @param y1 the first y-value * @param y2 the second y-value * @param z1 the first z-value * @param z2 the second z-value */ public void init(double x1, double x2, double y1, double y2, double z1, double z2) { init(x1, x2, y1, y2); if (z1 < z2) { minz = z1; maxz = z2; } else { minz = z2; maxz = z1; } }
/** * Creates a new envelope from an existing JTS envelope. * * @param envelope The envelope to initialize from. * @param crs The coordinate reference system. * @throws MismatchedDimensionExceptionif the CRS dimension is not valid. */ public ReferencedEnvelope3D( final ReferencedEnvelope3D envelope, final CoordinateReferenceSystem crs) throws MismatchedDimensionException { init(envelope); this.crs = crs; checkCoordinateReferenceSystemDimension(); }
/** * Creates an envelope for a region defined by maximum and minimum values. * * @param x1 The first x-value. * @param x2 The second x-value. * @param y1 The first y-value. * @param y2 The second y-value. * @param z1 The first y-value. * @param z2 The second y-value. * @param crs The coordinate reference system. * @throws MismatchedDimensionException if the CRS dimension is not valid. */ public ReferencedEnvelope3D( final double x1, final double x2, final double y1, final double y2, final double z1, final double z2, final CoordinateReferenceSystem crs) throws MismatchedDimensionException { init(x1, x2, y1, y2, z1, z2); this.crs = crs; checkCoordinateReferenceSystemDimension(); }
/** * Initialize the bounding box with another bounding box. * * @since 2.4 */ public void setBounds(final BoundingBox3D bbox) { ensureCompatibleReferenceSystem(bbox); init(getJTSEnvelope(bbox)); }
/** * Creates a new envelope from an existing envelope. * * @param envelope The envelope to initialize from * @throws MismatchedDimensionException if the CRS dimension is not valid. */ public ReferencedEnvelope3D(final ReferencedEnvelope3D envelope) throws MismatchedDimensionException { init(envelope); crs = envelope.getCoordinateReferenceSystem(); checkCoordinateReferenceSystemDimension(); }
/** Sets this envelope to the specified bounding box. */ public void init(BoundingBox bounds) { init( bounds.getMinimum(0), bounds.getMaximum(0), bounds.getMinimum(1), bounds.getMaximum(1), bounds.getMinimum(2), bounds.getMaximum(2)); this.crs = bounds.getCoordinateReferenceSystem(); }
/** * Translates this envelope by given amounts in the X and Y direction. * * @param transX the amount to translate along the X axis * @param transY the amount to translate along the Y axis * @param transZ the amount to translate along the Z axis */ public void translate(double transX, double transY, double transZ) { if (isNull()) { return; } init( getMinX() + transX, getMaxX() + transX, getMinY() + transY, getMaxY() + transY, getMinZ() + transZ, getMaxZ() + transZ); }
/** * Creates a new envelope from an existing OGC envelope. * * <p>NOTE: if the envelope is empty, the resulting ReferencedEnvelope will not be. In case this * is needed use {@link #create(org.opengis.geometry.Envelope, CoordinateReferenceSystem) * ReferencedEnvelope.create(envelope, envelope.getCoordinateReferenceSystem())} * * @param envelope The envelope to initialize from. * @throws MismatchedDimensionException if the CRS dimension is not valid. */ public ReferencedEnvelope3D(final org.opengis.geometry.Envelope envelope) throws MismatchedDimensionException { init( envelope.getMinimum(0), envelope.getMaximum(0), envelope.getMinimum(1), envelope.getMaximum(1), envelope.getMinimum(2), envelope.getMaximum(2)); this.crs = envelope.getCoordinateReferenceSystem(); checkCoordinateReferenceSystemDimension(); }
double z_ave = (z_min + z_max) / 2.0; envelope.init(x_min, x_max, y_min, y_max, z_min, z_max);