public class Envelope extends Object implements Comparable, Serializable
Geometry
,
e.g. the minimum and maximum x and y values of the Coordinate
s.
Envelopes support infinite or halfinfinite regions, by using the values of
Double.POSITIVE_INFINITY
and Double.NEGATIVE_INFINITY
.
Envelope objects may have a null value.
When Envelope objects are created or initialized, the supplies extent values are automatically sorted into the correct order.
Constructor and Description 

Envelope()
Creates a null
Envelope . 
Envelope(Coordinate p)
Creates an
Envelope for a region defined by a single Coordinate. 
Envelope(Coordinate p1,
Coordinate p2)
Creates an
Envelope for a region defined by two Coordinates. 
Envelope(double x1,
double x2,
double y1,
double y2)
Creates an
Envelope for a region defined by maximum and minimum values. 
Envelope(Envelope env)
Create an
Envelope from an existing Envelope. 
Modifier and Type  Method and Description 

Coordinate 
centre()
Computes the coordinate of the centre of this envelope (as long as it is nonnull

int 
compareTo(Object o)
Compares two envelopes using lexicographic ordering.

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

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

boolean 
contains(Envelope other)
Tests if the
Envelope other
lies wholely inside this Envelope (inclusive of the boundary). 
boolean 
covers(Coordinate p)
Tests if the given point lies in or on the envelope.

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

boolean 
covers(Envelope other)
Tests if the
Envelope other
lies wholely inside this Envelope (inclusive of the boundary). 
double 
distance(Envelope env)
Computes the distance between this and another
Envelope . 
boolean 
equals(Object other) 
void 
expandBy(double distance)
Expands this envelope by a given distance in all directions.

void 
expandBy(double deltaX,
double deltaY)
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(double x,
double y)
Enlarges this
Envelope so that it contains
the given point. 
void 
expandToInclude(Envelope other)
Enlarges this
Envelope so that it contains
the other Envelope. 
double 
getArea()
Gets the area of this envelope.

double 
getHeight()
Returns the difference between the maximum and minimum y values.

double 
getMaxX()
Returns the
Envelope s maximum xvalue. 
double 
getMaxY()
Returns the
Envelope s maximum yvalue. 
double 
getMinX()
Returns the
Envelope s minimum xvalue. 
double 
getMinY()
Returns the
Envelope s minimum yvalue. 
double 
getWidth()
Returns the difference between the maximum and minimum x values.

int 
hashCode() 
void 
init()
Initialize to a null
Envelope . 
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)
Initialize an
Envelope for a region defined by maximum and minimum values. 
void 
init(Envelope env)
Initialize an
Envelope from an existing Envelope. 
Envelope 
intersection(Envelope env)
Computes the intersection of two
Envelope s. 
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 p1p2

static boolean 
intersects(Coordinate p1,
Coordinate p2,
Coordinate q1,
Coordinate q2)
Tests whether the envelope defined by p1p2
and the envelope defined by q1q2
intersect.

boolean 
intersects(double x,
double y)
Check if the point
(x, y)
overlaps (lies inside) the region of this Envelope . 
boolean 
intersects(Envelope other)
Check if the region defined by
other
overlaps (intersects) the region of this Envelope . 
boolean 
isNull()
Returns
true if this Envelope is a "null"
envelope. 
double 
maxExtent()
Gets the maximum extent of this envelope across both dimensions.

double 
minExtent()
Gets the minimum extent of this envelope across both dimensions.

boolean 
overlaps(Coordinate p)
Deprecated.
Use #intersects instead.

boolean 
overlaps(double x,
double y)
Deprecated.
Use #intersects instead.

boolean 
overlaps(Envelope other)
Deprecated.
Use #intersects instead. In the future, #overlaps may be
changed to be a true overlap check; that is, whether the intersection is
twodimensional.

void 
setToNull()
Makes this
Envelope a "null" envelope, that is, the envelope
of the empty geometry. 
String 
toString() 
void 
translate(double transX,
double transY)
Translates this envelope by given amounts in the X and Y direction.

public Envelope()
Envelope
.public Envelope(double x1, double x2, double y1, double y2)
Envelope
for a region defined by maximum and minimum values.x1
 the first xvaluex2
 the second xvaluey1
 the first yvaluey2
 the second yvaluepublic Envelope(Coordinate p1, Coordinate p2)
Envelope
for a region defined by two Coordinates.p1
 the first Coordinatep2
 the second Coordinatepublic Envelope(Coordinate p)
