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> 38 GEOS_DLL std::ostream&
operator<< (std::ostream& os,
const Envelope& o);
64 typedef std::unique_ptr<Envelope> Ptr;
79 Envelope(
double x1,
double x2,
double y1,
double y2);
100 explicit Envelope(
const std::string& str);
151 void init(
double x1,
double x2,
double y1,
double y2);
190 double getWidth()
const;
197 double getHeight()
const;
208 return getWidth() * getHeight();
215 double getMaxY()
const;
221 double getMaxX()
const;
227 double getMinY()
const;
233 double getMinX()
const;
261 void translate(
double transX,
double transY);
270 void expandBy(
double deltaX,
double deltaY);
282 expandBy(p_distance, p_distance);
304 void expandToInclude(
double x,
double y);
313 void expandToInclude(
const Envelope* other);
314 void expandToInclude(
const Envelope& other);
331 return covers(other);
335 contains(
const Envelope* other)
const 337 return contains(*other);
350 return covers(p.
x, p.
y);
384 bool intersects(
double x,
double y)
const;
392 bool intersects(
const Envelope* other)
const;
394 bool intersects(
const Envelope& other)
const;
403 bool disjoint(
const Envelope* other)
const;
405 bool disjoint(
const Envelope& other)
const;
414 bool covers(
double x,
double y)
const;
430 bool covers(
const Envelope& other)
const;
435 return covers(*other);
445 bool equals(
const Envelope* other)
const;
452 std::string toString()
const;
460 double distance(
const Envelope& env)
const;
468 double distanceSquared(
const Envelope& env)
const;
479 static double distanceToCoordinate(
const Coordinate & c,
const Coordinate & p1,
const Coordinate & p2);
490 static double distanceSquaredToCoordinate(
const Coordinate & c,
const Coordinate & p1,
const Coordinate & p2);
492 std::size_t hashCode()
const;
502 static std::vector<std::string> split(
const std::string& str,
503 const std::string& delimiters =
" ");
505 static double distance(
double x0,
double y0,
double x1,
double y1);
521 GEOS_DLL
bool operator==(
const Envelope& a,
const Envelope& b);
523 GEOS_DLL
bool operator!=(
const Envelope& a,
const Envelope& b);
527 GEOS_DLL
bool operator< (
const Envelope& a,
const Envelope& b);
534 # include "geos/geom/Envelope.inl" 537 #endif // ndef GEOS_GEOM_ENVELOPE_H An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
double getArea() const
Gets the area of this envelope.
Definition: Envelope.h:206
bool contains(const Coordinate &p) const
Returns true if the given point lies in or on the envelope.
Definition: Envelope.h:348
double y
y-coordinate
Definition: Coordinate.h:83
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
bool operator<(const Coordinate &a, const Coordinate &b)
Strict weak ordering operator for Coordinate.
Definition: Coordinate.h:140
bool contains(const Envelope &other) const
Tests if the Envelope other lies wholly inside this Envelope (inclusive of the boundary).
Definition: Envelope.h:329
std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26
bool operator!=(const Coordinate &a, const Coordinate &b)
Inequality operator for Coordinate. 2D only.
double x
x-coordinate
Definition: Coordinate.h:80
bool operator==(const Coordinate &a, const Coordinate &b)
Equality operator for Coordinate. 2D only.
bool contains(double x, double y) const
Returns true if the given point lies in or on the envelope.
Definition: Envelope.h:364
void expandBy(double p_distance)
Expands this envelope by a given distance in all directions.
Definition: Envelope.h:280