GEOS 3.6.2
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 {
29 namespace geom {
30 class Point;
31 class MultiPoint;
32 class Polygon;
33 class MultiPolygon;
34 class LineString;
35 class MultiLineString;
36 class Geometry;
38 class GeometryFactory;
40 }
41 namespace operation {
42 namespace intersection {
43 class Rectangle;
45 }
46 }
47}
48
49namespace geos {
50namespace operation { // geos::operation
51namespace intersection { // geos::operation::intersection
52
74class GEOS_DLL RectangleIntersection
75{
76 public:
77
86 static std::auto_ptr<geom::Geometry> clip(const geom::Geometry & geom,
87 const Rectangle & rect);
88
101 static std::auto_ptr<geom::Geometry> clipBoundary(const geom::Geometry & geom,
102 const Rectangle & rect);
103
104private:
105
106 RectangleIntersection(const geom::Geometry& geom, const Rectangle& rect);
107
108 std::auto_ptr<geom::Geometry> clipBoundary();
109
110 std::auto_ptr<geom::Geometry> clip();
111
112 const geom::Geometry &_geom;
113 const Rectangle &_rect;
114 const geom::GeometryFactory *_gf;
116
117 void clip_geom(const geom::Geometry * g,
119 const Rectangle & rect,
120 bool keep_polygons);
121
122 void clip_point(const geom::Point * g,
124 const Rectangle & rect);
125
126 void clip_multipoint(const geom::MultiPoint * g,
128 const Rectangle & rect);
129
130 void clip_linestring(const geom::LineString * g,
132 const Rectangle & rect);
133
134 void clip_multilinestring(const geom::MultiLineString * g,
136 const Rectangle & rect);
137
138 void clip_polygon(const geom::Polygon * g,
140 const Rectangle & rect,
141 bool keep_polygons);
142
143 void clip_multipolygon(const geom::MultiPolygon * g,
145 const Rectangle & rect,
146 bool keep_polygons);
147
148 void clip_geometrycollection(
149 const geom::GeometryCollection * g,
151 const Rectangle & rect,
152 bool keep_polygons);
153
154 void clip_polygon_to_linestrings(const geom::Polygon * g,
156 const Rectangle & rect);
157
158 void clip_polygon_to_polygons(const geom::Polygon * g,
160 const Rectangle & rect);
161
162
169 bool clip_linestring_parts(const geom::LineString * gi,
171 const Rectangle & rect);
172
173}; // class RectangleIntersection
174
175} // namespace geos::operation::intersection
176} // namespace geos::operation
177} // namespace geos
178
179#endif // GEOS_OP_RECTANGLE_INTERSECTION_H
A factory to create concrete instances of CoordinateSequences.
Definition CoordinateSequenceFactory.h:47
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:56
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:67
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineString.h:70
Models a collection of (}s.
Definition MultiLineString.h:51
Definition MultiPoint.h:56
Models a collection of Polygons.
Definition MultiPolygon.h:61
Definition Point.h:68
Represents a linear polygon, which may include holes.
Definition Polygon.h:67
Rebuild geometries from subpaths left by clipping with a rectangle.
Definition RectangleIntersectionBuilder.h:64
static std::auto_ptr< geom::Geometry > clipBoundary(const geom::Geometry &geom, const Rectangle &rect)
Clip boundary of a geometry with a rectangle.
static std::auto_ptr< geom::Geometry > clip(const geom::Geometry &geom, const Rectangle &rect)
Clip geometry with a rectangle.
Clipping rectangle.
Definition Rectangle.h:52
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25