|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.geometry.iso.topograph2D.Envelope
public class Envelope
Defines a rectangular region of the 2D coordinate plane. It is often used to
represent the bounding box of a Geometry
, e.g. the minimum and
maximum x and y values of the Coordinate
s.
Note that Envelopes support infinite or half-infinite regions, by using the
values of Double.POSITIVE_INFINITY
and
Double.NEGATIVE_INFINITY
.
When Envelope objects are created or initialized, the supplies extent values are automatically sorted into the correct order.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
Coordinate |
centre()
Computes the coordinate of the centre of this envelope (as long as it is non-null |
boolean |
contains(Coordinate p)
Returns true if the given point lies in or on the
envelope. |
boolean |
contains(double x,
double y)
Returns true if the given point lies in or on the
envelope. |
boolean |
contains(Envelope other)
Returns true 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(java.lang.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 the boundary of the Envelope so that it contains
(x,y). |
void |
expandToInclude(double x,
double y)
Enlarges the boundary of the Envelope so that it contains
(x,y). |
void |
expandToInclude(Envelope other)
Enlarges the boundary of the Envelope so that it contains
other . |
double |
getHeight()
Returns the difference between the maximum and minimum y values. |
double |
getMaxX()
Returns the Envelope s maximum x-value. |
double |
getMaxY()
Returns the Envelope s maximum y-value. |
double |
getMinX()
Returns the Envelope s minimum x-value. |
double |
getMinY()
Returns the Envelope s 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 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 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)
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. |
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 two-dimensional. |
void |
setToNull()
Makes this Envelope a "null" envelope, that is, the
envelope of the empty geometry. |
java.lang.String |
toString()
|
void |
translate(double transX,
double transY)
Translates this envelope by given amounts in the X and Y direction. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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-valuex2
- the second x-valuey1
- the first y-valuey2
- the second y-valuepublic 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.
p1
- the Coordinatepublic Envelope(Envelope env)
Envelope
from an existing Envelope.
env
- the Envelope to initialize fromMethod Detail |
---|
public int hashCode()
hashCode
in class java.lang.Object
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
.
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-valuex2
- the second x-valuey1
- the first y-valuey2
- the second y-valuepublic 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.
p1
- the first Coordinatep2
- the second 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 x-value. min x > max x
indicates that this is a null Envelope
.
public double getMaxX()
Envelope
s maximum x-value. min x > max x
indicates that this is a null Envelope
.
public double getMinY()
Envelope
s minimum y-value. min y > max y
indicates that this is a null Envelope
.
public double getMaxY()
Envelope
s maximum y-value. min y > max y
indicates that this is a null Envelope
.
public void expandToInclude(Coordinate p)
Envelope
so that it contains
(x,y). Does nothing if (x,y) is already on or within the boundaries.
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 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
(x,y). Does nothing if (x,y) is already on or within the boundaries.
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
other
. Does nothing if other
is wholly on
or within the boundaries.
other
- the Envelope
to merge withpublic 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 with
public boolean contains(Coordinate p)
true
if the given point lies in or on the
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 contains(double x, double y)
true
if the given point lies in or on the
envelope.
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 intersects(Envelope 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(Envelope other)
public boolean intersects(Coordinate p)
p
overlaps (lies inside) the region of
this Envelope
.
other
- the Coordinate
to be tested
true
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 x-ordinate of the pointy
- the y-ordinate of the point
true
if the point overlaps this
Envelope
public boolean overlaps(double x, double y)
public boolean contains(Envelope other)
true
if the Envelope other
lies
wholely inside this Envelope
(inclusive of the boundary).
other
- the Envelope
which this Envelope
is being checked for containing
true
if other
is contained in this
Envelope
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 boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |