00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
00020 #define GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
00021
00022 #include <geos/export.h>
00023
00024 #include <geos/geom/Polygon.h>
00025
00026
00027 namespace geos {
00028 namespace geom {
00029 class Envelope;
00030 class Geometry;
00031 class Point;
00032 class Coordinate;
00033 class LineString;
00034
00035 }
00036 }
00037
00038 namespace geos {
00039 namespace operation {
00040 namespace predicate {
00041
00051 class GEOS_DLL RectangleContains {
00052
00053 private:
00054
00055 const geom::Polygon& rectangle;
00056 const geom::Envelope& rectEnv;
00057
00058 bool isContainedInBoundary(const geom::Geometry& geom);
00059
00060 bool isPointContainedInBoundary(const geom::Point& geom);
00061
00069 bool isPointContainedInBoundary(const geom::Coordinate &pt);
00070
00078 bool isLineStringContainedInBoundary(const geom::LineString &line);
00079
00088 bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
00089 const geom::Coordinate& p1);
00090
00091 public:
00092
00093 static bool contains(const geom::Polygon& rect, const geom::Geometry& b)
00094 {
00095 RectangleContains rc(rect);
00096 return rc.contains(b);
00097 }
00098
00104 RectangleContains(const geom::Polygon& rect)
00105 :
00106 rectangle(rect),
00107 rectEnv(*(rect.getEnvelopeInternal()))
00108 {}
00109
00110 bool contains(const geom::Geometry& geom);
00111
00112
00113 RectangleContains(const RectangleContains& other);
00114 RectangleContains& operator=(const RectangleContains& rhs);
00115 };
00116
00117
00118
00119 }
00120 }
00121 }
00122
00123 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H