GEOS 3.14.0dev
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 GeometryFactory;
28}
29namespace operation {
30namespace overlayng {
31class OverlayEdge;
32class EdgeRing;
33}
34}
35}
36
37namespace geos { // geos.
38namespace operation { // geos.operation
39namespace overlayng { // geos.operation.overlayng
40
41class GEOS_DLL MaximalEdgeRing {
42 using Coordinate = geos::geom::Coordinate;
43 using GeometryFactory = geos::geom::GeometryFactory;
44
45private:
46
47 // Constants
48 static constexpr int STATE_FIND_INCOMING = 1;
49 static constexpr int STATE_LINK_OUTGOING = 2;
50
51 // Members
52 OverlayEdge* startEdge;
53
54 // Methods
55 void attachEdges(OverlayEdge* startEdge);
56 void linkMinimalRings();
57
72 static void linkMinRingEdgesAtNode(OverlayEdge* nodeEdge, MaximalEdgeRing* maxRing);
73
83 static bool isAlreadyLinked(OverlayEdge* edge, MaximalEdgeRing* maxRing);
84
85 static OverlayEdge* selectMaxOutEdge(OverlayEdge* currOut, MaximalEdgeRing* maxEdgeRing);
86 static OverlayEdge* linkMaxInEdge(OverlayEdge* currOut, OverlayEdge* currMaxRingOut, MaximalEdgeRing* maxEdgeRing);
87
88
89public:
90
91 MaximalEdgeRing(OverlayEdge* e)
92 : startEdge(e)
93 {
94 attachEdges(e);
95 };
96
97 std::vector<std::unique_ptr<OverlayEdgeRing>> buildMinimalRings(const GeometryFactory* geometryFactory);
98
123 static void linkResultAreaMaxRingAtNode(OverlayEdge* nodeEdge);
124
125 friend std::ostream& operator<<(std::ostream& os, const MaximalEdgeRing& mer);
126
127};
128
129
130} // namespace geos.operation.overlayng
131} // namespace geos.operation
132} // namespace geos
133
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 namespace for all GEOS functionalities.
Definition geos.h:39