GEOS  3.4.2
RectangleIntersects.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
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
62  RectangleIntersects& operator=(const RectangleIntersects& rhs);
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 intersects(const geom::Polygon &rectangle,
87  const geom::Geometry &b)
88  {
89  RectangleIntersects rp(rectangle);
90  return rp.intersects(b);
91  }
92 
93 };
94 
95 
96 } // namespace geos::operation::predicate
97 } // namespace geos::operation
98 } // namespace geos
99 
100 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLEINTERSECTS_H
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:53
Optimized implementation of the &quot;intersects&quot; 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:167
static bool intersects(const geom::Polygon &rectangle, const geom::Geometry &b)
Tests whether a rectangle intersects a given geometry.
Definition: RectangleIntersects.h:86
Represents a linear polygon, which may include holes.
Definition: Polygon.h:66
RectangleIntersects(const geom::Polygon &newRect)
Create a new intersects computer for a rectangle.
Definition: RectangleIntersects.h:71