GEOS  3.13.1
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
24 namespace geos {
25 namespace operation {
26 namespace relateng {
27  class NodeSections;
28  class NodeSection;
29 }
30 }
31 namespace geom {
32  class CoordinateXY;
33  class Geometry;
34  class LinearRing;
35  class Polygon;
36 }
37 }
38 
39 
40 using geos::geom::CoordinateXY;
46 
47 
48 
49 namespace geos { // geos.
50 namespace operation { // geos.operation
51 namespace relateng { // geos.operation.relateng
52 
67 class GEOS_DLL AdjacentEdgeLocator {
68 
69 public:
70 
71  AdjacentEdgeLocator(const Geometry* geom)
72  {
73  init(geom);
74  }
75 
76  Location locate(const CoordinateXY* p);
77 
83  AdjacentEdgeLocator& operator=(const AdjacentEdgeLocator&) = delete;
84 
85 
86 private:
87 
88  // Members
89 
90  std::vector<const CoordinateSequence*> ringList;
91 
92  /*
93  * When we have to reorient rings, we end up allocating new
94  * rings, since we cannot reorient the rings of the input
95  * geometry, so this is where we store those "local" rings.
96  */
97  std::vector<std::unique_ptr<CoordinateSequence>> localRingList;
98 
99 
100  // Methods
101 
102  void addSections(
103  const CoordinateXY* p,
104  const CoordinateSequence* ring,
105  NodeSections& sections);
106 
107  NodeSection* createSection(
108  const CoordinateXY* p,
109  const CoordinateXY* prev,
110  const CoordinateXY* next);
111 
112  void init(const Geometry* geom);
113 
114  void addRings(const Geometry* geom);
115 
116  void addRing(const LinearRing* ring, bool requireCW);
117 
118 
119 };
120 
121 } // namespace geos.operation.relateng
122 } // namespace geos.operation
123 } // namespace geos
124 
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:67
AdjacentEdgeLocator(const AdjacentEdgeLocator &)=delete
Definition: NodeSection.h:55
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:32
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25