#include <geos.h>
Public Member Functions | |
Envelope (void) | |
Envelope (double x1, double x2, double y1, double y2) | |
Envelope (const Coordinate &p1, const Coordinate &p2) | |
Envelope (const Coordinate &p) | |
Envelope (const Envelope &env) | |
virtual | ~Envelope (void) |
Default destructor. | |
void | init (void) |
void | init (double x1, double x2, double y1, double y2) |
void | init (const Coordinate &p1, const Coordinate &p2) |
void | init (const Coordinate &p) |
void | init (Envelope env) |
void | setToNull (void) |
bool | isNull (void) const |
double | getWidth (void) const |
double | getHeight (void) const |
double | getMaxY () const |
double | getMaxX () const |
double | getMinY () const |
double | getMinX () const |
void | expandToInclude (const Coordinate &p) |
void | expandToInclude (double x, double y) |
void | expandToInclude (const Envelope *other) |
bool | contains (const Coordinate &p) const |
bool | contains (double x, double y) const |
bool | contains (const Envelope *other) const |
bool | overlaps (const Coordinate &p) const |
bool | overlaps (double x, double y) const |
bool | overlaps (const Envelope *other) const |
bool | intersects (const Coordinate &p) const |
bool | intersects (double x, double y) const |
bool | intersects (const Envelope *other) const |
string | toString (void) const |
double | distance (const Envelope *env) const |
Static Public Member Functions | |
static bool | intersects (const Coordinate &p1, const Coordinate &p2, const Coordinate &q) |
static bool | intersects (const Coordinate &p1, const Coordinate &p2, const Coordinate &q1, const Coordinate &q2) |
It is often used to represent the bounding box of a Geometry, e.g. the minimum and maximum x and y values of the Coordinates.
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.
geos::Envelope::Envelope | ( | double | x1, | |
double | x2, | |||
double | y1, | |||
double | y2 | |||
) |
geos::Envelope::Envelope | ( | const Coordinate & | p1, | |
const Coordinate & | p2 | |||
) |
Creates an Envelope
for a region defined by two Coordinates.
p1 | the first Coordinate | |
p2 | the second Coordinate |
References init().
geos::Envelope::Envelope | ( | const Coordinate & | p | ) |
Creates an Envelope for a region defined by a single Coordinate.
p | the Coordinate |
References init().
geos::Envelope::Envelope | ( | const Envelope & | env | ) |
bool geos::Envelope::intersects | ( | const Coordinate & | p1, | |
const Coordinate & | p2, | |||
const Coordinate & | q | |||
) | [static] |
Test the point q to see whether it intersects the Envelope defined by p1-p2
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 References geos::Coordinate::x, and geos::Coordinate::y.
Referenced by distance(), intersects(), and overlaps().
bool geos::Envelope::intersects | ( | const Coordinate & | p1, | |
const Coordinate & | p2, | |||
const Coordinate & | q1, | |||
const Coordinate & | q2 | |||
) | [static] |
Test the envelope defined by p1-p2 for intersection with the envelope defined by q1-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 References geos::Coordinate::x, and geos::Coordinate::y.
void geos::Envelope::init | ( | void | ) |
void geos::Envelope::init | ( | double | x1, | |
double | x2, | |||
double | y1, | |||
double | y2 | |||
) |
Initialize an 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 |
void geos::Envelope::init | ( | const Coordinate & | p1, | |
const Coordinate & | p2 | |||
) |
Initialize an Envelope
to a region defined by two Coordinates.
p1 | the first Coordinate | |
p2 | the second Coordinate |
References init(), geos::Coordinate::x, and geos::Coordinate::y.
void geos::Envelope::init | ( | const Coordinate & | p | ) |
Initialize an Envelope
to a region defined by a single Coordinate.
p | the Coordinate |
References init(), geos::Coordinate::x, and geos::Coordinate::y.
void geos::Envelope::init | ( | Envelope | env | ) |
void geos::Envelope::setToNull | ( | void | ) |
bool geos::Envelope::isNull | ( | void | ) | const |
Returns true
if this Envelope
is a "null" envelope.
true
if this Envelope
is uninitialized or is the envelope of the empty geometry. Referenced by contains(), expandToInclude(), getHeight(), getWidth(), and geos::GeometryFactory::toGeometry().
double geos::Envelope::getWidth | ( | void | ) | const |
Returns the difference between the maximum and minimum x values.
Envelope
References isNull().
Referenced by geos::GeometricShapeFactory::createArc(), geos::GeometricShapeFactory::createCircle(), and geos::GeometricShapeFactory::createRectangle().
double geos::Envelope::getHeight | ( | void | ) | const |
Returns the difference between the maximum and minimum y values.
Envelope
References isNull().
Referenced by geos::GeometricShapeFactory::createArc(), geos::GeometricShapeFactory::createCircle(), and geos::GeometricShapeFactory::createRectangle().
double geos::Envelope::getMaxY | ( | ) | const |
Returns the Envelope
s maximum y-value. min y > max y indicates that this is a null Envelope
.
Referenced by contains(), geos::GeometricShapeFactory::createRectangle(), expandToInclude(), and geos::GeometryFactory::toGeometry().
double geos::Envelope::getMaxX | ( | ) | const |
Returns the Envelope
s maximum x-value. min x > max x indicates that this is a null Envelope
.
Referenced by contains(), geos::GeometricShapeFactory::createRectangle(), expandToInclude(), and geos::GeometryFactory::toGeometry().
double geos::Envelope::getMinY | ( | ) | const |
Returns the Envelope
s minimum y-value. min y > max y indicates that this is a null Envelope
.
Referenced by contains(), geos::GeometricShapeFactory::createArc(), geos::GeometricShapeFactory::createCircle(), geos::GeometricShapeFactory::createRectangle(), expandToInclude(), and geos::GeometryFactory::toGeometry().
double geos::Envelope::getMinX | ( | ) | const |
Returns the Envelope
s minimum x-value. min x > max x indicates that this is a null Envelope
.
Referenced by contains(), geos::GeometricShapeFactory::createArc(), geos::GeometricShapeFactory::createCircle(), geos::GeometricShapeFactory::createRectangle(), expandToInclude(), and geos::GeometryFactory::toGeometry().
void geos::Envelope::expandToInclude | ( | const Coordinate & | p | ) |
Enlarges the boundary of the Envelope
so that it contains p. Does nothing if p is already on or within the boundaries.
p | the Coordinate to include |
References geos::Coordinate::x, and geos::Coordinate::y.
void geos::Envelope::expandToInclude | ( | double | x, | |
double | y | |||
) |
void geos::Envelope::expandToInclude | ( | const Envelope * | other | ) |
bool geos::Envelope::contains | ( | const Coordinate & | p | ) | const |
Returns 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
. References geos::Coordinate::x, and geos::Coordinate::y.
Referenced by geos::Geometry::within().
bool geos::Envelope::contains | ( | double | x, | |
double | y | |||
) | const |
Returns 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 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
. bool geos::Envelope::contains | ( | const Envelope * | other | ) | const |
bool geos::Envelope::overlaps | ( | const Coordinate & | p | ) | const |
bool geos::Envelope::overlaps | ( | double | x, | |
double | y | |||
) | const |
bool geos::Envelope::overlaps | ( | const Envelope * | other | ) | const |
References intersects().
bool geos::Envelope::intersects | ( | const Coordinate & | other | ) | const |
Check if the point other
overlaps (lies inside) the region of this Envelope
.
other | the Coordinate to be tested |
true
if the point overlaps this Envelope References intersects(), geos::Coordinate::x, and geos::Coordinate::y.
bool geos::Envelope::intersects | ( | double | x, | |
double | y | |||
) | const |
bool geos::Envelope::intersects | ( | const Envelope * | other | ) | const |
string geos::Envelope::toString | ( | void | ) | const |
Returns a string
of the form Env[minx:maxx,miny:maxy] .
string
of the form Env[minx:maxx,miny:maxy] double geos::Envelope::distance | ( | const Envelope * | env | ) | const |
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.
References intersects(), maxx, maxy, minx, and miny.
Referenced by geos::Geometry::isWithinDistance().