GEOS 3.11.1
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 CoordinateArraySequence;
37}
38namespace algorithm {
39namespace locate {
40class PointOnGeometryLocator;
41}
42}
43}
44
45namespace geos { // geos.
46namespace operation { // geos.operation
47namespace overlayng { // geos.operation.overlayng
48
49using namespace geos::geom;
51
79class GEOS_DLL OverlayMixedPoints {
80
81private:
82
83 // Members
84 int opCode;
85 const PrecisionModel* pm;
86 const Geometry* geomPoint;
87 const Geometry* geomNonPointInput;
88 const GeometryFactory* geometryFactory;
89 bool isPointRHS;
90
91 std::unique_ptr<Geometry> geomNonPoint;
92 int geomNonPointDim;
93 std::unique_ptr<PointOnGeometryLocator> locator;
94 int resultDim;
95
96 // Methods
97 std::unique_ptr<PointOnGeometryLocator> createLocator(const Geometry* geomNonPoint);
98
99 std::unique_ptr<Geometry> prepareNonPoint(const Geometry* geomInput);
100
101 std::unique_ptr<Geometry> computeIntersection(const CoordinateArraySequence* coords) const;
102
103 std::unique_ptr<Geometry> computeUnion(const CoordinateArraySequence* coords);
104
105 std::unique_ptr<Geometry> computeDifference(const CoordinateArraySequence* coords);
106
107 std::unique_ptr<Geometry> createPointResult(std::vector<std::unique_ptr<Point>>& points) const;
108
109 std::vector<std::unique_ptr<Point>> findPoints(bool isCovered, const CoordinateArraySequence* coords) const;
110
111 std::vector<std::unique_ptr<Point>> createPoints(std::set<Coordinate>& coords) const;
112
113 bool hasLocation(bool isCovered, const Coordinate& coord) const;
114
115 std::unique_ptr<Geometry> copyNonPoint() const;
116
117 std::unique_ptr<CoordinateArraySequence> extractCoordinates(const Geometry* points, const PrecisionModel* pm) const;
118
119 std::vector<std::unique_ptr<Polygon>> extractPolygons(const Geometry* geom) const;
120
121 std::vector<std::unique_ptr<LineString>> extractLines(const Geometry* geom) const;
122
123
124
125public:
126
127 OverlayMixedPoints(int p_opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* p_pm);
128
129 static std::unique_ptr<Geometry> overlay(int opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* pm);
130
131 std::unique_ptr<Geometry> getResult();
132
133
134
135
136};
137
138
139} // namespace geos.operation.overlayng
140} // namespace geos.operation
141} // namespace geos
142
An interface for classes which determine the Location of points in Polygon or MultiPolygon geometries...
Definition: PointOnGeometryLocator.h:36
The default implementation of CoordinateSequence.
Definition: CoordinateArraySequence.h:35
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
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
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:90
Definition: OverlayMixedPoints.h:79
Definition: Angle.h:26
Basic namespace for all GEOS functionalities.
Definition: geos.h:39