GEOS 3.14.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 <geos/export.h>
22#include <geos/triangulate/tri/Tri.h>
23
24#include <map>
25#include <memory>
26#include <vector>
27
28// Forward declarations
29namespace geos {
30namespace geom {
31class Coordinate;
32class CoordinateSequence;
33}
34namespace noding {
35class NodedSegmentString;
36}
37namespace algorithm {
38class LineIntersector;
39}
40}
41
42namespace geos {
43namespace triangulate {
44namespace polygon {
45
46
57class GEOS_DLL PolygonNoder {
63 template<typename TriType>
65
66public:
67
69 std::unique_ptr<CoordinateSequence>& shellRing,
70 std::vector<std::unique_ptr<CoordinateSequence>>& holeRings);
71
72 void node();
73 bool isShellNoded();
74 bool isHoleNoded(std::size_t i);
75 std::unique_ptr<CoordinateSequence> getNodedShell();
76 std::unique_ptr<CoordinateSequence> getNodedHole(std::size_t i);
77 std::vector<bool>& getHolesTouching();
78
79
80
81private:
82
83 // Members
84 std::vector<bool> isHoleTouching;
85 std::map<NodedSegmentString*, std::size_t> nodedRingIndexes;
86 std::vector<std::unique_ptr<NodedSegmentString>> nodedRings;
87
88 // Classes
89 class NodeAdder;
90 friend class PolygonNoder::NodeAdder;
91
92 // Methods
94 createNodedSegString(std::unique_ptr<CoordinateSequence>& ringPts, std::size_t i);
95
96 void createNodedSegmentStrings(
97 std::unique_ptr<CoordinateSequence>& shellRing,
98 std::vector<std::unique_ptr<CoordinateSequence>>& holeRings);
99
100 /* Turn off copy constructors for MSVC */
101 PolygonNoder(const PolygonNoder&) = delete;
102 PolygonNoder& operator=(const PolygonNoder&) = delete;
103
104};
105
106
107
108} // namespace geos.triangulate.polygon
109} // namespace geos.triangulate
110} // 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:217
Represents a list of contiguous line segments, and supports noding the segments.
Definition NodedSegmentString.h:58
Definition PolygonNoder.h:57
Definition TriList.h:50
Definition Tri.h:45
Basic namespace for all GEOS functionalities.
Definition geos.h:39