org.geotools.geometry.jts

## Class ReferencedEnvelope3D

• ### Field Detail

• #### EVERYTHING

public static ReferencedEnvelope3D EVERYTHING
A ReferencedEnvelope containing "everything"
• ### Method Detail

• #### intersects

public static boolean intersects(Coordinate p1,
Coordinate p2,
Coordinate q)
Test the point q to see whether it intersects the Envelope defined by p1-p2
Parameters:
p1 - one extremal point of the envelope
p2 - another extremal point of the envelope
q - the point to test for intersection
Returns:
true if q intersects the envelope p1-p2
• #### intersects

public static boolean intersects(Coordinate p1,
Coordinate p2,
Coordinate q1,
Coordinate q2)
Test the envelope defined by p1-p2 for intersection with the envelope defined by q1-q2
Parameters:
p1 - one extremal point of the envelope P
p2 - another extremal point of the envelope P
q1 - one extremal point of the envelope Q
q2 - another extremal point of the envelope Q
Returns:
true if Q intersects P
• #### init

public void init()
Initialize to a null Envelope.
Overrides:
init in class Envelope
• #### init

public void init(double x1,
double x2,
double y1,
double y2,
double z1,
double z2)
Initialize an Envelope for a region defined by maximum and minimum values.
Parameters:
x1 - the first x-value
x2 - the second x-value
y1 - the first y-value
y2 - the second y-value
z1 - the first z-value
z2 - the second z-value
• #### init

public void init(Coordinate p1,
Coordinate p2)
Initialize an Envelope to a region defined by two Coordinates.
Overrides:
init in class Envelope
Parameters:
p1 - the first Coordinate
p2 - the second Coordinate
• #### init

public void init(Coordinate p)
Initialize an Envelope to a region defined by a single Coordinate.
Overrides:
init in class Envelope
Parameters:
p - the coordinate
• #### init

public void init(Envelope env)
Overrides:
init in class Envelope
• #### init

public void init(ReferencedEnvelope3D env)
Initialize an Envelope from an existing 3D Envelope.
Parameters:
env - the 3D Envelope to initialize from
• #### setToNull

public void setToNull()
Makes this Envelope a "null" envelope, that is, the envelope of the empty geometry.
Overrides:
setToNull in class Envelope
• #### getDepth

public double getDepth()
Returns the difference between the maximum and minimum z values.
Returns:
max z - min z, or 0 if this is a null Envelope
• #### getMinZ

public double getMinZ()
Returns the Envelopes minimum z-value. min z > max z indicates that this is a null Envelope.
Specified by:
getMinZ in interface BoundingBox3D
Returns:
the minimum z-coordinate
• #### getMaxZ

public double getMaxZ()
Returns the Envelopes maximum z-value. min z > max z indicates that this is a null Envelope.
Specified by:
getMaxZ in interface BoundingBox3D
Returns:
the maximum z-coordinate
• #### getVolume

public double getVolume()
Gets the volume of this envelope.
Returns:
the volume of the envelope, 0.0 if the envelope is null
• #### minExtent

public double minExtent()
Gets the minimum extent of this envelope across all three dimensions.
Overrides:
minExtent in class Envelope
Returns:
the minimum extent of this envelope
• #### maxExtent

public double maxExtent()
Gets the maximum extent of this envelope across both dimensions.
Overrides:
maxExtent in class Envelope
Returns:
the maximum extent of this envelope
• #### expandToInclude

public void expandToInclude(Coordinate p)
Enlarges this Envelope so that it contains the given Coordinate. Has no effect if the point is already on or within the envelope.
Overrides:
expandToInclude in class Envelope
Parameters:
p - the Coordinate to expand to include
• #### expandBy

public void expandBy(double distance)
Expands this envelope by a given distance in all directions. Both positive and negative distances are supported.
Overrides:
expandBy in class Envelope
Parameters:
distance - the distance to expand the envelope
• #### expandBy

public void expandBy(double deltaX,
double deltaY,
double deltaZ)
Expands this envelope by a given distance in all directions. Both positive and negative distances are supported.
Parameters:
deltaX - the distance to expand the envelope along the the X axis
deltaY - the distance to expand the envelope along the the Y axis
• #### expandToInclude

public void expandToInclude(double x,
double y,
double z)
Enlarges this Envelope so that it contains the given point. Has no effect if the point is already on or within the envelope.
Parameters:
x - the value to lower the minimum x to or to raise the maximum x to
y - the value to lower the minimum y to or to raise the maximum y to
z - the value to lower the minimum z to or to raise the maximum z to
• #### translate

public void translate(double transX,
double transY,
double transZ)
Translates this envelope by given amounts in the X and Y direction.
Parameters:
transX - the amount to translate along the X axis
transY - the amount to translate along the Y axis
transZ - the amount to translate along the Z axis
• #### centre

public Coordinate centre()
Computes the coordinate of the centre of this envelope (as long as it is non-null
Overrides:
centre in class Envelope
Returns:
the centre coordinate of this envelope null if the envelope is null
• #### intersects

public boolean intersects(ReferencedEnvelope3D other)
Check if the region defined by other overlaps (intersects) the region of this Envelope.
Parameters:
other - the Envelope which this Envelope is being checked for overlapping
Returns:
true if the Envelopes overlap
• #### intersects

public boolean intersects(Coordinate p)
Check if the point p overlaps (lies inside) the region of this Envelope .
Overrides:
intersects in class Envelope
Parameters:
p - the Coordinate to be tested
Returns:
true if the point overlaps this Envelope
• #### overlaps

public boolean overlaps(Coordinate p)
Overrides:
overlaps in class Envelope
• #### intersects

public boolean intersects(double x,
double y,
double z)
Check if the point (x, y) overlaps (lies inside) the region of this Envelope.
Parameters:
x - the x-ordinate of the point
y - the y-ordinate of the point
z - the z-ordinate of the point
Returns:
true if the point overlaps this Envelope
• #### contains

public boolean contains(Coordinate p)
Tests if the given point lies in or on the envelope.

Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.

Overrides:
contains in class Envelope
Parameters:
p - the point which this Envelope is being checked for containing
Returns:
true if the point lies in the interior or on the boundary of this Envelope.
covers(Coordinate)
• #### contains

public boolean contains(double x,
double y,
double z)
Tests if the given point lies in or on the envelope.

Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.

Specified by:
contains in interface BoundingBox3D
Parameters:
x - the x-coordinate of the point which this Envelope is being checked for containing
y - the y-coordinate of the point which this Envelope is being checked for containing
z - The second ordinate value.
Returns:
true if (x, y) lies in the interior or on the boundary of this Envelope.
Envelope.covers(double, double)
• #### covers

public boolean covers(double x,
double y,
double z)
Tests if the given point lies in or on the envelope.
Parameters:
x - the x-coordinate of the point which this Envelope is being checked for containing
y - the y-coordinate of the point which this Envelope is being checked for containing
Returns:
true if (x, y) lies in the interior or on the boundary of this Envelope.
• #### covers

public boolean covers(Coordinate p)
Tests if the given point lies in or on the envelope.
Overrides:
covers in class Envelope
Parameters:
p - the point which this Envelope is being checked for containing
Returns:
true if the point lies in the interior or on the boundary of this Envelope.
• #### covers

public boolean covers(ReferencedEnvelope3D other)
Tests if the Envelope other lies wholely inside this Envelope (inclusive of the boundary).
Parameters:
other - the Envelope to check
Returns:
true if this Envelope covers the other
• #### distance

public double distance(ReferencedEnvelope3D env)
Computes the distance between this and another Envelope. The distance between overlapping Envelopes is 0. Otherwise, the distance is the Euclidean distance between the closest points.
• #### getSpan

public double getSpan(int dimension)
Returns the envelope length along the specified dimension. This length is equals to the maximum ordinate minus the minimal ordinate.
Specified by:
getSpan in interface Envelope
Overrides:
getSpan in class ReferencedEnvelope
Parameters:
dimension - The dimension for which to obtain the ordinate value.
Returns:
The span (typically width or height) at the given dimension.
RectangularShape.getWidth(), RectangularShape.getHeight()
• #### isEmpty

public boolean isEmpty()
Returns true if lengths along all dimension are zero.
Specified by:
isEmpty in interface BoundingBox
Overrides:
isEmpty in class ReferencedEnvelope
Returns:
true if this bounding box is empty.
• #### contains

public boolean contains(DirectPosition pos)
Returns true if the provided location is contained by this bounding box.
Specified by:
contains in interface BoundingBox
Overrides:
contains in class ReferencedEnvelope
Parameters:
pos - The direct position to test for inclusion.
Returns:
true if the given position is inside this bounds.
• #### contains

public boolean contains(BoundingBox3D bbox)
Returns true if the provided bounds are contained by this bounding box.
• #### intersects

public boolean intersects(BoundingBox3D bbox)
Check if this bounding box intersects the provided bounds.
• #### intersection

public ReferencedEnvelope3D intersection(ReferencedEnvelope3D env)
Computes the intersection of two Envelopes.
Parameters:
env - the envelope to intersect with
Returns:
a new Envelope representing the intersection of the envelopes (this will be the null envelope if either argument is null, or they do not intersect
• #### include

public void include(BoundingBox3D bbox)
Include the provided bounding box, expanding as necessary.
• #### expandToInclude

public void expandToInclude(ReferencedEnvelope3D other)
Enlarges this Envelope so that it contains the other Envelope. Has no effect if other is wholly on or within the envelope.
Parameters:
other - the Envelope to expand to include
• #### include

public void include(double x,
double y,
double z)
Include the provided coordinates, expanding as necessary.
Specified by:
include in interface BoundingBox3D
Parameters:
x - The first ordinate value.
y - The second ordinate value.
z - The third ordinate value.
• #### setBounds

public void setBounds(BoundingBox3D bbox)
Initialize the bounding box with another bounding box.
Since:
2.4
• #### transform

public ReferencedEnvelope transform(CoordinateReferenceSystem targetCRS,
boolean lenient,
int numPointsForTransformation)
throws TransformException,
FactoryException
Transforms the referenced envelope to the specified coordinate reference system using the specified amount of points.

This method can handle the case where the envelope contains the North or South pole, or when it cross the ±180ï¿½ longitude.

Overrides:
transform in class ReferencedEnvelope
Parameters:
targetCRS - The target coordinate reference system.
lenient - true if datum shift should be applied even if there is insuffisient information. Otherwise (if false), an exception is thrown in such case.
numPointsForTransformation - The number of points to use for sampling the envelope.
Returns:
The transformed envelope.
Throws:
FactoryException - if the math transform can't be determined.
TransformException - if at least one coordinate can't be transformed.
CRS.transform(CoordinateOperation, org.opengis.geometry.Envelope)
• #### hashCode

public int hashCode()
Returns a hash value for this envelope. This value need not remain consistent between different implementations of the same class.
Overrides:
hashCode in class ReferencedEnvelope
• #### equals

public boolean equals(Object other)
Compares the specified object with this envelope for equality.
Overrides:
equals in class ReferencedEnvelope
• #### boundsEquals3D

public boolean boundsEquals3D(Envelope other,
double eps)
Compare the bounds of this envelope with those of another.

Note: in this test:

• the coordinate reference systems of the envelopes are not examined
• only the first three dimensions of the envelopes are compared
• it is assumed that each dimension equates to the same axis for both envelopes
Parameters:
other - other envelope
eps - a small tolerance factor (e.g. 1.0e-6d) which will be scaled relative to this envlope's width and height
Returns:
true if all bounding coordinates are equal within the set tolerance; false otherwise
• #### include

public void include(double x,
double y)
Description copied from class: ReferencedEnvelope
Include the provided coordinates, expanding as necessary.
Specified by:
include in interface BoundingBox
Overrides:
include in class ReferencedEnvelope
Parameters:
x - The first ordinate value.
y - The second ordinate value.