GEOS 3.11.1
overlayng/MaximalEdgeRing.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/operation/overlayng/OverlayEdgeRing.h>
18
19#include <vector>
20#include <memory>
21#include <geos/export.h>
22
23// Forward declarations
24namespace geos {
25namespace geom {
26class Coordinate;
27class CoordinateArray;
28class GeometryFactory;
29}
30namespace operation {
31namespace overlayng {
32class OverlayEdge;
33class EdgeRing;
34}
35}
36}
37
38namespace geos { // geos.
39namespace operation { // geos.operation
40namespace overlayng { // geos.operation.overlayng
41
42using namespace geos::geom;
43
44class GEOS_DLL MaximalEdgeRing {
45
46private:
47
48 // Constants
49 static constexpr int STATE_FIND_INCOMING = 1;
50 static constexpr int STATE_LINK_OUTGOING = 2;
51
52 // Members
53 OverlayEdge* startEdge;
54
55 // Methods
56 void attachEdges(OverlayEdge* startEdge);
57 void linkMinimalRings();
58
73 static void linkMinRingEdgesAtNode(OverlayEdge* nodeEdge, MaximalEdgeRing* maxRing);
74
84 static bool isAlreadyLinked(OverlayEdge* edge, MaximalEdgeRing* maxRing);
85
86 static OverlayEdge* selectMaxOutEdge(OverlayEdge* currOut, MaximalEdgeRing* maxEdgeRing);
87 static OverlayEdge* linkMaxInEdge(OverlayEdge* currOut, OverlayEdge* currMaxRingOut, MaximalEdgeRing* maxEdgeRing);
88
89
90public:
91
92 MaximalEdgeRing(OverlayEdge* e)
93 : startEdge(e)
94 {
95 attachEdges(e);
96 };
97
98 std::vector<std::unique_ptr<OverlayEdgeRing>> buildMinimalRings(const GeometryFactory* geometryFactory);
99
124 static void linkResultAreaMaxRingAtNode(OverlayEdge* nodeEdge);
125
126 friend std::ostream& operator<<(std::ostream& os, const MaximalEdgeRing& mer);
127
128};
129
130
131} // namespace geos.operation.overlayng
132} // namespace geos.operation
133} // namespace geos
134
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Definition: Angle.h:26
Basic namespace for all GEOS functionalities.
Definition: geos.h:39