GEOS  3.13.0dev
OverlayEdgeRing.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 #include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
18 #include <geos/geom/CoordinateSequence.h>
19 #include <geos/geom/LinearRing.h>
20 #include <geos/export.h>
21 
22 // Forward declarations
23 namespace geos {
24 namespace algorithm {
25 namespace locate {
26 class PointOnGeometryLocator;
27 }
28 }
29 namespace geom {
30 class Coordinate;
31 class CoordinateSequence;
32 class GeometryFactory;
33 class LinearRing;
34 class Polygon;
35 }
36 namespace operation {
37 namespace overlayng {
38 class OverlayEdge;
39 }
40 }
41 }
42 
43 namespace geos { // geos.
44 namespace operation { // geos.operation
45 namespace overlayng { // geos.operation.overlayng
46 
47 using namespace geos::geom;
48 using algorithm::locate::PointOnGeometryLocator;
49 using algorithm::locate::IndexedPointInAreaLocator;
50 
51 class GEOS_DLL OverlayEdgeRing {
52 
53 private:
54 
55  // Members
56  OverlayEdge* startEdge;
57  std::unique_ptr<LinearRing> ring;
58  bool m_isHole;
59  std::unique_ptr<IndexedPointInAreaLocator> locator;
60  OverlayEdgeRing* shell;
61  // a list of EdgeRings which are holes in this EdgeRing
62  std::vector<OverlayEdgeRing*> holes;
63 
64  // Methods
65  void computeRingPts(OverlayEdge* start, CoordinateSequence& pts);
66  void computeRing(std::unique_ptr<CoordinateSequence> && ringPts, const GeometryFactory* geometryFactory);
67 
73  const CoordinateSequence& getCoordinates();
74  PointOnGeometryLocator* getLocator();
75  static void closeRing(CoordinateSequence& pts);
76 
77 
78 public:
79 
80  OverlayEdgeRing(OverlayEdge* start, const GeometryFactory* geometryFactory);
81 
82  std::unique_ptr<LinearRing> getRing();
83  const LinearRing* getRingPtr() const;
84 
89  bool isHole() const;
90 
96  void setShell(OverlayEdgeRing* p_shell);
97 
103  bool hasShell() const;
104 
110  const OverlayEdgeRing* getShell() const;
111 
112  void addHole(OverlayEdgeRing* ring);
113 
114  bool isInRing(const Coordinate& pt);
115 
116  const Coordinate& getCoordinate();
117 
122  std::unique_ptr<Polygon> toPolygon(const GeometryFactory* factory);
123 
124  OverlayEdge* getEdge();
125 
144  OverlayEdgeRing* findEdgeRingContaining(const std::vector<OverlayEdgeRing*>& erList);
145 
146 
147 };
148 
149 
150 } // namespace geos.operation.overlayng
151 } // namespace geos.operation
152 } // namespace geos
153 
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:216
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:65
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:54
Definition: Angle.h:26
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25