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>
53 class GEOS_DLL Envelope {
57 typedef std::auto_ptr<Envelope> AutoPtr;
73 Envelope(
double x1,
double x2,
double y1,
double y2);
82 Envelope(
const Coordinate& p1,
const Coordinate& p2);
89 Envelope(
const Coordinate& p);
92 Envelope(
const Envelope &env);
95 Envelope& operator=(
const Envelope& e);
101 Envelope(
const std::string &str);
114 static bool intersects(
const Coordinate& p1,
const Coordinate& p2,
115 const Coordinate& q);
128 static bool intersects(
const Coordinate& p1,
const Coordinate& p2,
129 const Coordinate& q1,
const Coordinate& q2);
145 void init(
double x1,
double x2,
double y1,
double y2);
154 void init(
const Coordinate& p1,
const Coordinate& p2);
162 void init(
const Coordinate& p);
171 void setToNull(
void);
181 bool isNull(
void)
const;
188 double getWidth(
void)
const;
195 double getHeight(
void)
const;
203 double getArea()
const
205 return getWidth() * getHeight();
212 double getMaxY()
const;
218 double getMaxX()
const;
224 double getMinY()
const;
230 double getMinX()
const;
240 bool centre(Coordinate& centre)
const;
251 bool intersection(
const Envelope& env, Envelope& result)
const;
259 void translate(
double transX,
double transY);
270 void expandBy(
double deltaX,
double deltaY);
279 void expandBy(
double distance) { expandBy(distance, distance); }
288 void expandToInclude(
const Coordinate& p);
299 void expandToInclude(
double x,
double y);
308 void expandToInclude(
const Envelope* other);
323 bool contains(
const Envelope& other)
const {
324 return covers(other);
327 bool contains(
const Envelope* other)
const {
328 return contains(*other);
340 bool contains(
const Coordinate& p)
const {
341 return covers(p.x, p.y);
359 bool contains(
double x,
double y)
const {
370 bool intersects(
const Coordinate& p)
const;
380 bool intersects(
double x,
double y)
const;
393 bool intersects(
const Envelope& other)
const;
405 bool covers(
double x,
double y)
const;
425 bool covers(
const Envelope& other)
const;
427 bool covers(
const Envelope* other)
const {
428 return covers(*other);
442 bool equals(
const Envelope* other)
const;
451 std::string toString(
void)
const;
460 double distance(
const Envelope* env)
const;
462 int hashCode()
const;
472 std::vector<std::string> split(
const std::string &str,
473 const std::string &delimiters =
" ");
475 static double distance(
double x0,
double y0,
double x1,
double y1);
491 GEOS_DLL
bool operator==(
const Envelope& a,
const Envelope& b);
497 # include "geos/geom/Envelope.inl"
500 #endif // ndef GEOS_GEOM_ENVELOPE_H