GEOS  3.6.1
RectangleIntersectionBuilder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2014 Mika Heiskanen <mika.heiskanen@fmi.fi>
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 #ifndef GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H
16 #define GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H
17 
18 #include <geos/export.h>
19 
20 #ifdef _MSC_VER
21 #pragma warning(push)
22 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
23 #endif
24 
25 #include <memory>
26 #include <list>
27 #include <vector>
28 
29 
30 // Forward declarations
31 namespace geos {
32  namespace geom {
33  class Coordinate;
34  class Geometry;
35  class GeometryFactory;
36  class Polygon;
37  class LineString;
38  class Point;
39  }
40  namespace operation {
41  namespace intersection {
42  class Rectangle;
43  }
44  }
45 }
46 
47 namespace geos {
48 namespace operation { // geos::operation
49 namespace intersection { // geos::operation::intersection
50 
64 {
65  // Regular users are not supposed to use this utility class.
66  friend class RectangleIntersection;
67 
68 public:
69 
71 
72 private:
73 
77  std::auto_ptr<geom::Geometry> build();
78 
85  void reconnectPolygons(const Rectangle & rect);
86 
107  void reconnect();
108 
109  void reverseLines();
110 
114  void release(RectangleIntersectionBuilder & parts);
115 
116  // Adding Geometry components
117  void add(geom::Polygon * g);
118  void add(geom::LineString * g);
119  void add(geom::Point * g);
120 
121  // Trivial methods
122  bool empty() const;
123  void clear();
124 
125  // Added components
126  std::list<geom::Polygon *> polygons;
127  std::list<geom::LineString *> lines;
128  std::list<geom::Point *> points;
129 
142  void close_boundary(
143  const Rectangle & rect,
144  std::vector<geom::Coordinate> * ring,
145  double x1, double y1,
146  double x2, double y2);
147 
148  void close_ring(const Rectangle & rect, std::vector<geom::Coordinate> * ring);
149 
151  : _gf(f) {}
152 
153  const geom::GeometryFactory &_gf;
154 
155 }; // class RectangleIntersectionBuilder
156 
157 } // namespace geos::operation::intersection
158 } // namespace geos::operation
159 } // namespace geos
160 
161 #endif // GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H
Speed-optimized clipping of a Geometry with a rectangle.
Definition: RectangleIntersection.h:74
Definition: LineString.h:70
Represents a linear polygon, which may include holes.
Definition: Polygon.h:66
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Rebuild geometries from subpaths left by clipping with a rectangle.
Definition: RectangleIntersectionBuilder.h:63
Definition: Point.h:67
Clipping rectangle.
Definition: Rectangle.h:51