00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
00017 #define GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
00018
00019 #include <geos/geom/Polygon.h>
00020
00021
00022 namespace geos {
00023 namespace geom {
00024 class Envelope;
00025 class Geometry;
00026 class Point;
00027 class Coordinate;
00028 class LineString;
00029
00030 }
00031 }
00032
00033 namespace geos {
00034 namespace operation {
00035 namespace predicate {
00036
00047 class RectangleContains {
00048
00049 private:
00050
00051 const geom::Polygon& rectangle;
00052 const geom::Envelope& rectEnv;
00053
00054 bool isContainedInBoundary(const geom::Geometry& geom);
00055 bool isPointContainedInBoundary(const geom::Point& geom);
00056 bool isPointContainedInBoundary(const geom::Coordinate &coord);
00057 bool isLineStringContainedInBoundary(const geom::LineString &line);
00058 bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
00059 const geom::Coordinate& p1);
00060
00061 public:
00062
00063 static bool contains(const geom::Polygon& rect, const geom::Geometry& b)
00064 {
00065 RectangleContains rc(rect);
00066 return rc.contains(b);
00067 }
00068
00074 RectangleContains(const geom::Polygon& rect)
00075 :
00076 rectangle(rect),
00077 rectEnv(*(rect.getEnvelopeInternal()))
00078 {}
00079
00080 bool contains(const geom::Geometry& geom);
00081
00082
00083 };
00084
00085
00086
00087 }
00088 }
00089 }
00090
00091 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H