GEOS 3.9.1
RectangleIntersection.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_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
28namespace geos {
29namespace geom {
30class Point;
31class MultiPoint;
32class Polygon;
33class MultiPolygon;
34class LineString;
35class MultiLineString;
36class Geometry;
37class GeometryCollection;
38class GeometryFactory;
39class CoordinateSequenceFactory;
40}
41namespace operation {
42namespace intersection {
43class Rectangle;
44class RectangleIntersectionBuilder;
45}
46}
47}
48
49namespace geos {
50namespace operation { // geos::operation
51namespace intersection { // geos::operation::intersection
52
75class GEOS_DLL RectangleIntersection {
76public:
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
103private:
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
111 const geom::Geometry& _geom;
112 const Rectangle& _rect;
113 const geom::GeometryFactory* _gf;
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(
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
A factory to create concrete instances of CoordinateSequences.
Definition CoordinateSequenceFactory.h:48
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:55
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:68
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:188
Definition LineString.h:68
Models a collection of LineStrings.
Definition MultiLineString.h:51
Definition MultiPoint.h:54
Definition MultiPolygon.h:59
Definition Point.h:66
Represents a linear polygon, which may include holes.
Definition Polygon.h:64
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:75
static std::unique_ptr< geom::Geometry > clipBoundary(const geom::Geometry &geom, const Rectangle &rect)
Clip boundary of a geometry with a rectangle.
static std::unique_ptr< geom::Geometry > clip(const geom::Geometry &geom, const Rectangle &rect)
Clip geometry with a rectangle.
Clipping rectangle.
Definition Rectangle.h:51
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26