GEOS  3.13.0dev
PolygonNoder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2023 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/LineIntersector.h>
18 // #include <geos/geom/Coordinate.h>
19 //#include <geos/geom/CoordinateSequence.h>
20 
21 #include <map>
22 
23 // Forward declarations
24 namespace geos {
25 namespace geom {
26 class Coordinate;
27 class CoordinateSequence;
28 }
29 namespace noding {
30 class NodedSegmentString;
31 }
32 }
33 
38 
39 
40 namespace geos {
41 namespace triangulate {
42 namespace polygon {
43 
44 
55 class GEOS_DLL PolygonNoder {
56 
57 public:
58 
60  std::unique_ptr<CoordinateSequence>& shellRing,
61  std::vector<std::unique_ptr<CoordinateSequence>>& holeRings);
62 
63  void node();
64  bool isShellNoded();
65  bool isHoleNoded(std::size_t i);
66  std::unique_ptr<CoordinateSequence> getNodedShell();
67  std::unique_ptr<CoordinateSequence> getNodedHole(std::size_t i);
68  std::vector<bool>& getHolesTouching();
69 
70 
71 
72 private:
73 
74  // Members
75  std::vector<bool> isHoleTouching;
76  std::map<NodedSegmentString*, std::size_t> nodedRingIndexes;
77  std::vector<std::unique_ptr<NodedSegmentString>> nodedRings;
78 
79  // Classes
80  class NodeAdder;
81  friend class PolygonNoder::NodeAdder;
82 
83  // Methods
85  createNodedSegString(std::unique_ptr<CoordinateSequence>& ringPts, std::size_t i);
86 
87  void createNodedSegmentStrings(
88  std::unique_ptr<CoordinateSequence>& shellRing,
89  std::vector<std::unique_ptr<CoordinateSequence>>& holeRings);
90 
91  /* Turn off copy constructors for MSVC */
92  PolygonNoder(const PolygonNoder&) = delete;
93  PolygonNoder& operator=(const PolygonNoder&) = delete;
94 
95 };
96 
97 
98 
99 } // namespace geos.triangulate.polygon
100 } // namespace geos.triangulate
101 } // namespace geos
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:53
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:56
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
Represents a list of contiguous line segments, and supports noding the segments.
Definition: NodedSegmentString.h:58
Definition: PolygonNoder.h:55
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25