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);
58 class GEOS_DLL Envelope {
62 friend 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);
87 Envelope(
const Coordinate& p1,
const Coordinate& p2);
94 Envelope(
const Coordinate& p);
97 Envelope(
const Envelope& env);
100 Envelope& operator=(
const Envelope& e);
106 Envelope(
const std::string& str);
117 static bool intersects(
const Coordinate& p1,
const Coordinate& p2,
118 const Coordinate& q);
131 static bool intersects(
const Coordinate& p1,
const Coordinate& p2,
132 const Coordinate& q1,
const Coordinate& q2);
142 bool intersects(
const Coordinate& a,
const Coordinate& b)
const;
157 void init(
double x1,
double x2,
double y1,
double y2);
165 void init(
const Coordinate& p1,
const Coordinate& p2);
172 void init(
const Coordinate& p);
181 void setToNull(
void);
189 bool isNull(
void)
const;
196 double getWidth(
void)
const;
203 double getHeight(
void)
const;
214 return getWidth() * getHeight();
221 double getMaxY()
const;
227 double getMaxX()
const;
233 double getMinY()
const;
239 double getMinX()
const;
248 bool centre(Coordinate& centre)
const;
259 bool intersection(
const Envelope& env, Envelope& result)
const;
267 void translate(
double transX,
double transY);
276 void expandBy(
double deltaX,
double deltaY);
286 expandBy(
double p_distance)
288 expandBy(p_distance, p_distance);
298 void expandToInclude(
const Coordinate& p);
310 void expandToInclude(
double x,
double y);
319 void expandToInclude(
const Envelope* other);
334 contains(
const Envelope& other)
const
336 return covers(other);
340 contains(
const Envelope* other)
const
342 return contains(*other);
353 contains(
const Coordinate& p)
const
355 return covers(p.x, p.y);
369 contains(
double x,
double y)
const
380 bool intersects(
const Coordinate& p)
const;
389 bool intersects(
double x,
double y)
const;
397 bool intersects(
const Envelope* other)
const;
399 bool intersects(
const Envelope& other)
const;
408 bool covers(
double x,
double y)
const;
416 bool covers(
const Coordinate* p)
const;
424 bool covers(
const Envelope& other)
const;
427 covers(
const Envelope* other)
const
429 return covers(*other);
439 bool equals(
const Envelope* other)
const;
446 std::string toString(
void)
const;
454 double distance(
const Envelope* env)
const;
456 size_t hashCode()
const;
466 std::vector<std::string> split(
const std::string& str,
467 const std::string& delimiters =
" ");
469 static double distance(
double x0,
double y0,
double x1,
double y1);
485 GEOS_DLL
bool operator==(
const Envelope& a,
const Envelope& b);
491 # include "geos/geom/Envelope.inl"
494 #endif // ndef GEOS_GEOM_ENVELOPE_H