GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

RectangleContains.h
1 /**********************************************************************
2 * $Id: RectangleContains.h 2781 2009-12-03 19:48:04Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: operation/predicate/RectangleContains.java rev 1.5 (JTS-1.10)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
21 #define GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
22
23 #include <geos/export.h>
24
25 #include <geos/geom/Polygon.h> // for inlines
26
27 // Forward declarations
28 namespace geos {
29 namespace geom {
30 class Envelope;
31 class Geometry;
32 class Point;
33 class Coordinate;
34 class LineString;
35 //class Polygon;
36 }
37 }
38
39 namespace geos {
40 namespace operation { // geos::operation
41 namespace predicate { // geos::operation::predicate
42
52 class GEOS_DLL RectangleContains {
53
54 private:
55
56 const geom::Polygon& rectangle;
57 const geom::Envelope& rectEnv;
58
59 bool isContainedInBoundary(const geom::Geometry& geom);
60
61 bool isPointContainedInBoundary(const geom::Point& geom);
62
70 bool isPointContainedInBoundary(const geom::Coordinate &pt);
71
79 bool isLineStringContainedInBoundary(const geom::LineString &line);
80
89 bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
90 const geom::Coordinate& p1);
91
92 public:
93
94 static bool contains(const geom::Polygon& rect, const geom::Geometry& b)
95 {
96 RectangleContains rc(rect);
97 return rc.contains(b);
98 }
99
105 RectangleContains(const geom::Polygon& rect)
106 :
107 rectangle(rect),
108 rectEnv(*(rect.getEnvelopeInternal()))
109 {}
110
111 bool contains(const geom::Geometry& geom);
112
113 // Declare type as noncopyable
114 RectangleContains(const RectangleContains& other);
115 RectangleContains& operator=(const RectangleContains& rhs);
116 };
117
118
119
120 } // namespace geos::operation::predicate
121 } // namespace geos::operation
122 } // namespace geos
123
124 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H