GEOS 3.14.0dev
OverlayEdgeRing.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/algorithm/locate/IndexedPointInAreaLocator.h>
18#include <geos/geom/CoordinateSequence.h>
19#include <geos/geom/LinearRing.h>
20#include <geos/export.h>
21
22// Forward declarations
23namespace geos {
24namespace algorithm {
25namespace locate {
26class PointOnGeometryLocator;
27}
28}
29namespace geom {
30class Coordinate;
31class CoordinateSequence;
32class GeometryFactory;
33class LinearRing;
34class Polygon;
35}
36namespace operation {
37namespace overlayng {
38class OverlayEdge;
39}
40}
41}
42
43namespace geos { // geos.
44namespace operation { // geos.operation
45namespace overlayng { // geos.operation.overlayng
46
47class GEOS_DLL OverlayEdgeRing {
48 using Coordinate = geos::geom::Coordinate;
49 using CoordinateSequence = geos::geom::CoordinateSequence;
50 using GeometryFactory = geos::geom::GeometryFactory;
51 using LinearRing = geos::geom::LinearRing;
52 using Polygon = geos::geom::Polygon;
53 using PointOnGeometryLocator = algorithm::locate::PointOnGeometryLocator;
54 using IndexedPointInAreaLocator = algorithm::locate::IndexedPointInAreaLocator;
55
56private:
57
58 // Members
59 OverlayEdge* startEdge;
60 std::unique_ptr<LinearRing> ring;
61 bool m_isHole;
62 std::unique_ptr<IndexedPointInAreaLocator> locator;
63 OverlayEdgeRing* shell;
64 // a list of EdgeRings which are holes in this EdgeRing
65 std::vector<OverlayEdgeRing*> holes;
66
67 // Methods
68 void computeRingPts(OverlayEdge* start, CoordinateSequence& pts);
69 void computeRing(std::unique_ptr<CoordinateSequence> && ringPts, const GeometryFactory* geometryFactory);
70
76 const CoordinateSequence& getCoordinates();
77 PointOnGeometryLocator* getLocator();
78 static void closeRing(CoordinateSequence& pts);
79
80
81public:
82
83 OverlayEdgeRing(OverlayEdge* start, const GeometryFactory* geometryFactory);
84
85 std::unique_ptr<LinearRing> getRing();
86 const LinearRing* getRingPtr() const;
87
92 bool isHole() const;
93
99 void setShell(OverlayEdgeRing* p_shell);
100
106 bool hasShell() const;
107
113 const OverlayEdgeRing* getShell() const;
114
115 void addHole(OverlayEdgeRing* ring);
116
117 bool isInRing(const Coordinate& pt);
118
119 const Coordinate& getCoordinate();
120
125 std::unique_ptr<Polygon> toPolygon(const GeometryFactory* factory);
126
127 OverlayEdge* getEdge();
128
147 OverlayEdgeRing* findEdgeRingContaining(const std::vector<OverlayEdgeRing*>& erList);
148
149
150};
151
152
153} // namespace geos.operation.overlayng
154} // namespace geos.operation
155} // namespace geos
156
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
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