GEOS  3.9.1dev
OverlayEdgeRing.h
Go to the documentation of this file.
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 
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 
52 
53 private:
54 
55  // Members
57  std::unique_ptr<LinearRing> ring;
58  bool m_isHole;
60  std::unique_ptr<IndexedPointInAreaLocator> locator;
62  // a list of EdgeRings which are holes in this EdgeRing
63  std::vector<OverlayEdgeRing*> holes;
64 
65  // Methods
66  void computeRingPts(OverlayEdge* start, CoordinateArraySequence& pts);
67  void computeRing(const CoordinateArraySequence& ringPts, const GeometryFactory* geometryFactory);
68 
74  const CoordinateArraySequence& getCoordinates();
75  PointOnGeometryLocator* getLocator();
76  void closeRing(CoordinateArraySequence& pts);
77 
78 
79 public:
80 
81  OverlayEdgeRing(OverlayEdge* start, const GeometryFactory* geometryFactory);
82 
83  std::unique_ptr<LinearRing> getRing();
84  const LinearRing* getRingPtr() const;
85 
90  bool isHole() const;
91 
97  void setShell(OverlayEdgeRing* p_shell);
98 
104  bool hasShell() const;
105 
111  const OverlayEdgeRing* getShell() const;
112 
113  void addHole(OverlayEdgeRing* ring);
114 
115  bool isInRing(const Coordinate& pt);
116 
117  const Coordinate& getCoordinate();
118 
123  std::unique_ptr<Polygon> toPolygon(const GeometryFactory* factory);
124 
125  OverlayEdge* getEdge();
126 
145  OverlayEdgeRing* findEdgeRingContaining(std::vector<OverlayEdgeRing*>& erList);
146 
147 
148 };
149 
150 
151 } // namespace geos.operation.overlayng
152 } // namespace geos.operation
153 } // namespace geos
154 
std::unique_ptr< LinearRing > ring
#define GEOS_DLL
Definition: export.h:28
The default implementation of CoordinateSequence.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
An interface for classes which determine the Location of points in Polygon or MultiPolygon geometries...
std::unique_ptr< IndexedPointInAreaLocator > locator
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Basic namespace for all GEOS functionalities.
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple...
Definition: LinearRing.h:54
std::vector< OverlayEdgeRing * > holes