GEOS  3.11.0
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 #pragma once
16 
17 #include <geos/export.h>
18 
19 #ifdef _MSC_VER
20 #pragma warning(push)
21 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
22 #endif
23 
24 #include <memory>
25 #include <list>
26 #include <vector>
27 
28 
29 // Forward declarations
30 namespace geos {
31 namespace geom {
32 class Coordinate;
33 class Geometry;
34 class GeometryFactory;
35 class Polygon;
36 class LineString;
37 class Point;
38 }
39 namespace operation {
40 namespace intersection {
41 class Rectangle;
42 }
43 }
44 }
45 
46 namespace geos {
47 namespace operation { // geos::operation
48 namespace intersection { // geos::operation::intersection
49 
63  // Regular users are not supposed to use this utility class.
64  friend class RectangleIntersection;
65 
66 public:
67 
69 
70 private:
71 
75  std::unique_ptr<geom::Geometry> build();
76 
83  void reconnectPolygons(const Rectangle& rect);
84 
105  void reconnect();
106 
107  void reverseLines();
108 
112  void release(RectangleIntersectionBuilder& parts);
113 
114  // Adding Geometry components
115  void add(geom::Polygon* g);
116  void add(geom::LineString* g);
117  void add(geom::Point* g);
118 
119  // Trivial methods
120  bool empty() const;
121  void clear();
122 
123  // Added components
124  std::list<geom::Polygon*> polygons;
125  std::list<geom::LineString*> lines;
126  std::list<geom::Point*> points;
127 
140  void close_boundary(
141  const Rectangle& rect,
142  std::vector<geom::Coordinate>* ring,
143  double x1, double y1,
144  double x2, double y2);
145 
146  void close_ring(const Rectangle& rect, std::vector<geom::Coordinate>* ring);
147 
149  : _gf(f) {}
150 
151  const geom::GeometryFactory& _gf;
152 
153 }; // class RectangleIntersectionBuilder
154 
155 } // namespace geos::operation::intersection
156 } // namespace geos::operation
157 } // namespace geos
158 
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Definition: LineString.h:66
Definition: Point.h:63
Represents a linear polygon, which may include holes.
Definition: Polygon.h:61
Rebuild geometries from subpaths left by clipping with a rectangle.
Definition: RectangleIntersectionBuilder.h:62
Speed-optimized clipping of a Geometry with a rectangle.
Definition: RectangleIntersection.h:74
Clipping rectangle.
Definition: Rectangle.h:50
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25