GEOS  3.14.0dev
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 CoordinateSequence;
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,
144  double x1, double y1,
145  double x2, double y2);
146 
147  void close_ring(const Rectangle& rect, geom::CoordinateSequence* ring);
148 
150  : _gf(f) {}
151 
152  const geom::GeometryFactory& _gf;
153 
154 }; // class RectangleIntersectionBuilder
155 
156 } // namespace geos::operation::intersection
157 } // namespace geos::operation
158 } // namespace geos
159 
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:56
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:70
Definition: LineString.h:66
Definition: Point.h:61
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:63
Speed-optimized clipping of a Geometry with a rectangle.
Definition: RectangleIntersection.h:73
Clipping rectangle.
Definition: operation/intersection/Rectangle.h:51
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25