GEOS 3.11.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#pragma once
16
17#include <geos/export.h>
18
19#include <memory>
20
21#ifdef _MSC_VER
22#pragma warning(push)
23#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
24#endif
25
26// Forward declarations
27namespace geos {
28namespace geom {
29class Point;
30class MultiPoint;
31class Polygon;
32class MultiPolygon;
33class LineString;
34class MultiLineString;
35class Geometry;
36class GeometryCollection;
37class GeometryFactory;
38class CoordinateSequenceFactory;
39}
40namespace operation {
41namespace intersection {
42class Rectangle;
43class RectangleIntersectionBuilder;
44}
45}
46}
47
48namespace geos {
49namespace operation { // geos::operation
50namespace intersection { // geos::operation::intersection
51
74class GEOS_DLL RectangleIntersection {
75public:
76
85 static std::unique_ptr<geom::Geometry> clip(const geom::Geometry& geom,
86 const Rectangle& rect);
87
99 static std::unique_ptr<geom::Geometry> clipBoundary(const geom::Geometry& geom,
100 const Rectangle& rect);
101
102private:
103
104 RectangleIntersection(const geom::Geometry& geom, const Rectangle& rect);
105
106 std::unique_ptr<geom::Geometry> clipBoundary();
107
108 std::unique_ptr<geom::Geometry> clip();
109
110 const geom::Geometry& _geom;
111 const Rectangle& _rect;
112 const geom::GeometryFactory* _gf;
114
115 void clip_geom(const geom::Geometry* g,
117 const Rectangle& rect,
118 bool keep_polygons);
119
120 void clip_point(const geom::Point* g,
122 const Rectangle& rect);
123
124 void clip_multipoint(const geom::MultiPoint* g,
126 const Rectangle& rect);
127
128 void clip_linestring(const geom::LineString* g,
130 const Rectangle& rect);
131
132 void clip_multilinestring(const geom::MultiLineString* g,
134 const Rectangle& rect);
135
136 void clip_polygon(const geom::Polygon* g,
138 const Rectangle& rect,
139 bool keep_polygons);
140
141 void clip_multipolygon(const geom::MultiPolygon* g,
143 const Rectangle& rect,
144 bool keep_polygons);
145
146 void clip_geometrycollection(
149 const Rectangle& rect,
150 bool keep_polygons);
151
152 void clip_polygon_to_linestrings(const geom::Polygon* g,
154 const Rectangle& rect);
155
156 void clip_polygon_to_polygons(const geom::Polygon* g,
158 const Rectangle& rect);
159
160
167 bool clip_linestring_parts(const geom::LineString* gi,
169 const Rectangle& rect);
170
171}; // class RectangleIntersection
172
173} // namespace geos::operation::intersection
174} // namespace geos::operation
175} // namespace geos
176
A factory to create concrete instances of CoordinateSequences.
Definition: CoordinateSequenceFactory.h:44
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:52
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Definition: LineString.h:66
Models a collection of LineStrings.
Definition: MultiLineString.h:50
Definition: MultiPoint.h:51
Definition: MultiPolygon.h:59
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
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:50
Basic namespace for all GEOS functionalities.
Definition: geos.h:39