GEOS 3.13.1
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
86 geom::Envelope getEnvelope(std::size_t start, std::size_t end);
87
95 static bool isKnown(std::vector<CoverageRing*>& rings);
96
103 bool isInteriorOnRight() const;
104
110 void markInvalid(std::size_t index);
111
117 void markMatched(std::size_t index);
118
125 bool isKnown() const;
126
133 bool isInvalid(std::size_t i) const;
134
140 bool isInvalid() const;
141
147 bool hasInvalid() const;
148
155 bool isKnown(std::size_t i) const;
156
165 const Coordinate& findVertexPrev(std::size_t index, const Coordinate& pt) const;
166
175 const Coordinate& findVertexNext(std::size_t index, const Coordinate& pt) const;
176
183 std::size_t prev(std::size_t index) const;
184
191 std::size_t next(std::size_t index) const;
192
193 void createInvalidLines(
194 const GeometryFactory* geomFactory,
195 std::vector<std::unique_ptr<LineString>>& lines);
196
197};
198
199} // namespace geos.coverage
200} // namespace geos
201
202
203
204
205
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
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Definition LineString.h:66
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:61
Basic namespace for all GEOS functionalities.
Definition geos.h:39