GEOS  3.9.1dev
RectangleIntersection.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_RECTANGLE_INTERSECTION_H
16 #define GEOS_OP_RECTANGLE_INTERSECTION_H
17 
18 #include <geos/export.h>
19 
20 #include <memory>
21 
22 #ifdef _MSC_VER
23 #pragma warning(push)
24 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
25 #endif
26 
27 // Forward declarations
28 namespace geos {
29 namespace geom {
30 class Point;
31 class MultiPoint;
32 class Polygon;
33 class MultiPolygon;
34 class LineString;
35 class MultiLineString;
36 class Geometry;
37 class GeometryCollection;
38 class GeometryFactory;
39 class CoordinateSequenceFactory;
40 }
41 namespace operation {
42 namespace intersection {
43 class Rectangle;
44 class RectangleIntersectionBuilder;
45 }
46 }
47 }
48 
49 namespace geos {
50 namespace operation { // geos::operation
51 namespace intersection { // geos::operation::intersection
52 
76 public:
77 
86  static std::unique_ptr<geom::Geometry> clip(const geom::Geometry& geom,
87  const Rectangle& rect);
88 
100  static std::unique_ptr<geom::Geometry> clipBoundary(const geom::Geometry& geom,
101  const Rectangle& rect);
102 
103 private:
104 
105  RectangleIntersection(const geom::Geometry& geom, const Rectangle& rect);
106 
107  std::unique_ptr<geom::Geometry> clipBoundary();
108 
109  std::unique_ptr<geom::Geometry> clip();
110 
112  const Rectangle& _rect;
115 
116  void clip_geom(const geom::Geometry* g,
118  const Rectangle& rect,
119  bool keep_polygons);
120 
121  void clip_point(const geom::Point* g,
123  const Rectangle& rect);
124 
125  void clip_multipoint(const geom::MultiPoint* g,
127  const Rectangle& rect);
128 
129  void clip_linestring(const geom::LineString* g,
131  const Rectangle& rect);
132 
133  void clip_multilinestring(const geom::MultiLineString* g,
135  const Rectangle& rect);
136 
137  void clip_polygon(const geom::Polygon* g,
139  const Rectangle& rect,
140  bool keep_polygons);
141 
142  void clip_multipolygon(const geom::MultiPolygon* g,
144  const Rectangle& rect,
145  bool keep_polygons);
146 
147  void clip_geometrycollection(
148  const geom::GeometryCollection* g,
150  const Rectangle& rect,
151  bool keep_polygons);
152 
153  void clip_polygon_to_linestrings(const geom::Polygon* g,
155  const Rectangle& rect);
156 
157  void clip_polygon_to_polygons(const geom::Polygon* g,
159  const Rectangle& rect);
160 
161 
168  bool clip_linestring_parts(const geom::LineString* gi,
170  const Rectangle& rect);
171 
172 }; // class RectangleIntersection
173 
174 } // namespace geos::operation::intersection
175 } // namespace geos::operation
176 } // namespace geos
177 
178 #endif // GEOS_OP_RECTANGLE_INTERSECTION_H
#define GEOS_DLL
Definition: export.h:28
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
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...
Represents a collection of heterogeneous Geometry objects.
Basic namespace for all GEOS functionalities.
A factory to create concrete instances of CoordinateSequences.
Rebuild geometries from subpaths left by clipping with a rectangle.
Models a collection of LineStrings.