GEOS 3.11.1
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/CoordinateArraySequence.h>
19#include <geos/geom/LinearRing.h>
20#include <geos/export.h>
21
22// Forward declarations
23namespace geos {
24namespace algorithm {
25namespace locate {
26class PointOnGeometryLocator;
27}
28}
29namespace geom {
30class Coordinate;
31class CoordinateSequence;
32class GeometryFactory;
33class LinearRing;
34class Polygon;
35}
36namespace operation {
37namespace overlayng {
38class OverlayEdge;
39}
40}
41}
42
43namespace geos { // geos.
44namespace operation { // geos.operation
45namespace overlayng { // geos.operation.overlayng
46
47using namespace geos::geom;
50
51class GEOS_DLL OverlayEdgeRing {
52
53private:
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, CoordinateArraySequence& pts);
66 void computeRing(std::unique_ptr<CoordinateArraySequence> && ringPts, const GeometryFactory* geometryFactory);
67
73 const CoordinateArraySequence& getCoordinates();
74 PointOnGeometryLocator* getLocator();
75 static void closeRing(CoordinateArraySequence& pts);
76
77
78public:
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
Determines the location of Coordinates relative to an areal geometry, using indexing for efficiency.
Definition: IndexedPointInAreaLocator.h:54
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
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:55
Definition: Angle.h:26
Basic namespace for all GEOS functionalities.
Definition: geos.h:39