GEOS 3.9.1
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.
11 * See the COPYING file for more information.
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
27namespace geos {
28namespace geom {
29class Envelope;
30class Geometry;
31class Point;
32class Coordinate;
33class LineString;
34//class Polygon;
35}
36}
37
38namespace geos {
39namespace operation { // geos::operation
40namespace predicate { // geos::operation::predicate
41
51class GEOS_DLL RectangleContains {
52
53private:
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
90public:
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
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: LineString.h:68
Definition: Point.h:66
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
Optimized implementation of spatial predicate "contains" for cases where the first Geometry is a rect...
Definition: RectangleContains.h:51
RectangleContains(const geom::Polygon &rect)
Definition: RectangleContains.h:104
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26