GEOS  3.13.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
24 namespace geos {
25 namespace geom {
26 class Coordinate;
27 class CoordinateArray;
28 class GeometryFactory;
29 }
30 namespace operation {
31 namespace overlayng {
32 class OverlayEdge;
33 class EdgeRing;
34 }
35 }
36 }
37 
38 namespace geos { // geos.
39 namespace operation { // geos.operation
40 namespace overlayng { // geos.operation.overlayng
41 
42 using namespace geos::geom;
43 
44 class GEOS_DLL MaximalEdgeRing {
45 
46 private:
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 
90 public:
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:65
Definition: Angle.h:26
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25