GEOS  3.9.0dev
RectangleContains.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
12  *
13  **********************************************************************
14  *
15  * Last port: operation/predicate/RectangleContains.java rev 1.5 (JTS-1.10)
16  *
17  **********************************************************************/
18
19 #ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
20 #define GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
21
22 #include <geos/export.h>
23
24 #include <geos/geom/Polygon.h> // for inlines
25
26 // Forward declarations
27 namespace geos {
28 namespace geom {
29 class Envelope;
30 class Geometry;
31 class Point;
32 class Coordinate;
33 class LineString;
34 //class Polygon;
35 }
36 }
37
38 namespace geos {
39 namespace operation { // geos::operation
40 namespace predicate { // geos::operation::predicate
41
51 class GEOS_DLL RectangleContains {
52
53 private:
54
55  const geom::Envelope& rectEnv;
56
57  bool isContainedInBoundary(const geom::Geometry& geom);
58
59  bool isPointContainedInBoundary(const geom::Point& geom);
60
68  bool isPointContainedInBoundary(const geom::Coordinate& pt);
69
77  bool isLineStringContainedInBoundary(const geom::LineString& line);
78
87  bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
88  const geom::Coordinate& p1);
89
90 public:
91
92  static bool
93  contains(const geom::Polygon& rect, const geom::Geometry& b)
94  {
95  RectangleContains rc(rect);
96  return rc.contains(b);
97  }
98
105  :
106  rectEnv(*(rect.getEnvelopeInternal()))
107  {}
108
109  bool contains(const geom::Geometry& geom);
110
111  // Declare type as noncopyable
112  RectangleContains(const RectangleContains& other) = delete;
113  RectangleContains& operator=(const RectangleContains& rhs) = delete;
114 };
115
116
117
118 } // namespace geos::operation::predicate
119 } // namespace geos::operation
120 } // namespace geos
121
122 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
RectangleContains(const geom::Polygon &rect)
Definition: RectangleContains.h:104
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: LineString.h:68
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26
Optimized implementation of spatial predicate "contains" for cases where the first Geometry is a rect...
Definition: RectangleContains.h:51
Definition: Point.h:66