GEOS 3.14.0dev
AdjacentEdgeLocator.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (c) 2024 Martin Davis
7 * Copyright (C) 2024 Paul Ramsey <pramsey@cleverelephant.ca>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#pragma once
17
18#include <geos/geom/CoordinateSequence.h>
19#include <geos/geom/Location.h>
20#include <geos/export.h>
21
22
23// Forward declarations
24namespace geos {
25namespace operation {
26namespace relateng {
27 class NodeSections;
28 class NodeSection;
29}
30}
31namespace geom {
32 class CoordinateXY;
33 class Geometry;
34 class LinearRing;
35 class Polygon;
36}
37}
38
39namespace geos { // geos.
40namespace operation { // geos.operation
41namespace relateng { // geos.operation.relateng
42
57class GEOS_DLL AdjacentEdgeLocator {
58 using CoordinateXY = geos::geom::CoordinateXY;
64
65public:
66
67 AdjacentEdgeLocator(const Geometry* geom)
68 {
69 init(geom);
70 }
71
72 Location locate(const CoordinateXY* p);
73
79 AdjacentEdgeLocator& operator=(const AdjacentEdgeLocator&) = delete;
80
81
82private:
83
84 // Members
85
86 std::vector<const CoordinateSequence*> ringList;
87
88 /*
89 * When we have to reorient rings, we end up allocating new
90 * rings, since we cannot reorient the rings of the input
91 * geometry, so this is where we store those "local" rings.
92 */
93 std::vector<std::unique_ptr<CoordinateSequence>> localRingList;
94
95
96 // Methods
97
98 void addSections(
99 const CoordinateXY* p,
100 const CoordinateSequence* ring,
101 NodeSections& sections);
102
103 NodeSection* createSection(
104 const CoordinateXY* p,
105 const CoordinateXY* prev,
106 const CoordinateXY* next);
107
108 void init(const Geometry* geom);
109
110 void addRings(const Geometry* geom);
111
112 void addRing(const LinearRing* ring, bool requireCW);
113
114
115};
116
117} // namespace geos.operation.relateng
118} // namespace geos.operation
119} // namespace geos
120
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
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
Definition AdjacentEdgeLocator.h:57
AdjacentEdgeLocator(const AdjacentEdgeLocator &)=delete
Definition NodeSection.h:50
Location
Constants representing the location of a point relative to a geometry.
Definition Location.h:32
Basic namespace for all GEOS functionalities.
Definition geos.h:39