GEOS  3.3.3
RectangleIntersects.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.refractions.net
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