GEOS  3.14.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
30 namespace geos {
31 namespace geom {
32 class GeometryFactory;
33 class PrecisionModel;
34 class Geometry;
35 class Coordinate;
36 class CoordinateSequence;
37 }
38 namespace algorithm {
39 namespace locate {
40 class PointOnGeometryLocator;
41 }
42 }
43 }
44 
45 namespace geos { // geos.
46 namespace operation { // geos.operation
47 namespace overlayng { // geos.operation.overlayng
48 
76 class GEOS_DLL OverlayMixedPoints {
81  using CoordinateXY = geos::geom::CoordinateXY;
83  using Point = geos::geom::Point;
87 
88 private:
89 
90  // Members
91  int opCode;
92  const PrecisionModel* pm;
93  const Geometry* geomPoint;
94  const Geometry* geomNonPointInput;
95  const GeometryFactory* geometryFactory;
96  bool isPointRHS;
97 
98  std::unique_ptr<Geometry> geomNonPoint;
99  int geomNonPointDim;
100  std::unique_ptr<PointOnGeometryLocator> locator;
101  int resultDim;
102 
103  // Methods
104  std::unique_ptr<PointOnGeometryLocator> createLocator(const Geometry* geomNonPoint);
105 
106  std::unique_ptr<Geometry> prepareNonPoint(const Geometry* geomInput);
107 
108  std::unique_ptr<Geometry> computeIntersection(const CoordinateSequence* coords) const;
109 
110  std::unique_ptr<Geometry> computeUnion(const CoordinateSequence* coords);
111 
112  std::unique_ptr<Geometry> computeDifference(const CoordinateSequence* coords);
113 
114  std::unique_ptr<Geometry> createPointResult(std::vector<std::unique_ptr<Point>>& points) const;
115 
116  std::vector<std::unique_ptr<Point>> findPoints(bool isCovered, const CoordinateSequence* coords) const;
117 
118  std::vector<std::unique_ptr<Point>> createPoints(const CoordinateSequence& coords) const;
119 
120  bool hasLocation(bool isCovered, const CoordinateXY& coord) const;
121 
122  std::unique_ptr<Geometry> copyNonPoint() const;
123 
124  std::unique_ptr<CoordinateSequence> extractCoordinates(const Geometry* points, const PrecisionModel* pm) const;
125 
126  std::vector<std::unique_ptr<Polygon>> extractPolygons(const Geometry* geom) const;
127 
128  std::vector<std::unique_ptr<LineString>> extractLines(const Geometry* geom) const;
129 
130 
131 
132 public:
133 
134  OverlayMixedPoints(int p_opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* p_pm);
135 
136  static std::unique_ptr<Geometry> overlay(int opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* pm);
137 
138  std::unique_ptr<Geometry> getResult();
139 
140 
141 
142 
143 };
144 
145 
146 } // namespace geos.operation.overlayng
147 } // namespace geos.operation
148 } // namespace geos
149 
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:217
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:197
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:88
Definition: OverlayMixedPoints.h:76
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25