GEOS 3.12.0
CoverageRing.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2022 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/noding/BasicSegmentString.h>
18
19#include <deque>
20
21// Forward declarations
22namespace geos {
23namespace geom {
24class Coordinate;
26class Geometry;
27class GeometryFactory;
28class LineString;
29class LinearRing;
30class Polygon;
31}
32}
33
41
42namespace geos { // geos.
43namespace coverage { // geos.coverage
44
45class GEOS_DLL CoverageRing : public noding::BasicSegmentString {
46
47private:
48
49 // Members
50 bool m_isInteriorOnRight;
51 std::vector<bool> m_isInvalid;
52 std::vector<bool> m_isMatched;
53
54 std::size_t findInvalidStart(std::size_t index);
55
56 std::size_t findInvalidEnd(std::size_t index);
57
58 std::size_t nextMarkIndex(std::size_t index);
59
69 std::unique_ptr<LineString> createLine(
70 std::size_t startIndex,
71 std::size_t endIndex,
72 const GeometryFactory* geomFactory);
73
74 std::unique_ptr<CoordinateSequence> extractSection(
75 std::size_t startIndex, std::size_t endIndex);
76
77 std::unique_ptr<CoordinateSequence> extractSectionWrap(
78 std::size_t startIndex, std::size_t endIndex);
79
80public:
81
82 CoverageRing(CoordinateSequence* pts, bool interiorOnRight);
83
84 CoverageRing(const LinearRing* ring, bool isShell);
85
93 static bool isKnown(std::vector<CoverageRing*>& rings);
94
101 bool isInteriorOnRight() const;
102
108 void markInvalid(std::size_t index);
109
115 void markMatched(std::size_t index);
116
123 bool isKnown() const;
124
131 bool isInvalid(std::size_t i) const;
132
138 bool isInvalid() const;
139
145 bool hasInvalid() const;
146
153 bool isKnown(std::size_t i) const;
154
163 const Coordinate& findVertexPrev(std::size_t index, const Coordinate& pt) const;
164
173 const Coordinate& findVertexNext(std::size_t index, const Coordinate& pt) const;
174
181 std::size_t prev(std::size_t index) const;
182
189 std::size_t next(std::size_t index) const;
190
191 void createInvalidLines(
192 const GeometryFactory* geomFactory,
193 std::vector<std::unique_ptr<LineString>>& lines);
194
195};
196
197} // namespace geos.coverage
198} // namespace geos
199
200
201
202
203
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
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:65
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:186
Definition LineString.h:65
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
Represents a linear polygon, which may include holes.
Definition Polygon.h:60
Basic namespace for all GEOS functionalities.
Definition geos.h:39