GEOS  3.8.0dev
RectangleIntersects.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
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/RectangleIntersects.java r378 (JTS-1.12)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_PREDICATE_RECTANGLEINTERSECTS_H
21 #define GEOS_OP_PREDICATE_RECTANGLEINTERSECTS_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 Polygon;
32 }
33 }
34 
35 namespace geos {
36 namespace operation { // geos::operation
37 namespace predicate { // geos::operation::predicate
38 
52 class GEOS_DLL RectangleIntersects {
53 
54 private:
55 
56  const geom::Polygon& rectangle;
57 
58  const geom::Envelope& rectEnv;
59 
60  // Declare type as noncopyable
61  RectangleIntersects(const RectangleIntersects& other) = delete;
62  RectangleIntersects& operator=(const RectangleIntersects& rhs) = delete;
63 
64 public:
65 
72  :
73  rectangle(newRect),
74  rectEnv(*(newRect.getEnvelopeInternal()))
75  {}
76 
77  bool intersects(const geom::Geometry& geom);
78 
86  static bool
87  intersects(const geom::Polygon& rectangle,
88  const geom::Geometry& b)
89  {
90  RectangleIntersects rp(rectangle);
91  return rp.intersects(b);
92  }
93 
94 };
95 
96 
97 } // namespace geos::operation::predicate
98 } // namespace geos::operation
99 } // namespace geos
100 
101 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLEINTERSECTS_H
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Optimized implementation of the "intersects" spatial predicate for cases where one Geometry is a rect...
Definition: RectangleIntersects.h:52
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
static bool intersects(const geom::Polygon &rectangle, const geom::Geometry &b)
Tests whether a rectangle intersects a given geometry.
Definition: RectangleIntersects.h:87
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
RectangleIntersects(const geom::Polygon &newRect)
Create a new intersects computer for a rectangle.
Definition: RectangleIntersects.h:71
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25