Envelope
for a region defined by a single Coordinate.p
 the Coordinatepublic Envelope(Envelope env)
Envelope
from an existing Envelope.env
 the Envelope to initialize frompublic 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 intersectiontrue
if q intersects the envelope p1p2public 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 Qtrue
if Q intersects Ppublic void init()
Envelope
.public void init(double x1, double x2, double y1, double y2)
Envelope
for a region defined by maximum and minimum values.x1
 the first xvaluex2
 the second xvaluey1
 the first yvaluey2
 the second yvaluepublic void init(Coordinate p1, Coordinate p2)
Envelope
to a region defined by two Coordinates.p1
 the first Coordinatep2
 the second Coordinatepublic void init(Coordinate p)
Envelope
to a region defined by a single Coordinate.p
 the coordinatepublic void init(Envelope env)
Envelope
from an existing Envelope.env
 the Envelope to initialize frompublic void setToNull()
Envelope
a "null" envelope, that is, the envelope
of the empty geometry.public boolean isNull()
true
if this Envelope
is a "null"
envelope.true
if this Envelope
is uninitialized
or is the envelope of the empty geometry.public double getWidth()
Envelope
public double getHeight()
Envelope
public double getMinX()
Envelope
s minimum xvalue. min x > max x
indicates that this is a null Envelope
.public double getMaxX()
Envelope
s maximum xvalue. min x > max x
indicates that this is a null Envelope
.public double getMinY()
Envelope
s minimum yvalue. min y > max y
indicates that this is a null Envelope
.public double getMaxY()
Envelope
s maximum yvalue. min y > max y
indicates that this is a null Envelope
.public double getArea()
public double minExtent()
public double maxExtent()
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.p
 the Coordinate to expand to includepublic void expandBy(double distance)
distance
 the distance to expand the envelopepublic void expandBy(double deltaX, double deltaY)
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)
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 topublic void expandToInclude(Envelope 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 translate(double transX, double transY)
transX
 the amount to translate along the X axistransY
 the amount to translate along the Y axispublic Coordinate centre()
null
if the envelope is nullpublic Envelope intersection(Envelope env)
Envelope
s.env
 the envelope to intersect withpublic boolean intersects(Envelope other)
other
overlaps (intersects) the region of this Envelope
.other
 the Envelope
which this Envelope
is
being checked for overlappingtrue
if the Envelope
s overlappublic boolean overlaps(Envelope other)
public boolean intersects(Coordinate p)
p
overlaps (lies inside) the region of this Envelope
.p
 the Coordinate
to be testedtrue
if the point overlaps this Envelope
public boolean overlaps(Coordinate p)
public boolean intersects(double x, double y)
(x, y)
overlaps (lies inside) the region of this Envelope
.x
 the xordinate of the pointy
 the yordinate of the pointtrue
if the point overlaps this Envelope
public boolean overlaps(double x, double y)
public boolean contains(Envelope other)
Envelope other
lies wholely inside this Envelope
(inclusive of the boundary).
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
other
 the Envelope
to checkother
is contained in this Envelope
covers(Envelope)
public boolean contains(Coordinate p)
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
p
 the point which this Envelope
is
being checked for containingtrue
if the point lies in the interior or
on the boundary of this Envelope
.covers(Coordinate)
public boolean contains(double x, double y)
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
x
 the xcoordinate of the point which this Envelope
is
being checked for containingy
 the ycoordinate of the point which this Envelope
is
being checked for containingtrue
if (x, y)
lies in the interior or
on the boundary of this Envelope
.covers(double, double)
public boolean covers(double x, double y)
x
 the xcoordinate of the point which this Envelope
is
being checked for containingy
 the ycoordinate of the point which this Envelope
is
being checked for containingtrue
if (x, y)
lies in the interior or
on the boundary of this Envelope
.public boolean covers(Coordinate p)
p
 the point which this Envelope
is
being checked for containingtrue
if the point lies in the interior or
on the boundary of this Envelope
.public boolean covers(Envelope other)
Envelope other
lies wholely inside this Envelope
(inclusive of the boundary).other
 the Envelope
to checkEnvelope
covers the other
public double distance(Envelope env)
Envelope
.
The distance between overlapping Envelopes is 0. Otherwise, the
distance is the Euclidean distance between the closest points.public int compareTo(Object o)
compareTo
in interface Comparable
o
 an Envelope objectCopyright © 2016. All rights reserved.