|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectEnvelope
ReferencedEnvelope
ReferencedEnvelope3D
public class ReferencedEnvelope3D
A 3D envelope associated with a coordinate reference system. In addition, this JTS envelope also implements the GeoAPI envelope interface for interoperability with GeoAPI.
Field Summary | |
---|---|
static ReferencedEnvelope3D |
EVERYTHING
A ReferencedEnvelope containing "everything" |
Fields inherited from class ReferencedEnvelope |
---|
crs |
Constructor Summary | |
---|---|
ReferencedEnvelope3D()
Creates a null envelope with a null coordinate reference system. |
|
ReferencedEnvelope3D(BoundingBox3D bbox)
Creates a new envelope from an existing bounding box. |
|
ReferencedEnvelope3D(CoordinateReferenceSystem crs)
Creates a null envelope with the specified coordinate reference system. |
|
ReferencedEnvelope3D(double x1,
double x2,
double y1,
double y2,
double z1,
double z2,
CoordinateReferenceSystem crs)
Creates an envelope for a region defined by maximum and minimum values. |
|
ReferencedEnvelope3D(Envelope envelope)
Creates a new envelope from an existing OGC envelope. |
|
ReferencedEnvelope3D(Envelope envelope,
CoordinateReferenceSystem crs)
Creates a new envelope from an existing JTS envelope. |
|
ReferencedEnvelope3D(ReferencedEnvelope3D envelope)
Creates a new envelope from an existing envelope. |
|
ReferencedEnvelope3D(ReferencedEnvelope3D envelope,
CoordinateReferenceSystem crs)
Creates a new envelope from an existing JTS envelope. |
Method Summary | |
---|---|
boolean |
boundsEquals3D(Envelope other,
double eps)
Compare the bounds of this envelope with those of another. |
Coordinate |
centre()
Computes the coordinate of the centre of this envelope (as long as it is non-null |
boolean |
contains(BoundingBox3D bbox)
Returns true if the provided bounds are contained by this bounding box. |
boolean |
contains(Coordinate p)
Tests if the given point lies in or on the envelope. |
boolean |
contains(DirectPosition pos)
Returns true if the provided location is contained by this bounding box. |
boolean |
contains(double x,
double y,
double z)
Tests if the given point lies in or on the envelope. |
boolean |
covers(Coordinate p)
Tests if the given point lies in or on the envelope. |
boolean |
covers(double x,
double y,
double z)
Tests if the given point lies in or on the envelope. |
boolean |
covers(ReferencedEnvelope3D other)
Tests if the Envelope other lies wholely inside this
Envelope (inclusive of the boundary). |
double |
distance(ReferencedEnvelope3D env)
Computes the distance between this and another Envelope . |
boolean |
equals(Object other)
Compares the specified object with this envelope for equality. |
void |
expandBy(double distance)
Expands this envelope by a given distance in all directions. |
void |
expandBy(double deltaX,
double deltaY,
double deltaZ)
Expands this envelope by a given distance in all directions. |
void |
expandToInclude(Coordinate p)
Enlarges this Envelope so that it contains the given
Coordinate . |
void |
expandToInclude(DirectPosition pt)
Expand to include the provided DirectPosition |
void |
expandToInclude(double x,
double y,
double z)
Enlarges this Envelope so that it contains the given point. |
void |
expandToInclude(ReferencedEnvelope3D other)
Enlarges this Envelope so that it contains the
other Envelope. |
double |
getDepth()
Returns the difference between the maximum and minimum z values. |
int |
getDimension()
Returns the number of dimensions. |
DirectPosition |
getLowerCorner()
A coordinate position consisting of all the minimal ordinates for each dimension for all points within the Envelope . |
double |
getMaximum(int dimension)
Returns the maximal ordinate along the specified dimension. |
double |
getMaxZ()
Returns the Envelope s maximum z-value. min z > max z
indicates that this is a null Envelope . |
double |
getMedian(int dimension)
Returns the center ordinate along the specified dimension. |
double |
getMinimum(int dimension)
Returns the minimal ordinate along the specified dimension. |
double |
getMinZ()
Returns the Envelope s minimum z-value. min z > max z
indicates that this is a null Envelope . |
double |
getSpan(int dimension)
Returns the envelope length along the specified dimension. |
DirectPosition |
getUpperCorner()
A coordinate position consisting of all the maximal ordinates for each dimension for all points within the Envelope . |
double |
getVolume()
Gets the volume of this envelope. |
int |
hashCode()
Returns a hash value for this envelope. |
void |
include(BoundingBox3D bbox)
Include the provided bounding box, expanding as necessary. |
void |
include(double x,
double y)
Include the provided coordinates, expanding as necessary. |
void |
include(double x,
double y,
double z)
Include the provided coordinates, expanding as necessary. |
void |
init()
Initialize to a null Envelope . |
void |
init(BoundingBox bounds)
Sets this envelope to the specified bounding box. |
void |
init(Coordinate p)
Initialize an Envelope to a region defined by a single
Coordinate. |
void |
init(Coordinate p1,
Coordinate p2)
Initialize an Envelope to a region defined by two
Coordinates. |
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. |
void |
init(Envelope env)
|
void |
init(ReferencedEnvelope3D env)
Initialize an Envelope from an existing 3D Envelope. |
ReferencedEnvelope3D |
intersection(ReferencedEnvelope3D env)
Computes the intersection of two Envelope s. |
boolean |
intersects(BoundingBox3D bbox)
Check if this bounding box intersects the provided bounds. |
boolean |
intersects(Coordinate p)
Check if the point p overlaps (lies inside) the region of
this Envelope . |
static boolean |
intersects(Coordinate p1,
Coordinate p2,
Coordinate q)
Test the point q to see whether it intersects the Envelope defined by p1-p2 |
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 |
boolean |
intersects(double x,
double y,
double z)
Check if the point (x, y) overlaps (lies inside) the region
of this Envelope . |
boolean |
intersects(ReferencedEnvelope3D other)
Check if the region defined by other overlaps (intersects)
the region of this Envelope . |
boolean |
isEmpty()
Returns true if lengths along all dimension are zero. |
double |
maxExtent()
Gets the maximum extent of this envelope across both dimensions. |
double |
minExtent()
Gets the minimum extent of this envelope across all three dimensions. |
boolean |
overlaps(Coordinate p)
Deprecated. Use #intersects instead. |
boolean |
overlaps(double x,
double y,
double z)
Deprecated. Use #intersects instead. |
boolean |
overlaps(ReferencedEnvelope3D other)
Deprecated. Use #intersects instead. In the future, #overlaps may be changed to be a true overlap check; that is, whether the intersection is two-dimensional. |
void |
setBounds(BoundingBox3D bbox)
Initialize the bounding box with another bounding box. |
void |
setToNull()
Makes this Envelope a "null" envelope, that is, the envelope
of the empty geometry. |
BoundingBox |
toBounds(CoordinateReferenceSystem targetCRS)
Returns a new bounding box which contains the transformed shape of this bounding box. |
ReferencedEnvelope |
transform(CoordinateReferenceSystem targetCRS,
boolean lenient)
Transforms the referenced envelope to the specified coordinate reference system. |
ReferencedEnvelope |
transform(CoordinateReferenceSystem targetCRS,
boolean lenient,
int numPointsForTransformation)
Transforms the referenced envelope to the specified coordinate reference system using the specified amount of points. |
void |
translate(double transX,
double transY,
double transZ)
Translates this envelope by given amounts in the X and Y direction. |
Methods inherited from class ReferencedEnvelope |
---|
boundsEquals2D, checkCoordinateReferenceSystemDimension, contains, create, create, create, create, create, crs, ensureCompatibleReferenceSystem, ensureCompatibleReferenceSystem, expandToInclude, getCenter, getCoordinateReferenceSystem, getLength, include, intersection, intersects, maxX, maxY, minX, minY, reference, reference, reference, reference, setBounds, toString |
Methods inherited from class Envelope |
---|
contains, contains, covers, covers, distance, expandBy, expandToInclude, getArea, getHeight, getMaxX, getMaxY, getMinX, getMinY, getWidth, init, intersects, intersects, isNull, overlaps, overlaps, translate |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface BoundingBox |
---|
contains, contains, getHeight, getMaxX, getMaxY, getMinX, getMinY, getWidth, include, intersects, setBounds |
Methods inherited from interface Envelope |
---|
getCoordinateReferenceSystem |
Field Detail |
---|
public static ReferencedEnvelope3D EVERYTHING
Constructor Detail |
---|
public ReferencedEnvelope3D()
public ReferencedEnvelope3D(CoordinateReferenceSystem crs) throws MismatchedDimensionException
crs
- The coordinate reference system.
MismatchedDimensionException
- if the CRS dimension is not valid.public ReferencedEnvelope3D(double x1, double x2, double y1, double y2, double z1, double z2, CoordinateReferenceSystem crs) throws MismatchedDimensionException
x1
- The first x-value.x2
- The second x-value.y1
- The first y-value.y2
- The second y-value.z1
- The first y-value.z2
- The second y-value.crs
- The coordinate reference system.
MismatchedDimensionException
- if the CRS dimension is not valid.public ReferencedEnvelope3D(ReferencedEnvelope3D envelope) throws MismatchedDimensionException
envelope
- The envelope to initialize from
MismatchedDimensionException
- if the CRS dimension is not valid.public ReferencedEnvelope3D(BoundingBox3D bbox) throws MismatchedDimensionException
bbox
- The bounding box to initialize from.
MismatchedDimensionException
- if the CRS dimension is not valid.public ReferencedEnvelope3D(Envelope envelope, CoordinateReferenceSystem crs) throws MismatchedDimensionException
envelope
- The envelope to initialize from.crs
- The coordinate reference system.
MismatchedDimensionExceptionif
- the CRS dimension is not valid.
MismatchedDimensionException
public ReferencedEnvelope3D(Envelope envelope) throws MismatchedDimensionException
envelope
- The envelope to initialize from.
MismatchedDimensionException
- if the CRS dimension is not valid.public ReferencedEnvelope3D(ReferencedEnvelope3D envelope, CoordinateReferenceSystem crs) throws MismatchedDimensionException
envelope
- The envelope to initialize from.crs
- The coordinate reference system.
MismatchedDimensionExceptionif
- the CRS dimension is not valid.
MismatchedDimensionException
Method Detail |
---|
public static boolean intersects(Coordinate p1, Coordinate p2, Coordinate q)
p1
- one extremal point of the envelopep2
- another extremal point of the envelopeq
- the point to test for intersection
true
if q intersects the envelope p1-p2public static boolean intersects(Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2)
p1
- one extremal point of the envelope Pp2
- another extremal point of the envelope Pq1
- one extremal point of the envelope Qq2
- another extremal point of the envelope Q
true
if Q intersects Ppublic void init()
Envelope
.
init
in class Envelope
public void init(double x1, double x2, double y1, double y2, double z1, double z2)
Envelope
for a region defined by maximum and
minimum values.
x1
- the first x-valuex2
- the second x-valuey1
- the first y-valuey2
- the second y-valuez1
- the first z-valuez2
- the second z-valuepublic void init(Coordinate p1, Coordinate p2)
Envelope
to a region defined by two
Coordinates.
init
in class Envelope
p1
- the first Coordinatep2
- the second Coordinatepublic void init(Coordinate p)
Envelope
to a region defined by a single
Coordinate.
init
in class Envelope
p
- the coordinatepublic void init(Envelope env)
init
in class Envelope
public void init(ReferencedEnvelope3D env)
Envelope
from an existing 3D Envelope.
env
- the 3D Envelope to initialize frompublic void setToNull()
Envelope
a "null" envelope, that is, the envelope
of the empty geometry.
setToNull
in class Envelope
public double getDepth()
Envelope
public double getMinZ()
Envelope
s minimum z-value. min z > max z
indicates that this is a null Envelope
.
getMinZ
in interface BoundingBox3D
public double getMaxZ()
Envelope
s maximum z-value. min z > max z
indicates that this is a null Envelope
.
getMaxZ
in interface BoundingBox3D
public double getVolume()
public double minExtent()
minExtent
in class Envelope
public double maxExtent()
maxExtent
in class Envelope
public void expandToInclude(Coordinate p)
Envelope
so that it contains the given
Coordinate
. Has no effect if the point is already on or within
the envelope.
expandToInclude
in class Envelope
p
- the Coordinate to expand to includepublic void expandBy(double distance)
expandBy
in class Envelope
distance
- the distance to expand the envelopepublic void expandBy(double deltaX, double deltaY, double deltaZ)
deltaX
- the distance to expand the envelope along the the X axisdeltaY
- the distance to expand the envelope along the the Y axispublic void expandToInclude(double x, double y, double z)
Envelope
so that it contains the given point.
Has no effect if the point is already on or within the envelope.
x
- the value to lower the minimum x to or to raise the maximum x
toy
- the value to lower the minimum y to or to raise the maximum y
toz
- the value to lower the minimum z to or to raise the maximum z
topublic void expandToInclude(DirectPosition pt)
ReferencedEnvelope
expandToInclude
in class ReferencedEnvelope
public void translate(double transX, double transY, double transZ)
transX
- the amount to translate along the X axistransY
- the amount to translate along the Y axistransZ
- the amount to translate along the Z axispublic Coordinate centre()
centre
in class Envelope
null
if the
envelope is nullpublic boolean intersects(ReferencedEnvelope3D other)
other
overlaps (intersects)
the region of this Envelope
.
other
- the Envelope
which this Envelope
is
being checked for overlapping
true
if the Envelope
s overlappublic boolean overlaps(ReferencedEnvelope3D other)
public boolean intersects(Coordinate p)
p
overlaps (lies inside) the region of
this Envelope
.
intersects
in class Envelope
p
- the Coordinate
to be tested
true
if the point overlaps this
Envelope
public boolean overlaps(Coordinate p)
overlaps
in class Envelope
public boolean intersects(double x, double y, double z)
(x, y)
overlaps (lies inside) the region
of this Envelope
.
x
- the x-ordinate of the pointy
- the y-ordinate of the pointz
- the z-ordinate of the point
true
if the point overlaps this
Envelope
public boolean overlaps(double x, double y, double z)
public boolean contains(Coordinate p)
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
contains
in class Envelope
p
- the point which this Envelope
is being checked
for containing
true
if the point lies in the interior or on the
boundary of this Envelope
.covers(Coordinate)
public boolean contains(double x, double y, double z)
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
contains
in interface BoundingBox3D
x
- the x-coordinate of the point which this Envelope
is being checked for containingy
- the y-coordinate of the point which this Envelope
is being checked for containingz
- The second ordinate value.
true
if (x, y)
lies in the interior or
on the boundary of this Envelope
.Envelope.covers(double, double)
public boolean covers(double x, double y, double z)
x
- the x-coordinate of the point which this Envelope
is being checked for containingy
- the y-coordinate of the point which this Envelope
is being checked for containing
true
if (x, y)
lies in the interior or
on the boundary of this Envelope
.public boolean covers(Coordinate p)
covers
in class Envelope
p
- the point which this Envelope
is being checked
for containing
true
if the point lies in the interior or on the
boundary of this Envelope
.public boolean covers(ReferencedEnvelope3D other)
Envelope other
lies wholely inside this
Envelope
(inclusive of the boundary).
other
- the Envelope
to check
Envelope
covers the other
public double distance(ReferencedEnvelope3D env)
Envelope
. The
distance between overlapping Envelopes is 0. Otherwise, the distance is
the Euclidean distance between the closest points.
public void init(BoundingBox bounds)
init
in class ReferencedEnvelope
public int getDimension()
getDimension
in interface Envelope
getDimension
in class ReferencedEnvelope
public double getMinimum(int dimension)
getMinimum
in interface Envelope
getMinimum
in class ReferencedEnvelope
dimension
- The dimension for which to obtain the ordinate value.
RectangularShape.getMinX()
,
RectangularShape.getMinY()
public double getMaximum(int dimension)
getMaximum
in interface Envelope
getMaximum
in class ReferencedEnvelope
dimension
- The dimension for which to obtain the ordinate value.
RectangularShape.getMaxX()
,
RectangularShape.getMaxY()
public double getMedian(int dimension)
getMedian
in interface Envelope
getMedian
in class ReferencedEnvelope
dimension
- The dimension for which to obtain the ordinate value.
RectangularShape.getCenterX()
,
RectangularShape.getCenterY()
public double getSpan(int dimension)
getSpan
in interface Envelope
getSpan
in class ReferencedEnvelope
dimension
- The dimension for which to obtain the ordinate value.
RectangularShape.getWidth()
,
RectangularShape.getHeight()
public DirectPosition getLowerCorner()
Envelope
.
getLowerCorner
in interface Envelope
getLowerCorner
in class ReferencedEnvelope
public DirectPosition getUpperCorner()
Envelope
.
getUpperCorner
in interface Envelope
getUpperCorner
in class ReferencedEnvelope
public boolean isEmpty()
true
if lengths along all dimension are zero.
isEmpty
in interface BoundingBox
isEmpty
in class ReferencedEnvelope
true
if this bounding box is empty.public boolean contains(DirectPosition pos)
true
if the provided location is contained by this bounding box.
contains
in interface BoundingBox
contains
in class ReferencedEnvelope
pos
- The direct position to test for inclusion.
true
if the given position is inside this bounds.public boolean contains(BoundingBox3D bbox)
true
if the provided bounds are contained by this bounding box.
public boolean intersects(BoundingBox3D bbox)
public ReferencedEnvelope3D intersection(ReferencedEnvelope3D env)
Envelope
s.
env
- the envelope to intersect with
public void include(BoundingBox3D bbox)
public void expandToInclude(ReferencedEnvelope3D other)
Envelope
so that it contains the
other
Envelope. Has no effect if other
is
wholly on or within the envelope.
other
- the Envelope
to expand to includepublic void include(double x, double y, double z)
include
in interface BoundingBox3D
x
- The first ordinate value.y
- The second ordinate value.z
- The third ordinate value.public void setBounds(BoundingBox3D bbox)
public BoundingBox toBounds(CoordinateReferenceSystem targetCRS) throws TransformException
transform
method.
toBounds
in interface BoundingBox
toBounds
in interface BoundingBox3D
toBounds
in class ReferencedEnvelope
targetCRS
- The target CRS for the bounding box to be returned.
TransformException
- if no transformation path has been found from
this box CRS to the specified
target CRS, or if the transformation failed for an other reason.public ReferencedEnvelope transform(CoordinateReferenceSystem targetCRS, boolean lenient) throws TransformException, FactoryException
This method can handle the case where the envelope contains the North or South pole, or when it cross the ±180� longitude.
transform
in class ReferencedEnvelope
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.
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)
public ReferencedEnvelope transform(CoordinateReferenceSystem targetCRS, boolean lenient, int numPointsForTransformation) throws TransformException, FactoryException
This method can handle the case where the envelope contains the North or South pole, or when it cross the ±180� longitude.
transform
in class ReferencedEnvelope
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.
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)
public int hashCode()
hashCode
in class ReferencedEnvelope
public boolean equals(Object other)
equals
in class ReferencedEnvelope
public boolean boundsEquals3D(Envelope other, double eps)
Note: in this test:
other
- other envelopeeps
- a small tolerance factor (e.g. 1.0e-6d) which will be scaled
relative to this envlope's width and height
public void include(double x, double y)
ReferencedEnvelope
include
in interface BoundingBox
include
in class ReferencedEnvelope
x
- The first ordinate value.y
- The second ordinate value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |