GEOS 3.15.0dev
OverlayMixedPoints.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
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
18#include <geos/geom/Point.h>
19#include <geos/geom/Polygon.h>
20#include <geos/geom/LineString.h>
21
22#include <geos/export.h>
23
24#include <set>
25#include <memory>
26#include <vector>
27
28
29// Forward declarations
30namespace geos {
31namespace geom {
32class GeometryFactory;
33class PrecisionModel;
34class Geometry;
35class Coordinate;
36class CoordinateSequence;
37}
38namespace algorithm {
39namespace locate {
40class PointOnGeometryLocator;
41}
42}
43namespace noding {
44class Noder;
45}
46}
47
48namespace geos { // geos.
49namespace operation { // geos.operation
50namespace overlayng { // geos.operation.overlayng
51
79class GEOS_DLL OverlayMixedPoints {
80 using Curve = geos::geom::Curve;
85 using CoordinateXY = geos::geom::CoordinateXY;
93
94private:
95
96 // Members
97 int opCode;
98 const PrecisionModel* pm;
99 const Geometry* geomPoint;
100 const Geometry* geomNonPointInput;
101 const GeometryFactory* geometryFactory;
102 bool isPointRHS;
103 Noder* noder;
104
105 std::unique_ptr<Geometry> geomNonPoint;
106 int geomNonPointDim;
107 std::unique_ptr<PointOnGeometryLocator> locator;
108 int resultDim;
109
110 // Methods
111 std::unique_ptr<PointOnGeometryLocator> createLocator(const Geometry* geomNonPoint);
112
113 std::unique_ptr<Geometry> prepareNonPoint(const Geometry* geomInput);
114
115 std::unique_ptr<Geometry> computeIntersection(const CoordinateSequence* coords) const;
116
117 std::unique_ptr<Geometry> computeUnion(const CoordinateSequence* coords);
118
119 std::unique_ptr<Geometry> computeDifference(const CoordinateSequence* coords);
120
121 std::unique_ptr<Geometry> createPointResult(std::vector<std::unique_ptr<Point>>& points) const;
122
123 std::vector<std::unique_ptr<Point>> findPoints(bool isCovered, const CoordinateSequence* coords) const;
124
125 std::vector<std::unique_ptr<Point>> createPoints(const CoordinateSequence& coords) const;
126
127 bool hasLocation(bool isCovered, const CoordinateXY& coord) const;
128
129 std::unique_ptr<Geometry> copyNonPoint() const;
130
131 static std::unique_ptr<CoordinateSequence> extractCoordinates(const Geometry* points, const PrecisionModel* pm);
132
133 static std::vector<std::unique_ptr<Surface>> extractPolygons(const Geometry* geom);
134
135 static std::vector<std::unique_ptr<Curve>> extractLines(const Geometry* geom);
136
137
138
139public:
140
141 OverlayMixedPoints(int p_opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* p_pm, Noder* p_noder);
142
143 static std::unique_ptr<Geometry> overlay(int opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* pm, Noder* p_noder);
144
145 std::unique_ptr<Geometry> getResult();
146
147
148
149
150};
151
152
153} // namespace geos.operation.overlayng
154} // namespace geos.operation
155} // namespace geos
156
An interface for classes which determine the Location of points in Polygon or MultiPolygon geometries...
Definition PointOnGeometryLocator.h:36
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:220
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:72
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:200
Definition LineString.h:66
Definition Point.h:61
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
Definition Surface.h:27
Computes all intersections between segments in a set of SegmentString.
Definition Noder.h:45
Definition OverlayMixedPoints.h:79
Basic namespace for all GEOS functionalities.
Definition geos.h:38