GEOS  3.9.1dev
RectangleIntersectionBuilder.h
Go to the documentation of this file.
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  // Regular users are not supposed to use this utility class.
65  friend class RectangleIntersection;
66 
67 public:
68 
70 
71 private:
72 
76  std::unique_ptr<geom::Geometry> build();
77 
84  void reconnectPolygons(const Rectangle& rect);
85 
106  void reconnect();
107 
108  void reverseLines();
109 
113  void release(RectangleIntersectionBuilder& parts);
114 
115  // Adding Geometry components
116  void add(geom::Polygon* g);
117  void add(geom::LineString* g);
118  void add(geom::Point* g);
119 
120  // Trivial methods
121  bool empty() const;
122  void clear();
123 
124  // Added components
125  std::list<geom::Polygon*> polygons;
126  std::list<geom::LineString*> lines;
127  std::list<geom::Point*> points;
128 
141  void close_boundary(
142  const Rectangle& rect,
143  std::vector<geom::Coordinate>* ring,
144  double x1, double y1,
145  double x2, double y2);
146 
147  void close_ring(const Rectangle& rect, std::vector<geom::Coordinate>* ring);
148 
150  : _gf(f) {}
151 
153 
154 }; // class RectangleIntersectionBuilder
155 
156 } // namespace geos::operation::intersection
157 } // namespace geos::operation
158 } // namespace geos
159 
160 #endif // GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H
#define GEOS_DLL
Definition: export.h:28
Speed-optimized clipping of a Geometry with a rectangle.
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Basic namespace for all GEOS functionalities.
Rebuild geometries from subpaths left by clipping with a rectangle.