GEOS 3.6.2
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 {
28 namespace geom {
29 class Envelope;
30 class Geometry;
31 class Point;
32 class Coordinate;
33 class 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::Polygon& rectangle;
56 const geom::Envelope& rectEnv;
57
58 bool isContainedInBoundary(const geom::Geometry& geom);
59
60 bool isPointContainedInBoundary(const geom::Point& geom);
61
69 bool isPointContainedInBoundary(const geom::Coordinate &pt);
70
78 bool isLineStringContainedInBoundary(const geom::LineString &line);
79
88 bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
89 const geom::Coordinate& p1);
90
91public:
92
93 static bool contains(const geom::Polygon& rect, const geom::Geometry& b)
94 {
95 RectangleContains rc(rect);
96 return rc.contains(b);
97 }
98
105 :
106 rectangle(rect),
107 rectEnv(*(rect.getEnvelopeInternal()))
108 {}
109
110 bool contains(const geom::Geometry& geom);
111
112 // Declare type as noncopyable
114 RectangleContains& operator=(const RectangleContains& rhs);
115};
116
117
118
119} // namespace geos::operation::predicate
120} // namespace geos::operation
121} // namespace geos
122
123#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:53
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineString.h:70
Definition Point.h:68
Represents a linear polygon, which may include holes.
Definition Polygon.h:67
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
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25