19 #ifndef GEOS_GEOM_ENVELOPE_H
20 #define GEOS_GEOM_ENVELOPE_H
23 #include <geos/export.h>
24 #include <geos/inline.h>
25 #include <geos/geom/Coordinate.h>
64 typedef std::unique_ptr<Envelope> Ptr;
79 Envelope(
double x1,
double x2,
double y1,
double y2);
157 void init(
double x1,
double x2,
double y1,
double y2);
214 return getWidth() * getHeight();
288 expandBy(p_distance, p_distance);
320 void expandToInclude(
const Envelope& other);
337 return covers(other);
341 contains(
const Envelope* other)
const
343 return contains(*other);
356 return covers(p.
x, p.
y);
400 bool intersects(
const Envelope& other)
const;
411 bool disjoint(
const Envelope& other)
const;
441 return covers(*other);
498 size_t hashCode()
const;
508 std::vector<std::string> split(
const std::string& str,
509 const std::string& delimiters =
" ");
511 static double distance(
double x0,
double y0,
double x1,
double y1);
533 # include "geos/geom/Envelope.inl"
536 #endif // ndef GEOS_GEOM_ENVELOPE_H
double distance(const Envelope &env) const
Computes the distance between this and another Envelope.
double getMaxY() const
Returns the Envelope maximum y-value. min y > max y indicates that this is a null Envelope.
void translate(double transX, double transY)
Translates this envelope by given amounts in the X and Y direction.
std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Envelope & operator=(const Envelope &e)
Assignment operator.
bool intersects(const Envelope *other) const
Check if the region defined by other Envelope intersects the region of this Envelope.
void expandBy(double deltaX, double deltaY)
Expands this envelope by a given distance in all directions. Both positive and negative distances are...
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26
bool intersects(const Coordinate &a, const Coordinate &b) const
Check if the extent defined by two extremal points intersects the extent of this Envelope.
void init(const Coordinate &p)
Initialize an Envelope to a region defined by a single Coordinate.
Envelope(const Coordinate &p)
Creates an Envelope for a region defined by a single Coordinate.
void expandToInclude(const Envelope *other)
Enlarges the boundary of the Envelope so that it contains other.
bool operator==(const Coordinate &a, const Coordinate &b)
Equality operator for Coordinate. 2D only.
static double distanceSquaredToCoordinate(const Coordinate &c, const Coordinate &p1, const Coordinate &p2)
Computes the squared distance between one Coordinate and an Envelope defined by two other Coordinates...
double y
y-coordinate
Definition: Coordinate.h:83
bool intersection(const Envelope &env, Envelope &result) const
Computes the intersection of two Envelopes.
Envelope(double x1, double x2, double y1, double y2)
Creates an Envelope for a region defined by maximum and minimum values.
double distanceSquared(const Envelope &env) const
Computes the square of the distance between this and another Envelope.
bool contains(const Envelope &other) const
Tests if the Envelope other lies wholly inside this Envelope (inclusive of the boundary).
Definition: Envelope.h:335
Envelope()
Creates a null Envelope.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
void expandToInclude(const Coordinate &p)
Enlarges the boundary of the Envelope so that it contains p. Does nothing if p is already on or withi...
Envelope(const Coordinate &p1, const Coordinate &p2)
Creates an Envelope for a region defined by two Coordinates.
bool centre(Coordinate ¢re) const
Computes the coordinate of the centre of this envelope (as long as it is non-null).
Envelope(const std::string &str)
Create an Envelope from an Envelope string representation produced by Envelope::toString()
bool intersects(const Coordinate &p) const
Check if the point p intersects (lies inside) the region of this Envelope.
double getWidth(void) const
Returns the difference between the maximum and minimum x values.
std::string toString(void) const
Returns a string of the form Env[minx:maxx,miny:maxy].
void init(const Coordinate &p1, const Coordinate &p2)
Initialize an Envelope to a region defined by two Coordinates.
bool contains(double x, double y) const
Returns true if the given point lies in or on the envelope.
Definition: Envelope.h:370
static bool intersects(const Coordinate &p1, const Coordinate &p2, const Coordinate &q1, const Coordinate &q2)
Test the envelope defined by p1-p2 for intersection with the envelope defined by q1-q2.
double x
x-coordinate
Definition: Coordinate.h:80
bool covers(const Envelope &other) const
Tests if the Envelope other lies wholly inside this Envelope (inclusive of the boundary).
double getArea() const
Gets the area of this envelope.
Definition: Envelope.h:212
void expandBy(double p_distance)
Expands this envelope by a given distance in all directions.
Definition: Envelope.h:286
double getMaxX() const
Returns the Envelope maximum x-value. min x > max x indicates that this is a null Envelope.
double getHeight(void) const
Returns the difference between the maximum and minimum y values.
bool equals(const Envelope *other) const
Returns true if the Envelope other spatially equals this Envelope.
bool disjoint(const Envelope *other) const
static double distanceToCoordinate(const Coordinate &c, const Coordinate &p1, const Coordinate &p2)
Computes the distance between one Coordinate and an Envelope defined by two other Coordinates....
bool covers(double x, double y) const
Tests if the given point lies in or on the envelope.
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
bool intersects(double x, double y) const
Check if the point (x, y) intersects (lies inside) the region of this Envelope.
void init(double x1, double x2, double y1, double y2)
Initialize an Envelope for a region defined by maximum and minimum values.
bool covers(const Coordinate *p) const
Tests if the given point lies in or on the envelope.
double getMinY() const
Returns the Envelope minimum y-value. min y > max y indicates that this is a null Envelope.
bool isNull(void) const
Returns true if this Envelope is a "null" envelope.
static bool intersects(const Coordinate &p1, const Coordinate &p2, const Coordinate &q)
Test the point q to see whether it intersects the Envelope defined by p1-p2.
double getMinX() const
Returns the Envelope minimum x-value. min x > max x indicates that this is a null Envelope.
bool contains(const Coordinate &p) const
Returns true if the given point lies in or on the envelope.
Definition: Envelope.h:354
void setToNull(void)
Makes this Envelope a "null" envelope, that is, the envelope of the empty geometry.
void expandToInclude(double x, double y)
Enlarges the boundary of the Envelope so that it contains (x,y).
void init(void)
Initialize to a null Envelope.
Envelope(const Envelope &env)
Copy constructor.