public class Envelope extends Objectimplements Comparable , Serializable
Geometry, e.g. the minimum and maximum x and y values of the
Coordinates.
Envelopes support infinite or half-infinite 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
Creates an
Envelope for a region defined by a single Coordinate.
|
Envelope(Coordinate
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
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 non-null
|
int |
compareTo(Object
Compares two envelopes using lexicographic ordering.
|
boolean |
contains(Coordinate
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
Tests if the
Envelope other lies wholely inside this
Envelope (inclusive of the boundary).
|
boolean |
covers(Coordinate
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
Tests if the
Envelope other lies wholely inside this
Envelope (inclusive of the boundary).
|
double |
distance(Envelope
Computes the distance between this and another
Envelope.
|
boolean |
equals(Object
|
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
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
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
Envelopes maximum x-value.
|
double |
getMaxY()
Returns the
Envelopes maximum y-value.
|
double |
getMinX()
Returns the
Envelopes minimum x-value.
|
double |
getMinY()
Returns the
Envelopes minimum y-value.
|
double |
getWidth()
Returns the difference between the maximum and minimum x values.
|
int |
hashCode()
|
void |
init()
Initialize to a null
Envelope.
|
void |
init(Coordinate
Initialize an
Envelope to a region defined by a single Coordinate.
|
void |
init(Coordinate
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
Initialize an
Envelope from an existing Envelope.
|
Envelope |
intersection(Envelope
Computes the intersection of two
Envelopes.
|
boolean |
intersects(Coordinate
Check if the point
p overlaps (lies inside) the region of this
Envelope.
|
static boolean |
intersects(Coordinate
Test the point q to see whether it intersects the Envelope defined by p1-p2
|
static boolean |
intersects(Coordinate
Tests whether the envelope defined by p1-p2 and the envelope defined by q1-q2 intersect.
|
boolean |
intersects(double x, double y)
Check if the point
(x, y) overlaps (lies inside) the region of this
Envelope.
|
boolean |
intersects(Envelope
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
Deprecated.
Use #intersects instead.
|
boolean |
overlaps(double x, double y)
Deprecated.
Use #intersects instead.
|
boolean |
overlaps(Envelope
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 |
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 x-value
x2 - the second x-value
y1 - the first y-value
y2 - the second y-value
public Envelope(Coordinatep1, Coordinate p2)
Envelope for a region defined by two Coordinates.
p1 - the first Coordinate
p2 - the second Coordinate
public Envelope(Coordinatep)
Envelope for a region defined by a single Coordinate.
p - the Coordinate
public Envelope(Envelopeenv)
Envelope from an existing Envelope.
env - the Envelope to initialize from
public int hashCode()
public static boolean intersects(Coordinatep1, Coordinate p2, Coordinate q)
p1 - one extremal point of the envelope
p2 - another extremal point of the envelope
q - the point to test for intersection
true if q intersects the envelope p1-p2
public static boolean intersects(Coordinatep1, Coordinate p2, Coordinate q1, Coordinate q2)
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
true if Q intersects P
public 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 x-value
x2 - the second x-value
y1 - the first y-value
y2 - the second y-value
public void init(Coordinatep1, Coordinate p2)
Envelope to a region defined by two Coordinates.
p1 - the first Coordinate
p2 - the second Coordinate
public void init(Coordinatep)
Envelope to a region defined by a single Coordinate.
p - the coordinate
public void init(Envelopeenv)
Envelope from an existing Envelope.
env - the Envelope to initialize from
public 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()
Envelopes minimum x-value. min x > max x indicates that this is a null
Envelope.
public double getMaxX()
Envelopes maximum x-value. min x > max x indicates that this is a null
Envelope.
public double getMinY()
Envelopes minimum y-value. min y > max y indicates that this is a null
Envelope.
public double getMaxY()
Envelopes maximum y-value. min y > max y indicates that this is a null
Envelope.
public double getArea()
public double minExtent()
public double maxExtent()
public void expandToInclude(Coordinatep)
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 include
public void expandBy(double distance)
distance - the distance to expand the envelope
public void expandBy(double deltaX,
double deltaY)
deltaX - the distance to expand the envelope along the the X axis
deltaY - the distance to expand the envelope along the the Y axis
public 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 to
y - the value to lower the minimum y to or to raise the maximum y to
public void expandToInclude(Envelopeother)
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 include
public void translate(double transX,
double transY)
transX - the amount to translate along the X axis
transY - the amount to translate along the Y axis
public Coordinatecentre()
null if the envelope is null
public Envelopeintersection(Envelope env)
Envelopes.
env - the envelope to intersect with
public boolean intersects(Envelopeother)
other overlaps (intersects) the region of this
Envelope.
other - the
Envelope which this
Envelope is being checked for overlapping
true if the
Envelopes overlap
public boolean overlaps(Envelopeother)
public boolean intersects(Coordinatep)
p overlaps (lies inside) the region of this
Envelope.
p - the
Coordinate to be tested
true if the point overlaps this
Envelope
public boolean overlaps(Coordinatep)
public boolean intersects(double x,
double y)
(x, y) overlaps (lies inside) the region of this
Envelope.
x - the x-ordinate of the point
y - the y-ordinate of the point
true if the point overlaps this
Envelope
public boolean overlaps(double x,
double y)
public boolean contains(Envelopeother)
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 check
other is contained in this
Envelope
covers(Envelope)
public boolean contains(Coordinatep)
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 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)
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
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
true 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 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
true if
(x, y) lies in the interior or on the boundary of this
Envelope.
public boolean covers(Coordinatep)
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(Envelopeother)
Envelope other lies wholely inside this
Envelope (inclusive of the boundary).
other - the
Envelope to check
Envelope covers the
other
public double distance(Envelopeenv)
Envelope. The distance between overlapping Envelopes is 0. Otherwise, the distance is the Euclidean distance between the closest points.
public boolean equals(Objectother)
public StringtoString()
public int compareTo(Objecto)
compareTo in interface
Comparable
o - an Envelope object