GEOS 3.15.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 CoordinateXY;
32class CoordinateSequence;
33class Curve;
34class GeometryFactory;
35class Surface;
36}
37namespace operation {
38namespace overlayng {
39class OverlayEdge;
40}
41}
42}
43
44namespace geos { // geos.
45namespace operation { // geos.operation
46namespace overlayng { // geos.operation.overlayng
47
48class GEOS_DLL OverlayEdgeRing {
49 using Coordinate = geos::geom::Coordinate;
50 using CoordinateXY = geos::geom::CoordinateXY;
51 using CoordinateSequence = geos::geom::CoordinateSequence;
52 using GeometryFactory = geos::geom::GeometryFactory;
53 using Curve = geos::geom::Curve;
54 using Surface = geos::geom::Surface;
55 using PointOnGeometryLocator = algorithm::locate::PointOnGeometryLocator;
56 using IndexedPointInAreaLocator = algorithm::locate::IndexedPointInAreaLocator;
57
58private:
59
60 // Members
61 OverlayEdge* startEdge;
62 std::unique_ptr<Curve> ring;
63 bool m_isHole;
64 mutable std::unique_ptr<PointOnGeometryLocator> locator;
65 OverlayEdgeRing* shell;
66 // a list of EdgeRings which are holes in this EdgeRing
67 std::vector<OverlayEdgeRing*> holes;
68
69 // Methods
70 void computeRing(OverlayEdge* start, const GeometryFactory* geometryFactory);
71 std::unique_ptr<Curve> computeRingGeometry(OverlayEdge* start, const GeometryFactory* geometryFactory) const;
72
78 PointOnGeometryLocator* getLocator() const;
79 static void closeRing(CoordinateSequence& pts);
80 bool contains(const OverlayEdgeRing& otherRing) const;
81 bool isPointInOrOut(const OverlayEdgeRing& otherRing) const;
82
83
84public:
85
86 OverlayEdgeRing(OverlayEdge* start, const GeometryFactory* geometryFactory);
87
88 std::unique_ptr<Curve> getRing();
89 const Curve* getRingPtr() const;
90
91 const geom::Envelope& getEnvelope() const;
92
97 bool isHole() const;
98
104 void setShell(OverlayEdgeRing* p_shell);
105
111 bool hasShell() const;
112
118 const OverlayEdgeRing* getShell() const;
119
120 void addHole(OverlayEdgeRing* ring);
121
122 geom::Location locate(const CoordinateXY& pt) const;
123
124 const Coordinate& getCoordinate() const;
125
130 std::unique_ptr<Surface> toSurface(const GeometryFactory* factory);
131
132 OverlayEdge* getEdge();
133
152 OverlayEdgeRing* findEdgeRingContaining(const std::vector<OverlayEdgeRing*>& erList) const;
153
154
155};
156
157
158} // namespace geos.operation.overlayng
159} // namespace geos.operation
160} // namespace geos
161
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:220
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:72
Definition Surface.h:27
Basic namespace for all GEOS functionalities.
Definition geos.h:38