GEOS 3.11.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#pragma once
20
21#include <geos/export.h>
22
23#include <geos/geom/Polygon.h> // for inlines
24
25// Forward declarations
26namespace geos {
27namespace geom {
28class Envelope;
29class Geometry;
30class Point;
31class Coordinate;
32class LineString;
33//class Polygon;
34}
35}
36
37namespace geos {
38namespace operation { // geos::operation
39namespace predicate { // geos::operation::predicate
40
50class GEOS_DLL RectangleContains {
51
52private:
53
54 const geom::Envelope& rectEnv;
55
56 bool isContainedInBoundary(const geom::Geometry& geom);
57
58 bool isPointContainedInBoundary(const geom::Point& geom);
59
67 bool isPointContainedInBoundary(const geom::Coordinate& pt);
68
76 bool isLineStringContainedInBoundary(const geom::LineString& line);
77
86 bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
87 const geom::Coordinate& p1);
88
89public:
90
91 static bool
92 contains(const geom::Polygon& rect, const geom::Geometry& b)
93 {
94 RectangleContains rc(rect);
95 return rc.contains(b);
96 }
97
104 :
105 rectEnv(*(rect.getEnvelopeInternal()))
106 {}
107
108 bool contains(const geom::Geometry& geom);
109
110 // Declare type as noncopyable
111 RectangleContains(const RectangleContains& other) = delete;
112 RectangleContains& operator=(const RectangleContains& rhs) = delete;
113};
114
115
116
117} // namespace geos::operation::predicate
118} // namespace geos::operation
119} // namespace geos
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
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:186
Definition: LineString.h:66
Definition: Point.h:63
Represents a linear polygon, which may include holes.
Definition: Polygon.h:61
Optimized implementation of spatial predicate "contains" for cases where the first Geometry is a rect...
Definition: RectangleContains.h:50
RectangleContains(const geom::Polygon &rect)
Definition: RectangleContains.h:103
Basic namespace for all GEOS functionalities.
Definition: geos.h:39