GEOS 3.13.1
RelateSegmentString.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/noding/BasicSegmentString.h>
19#include <geos/export.h>
20
21
22#include <string>
23#include <sstream>
24
25
26// Forward declarations
27namespace geos {
28namespace geom {
29 class CoordinateXY;
31 class Geometry;
32}
33namespace operation {
34namespace relateng {
35 class RelateGeometry;
36 class NodeSection;
37}
38}
39}
40
41
44using geos::geom::CoordinateXY;
46
47
48namespace geos { // geos.
49namespace operation { // geos.operation
50namespace relateng { // geos.operation.relateng
51
52
53
54class GEOS_DLL RelateSegmentString : public BasicSegmentString {
55
56private:
57
58 // Members
59 bool m_isA;
60 int m_dimension;
61 int m_id;
62 int m_ringId;
63 const RelateGeometry* m_inputGeom;
64 const Geometry* m_parentPolygonal = nullptr;
65
66 // Constructor
67 RelateSegmentString(
68 const CoordinateSequence* pts,
69 bool isA,
70 int dimension,
71 int id,
72 int ringId,
73 const Geometry* poly,
74 const RelateGeometry* inputGeom)
75 : BasicSegmentString(const_cast<CoordinateSequence*>(pts), nullptr)
76 , m_isA(isA)
77 , m_dimension(dimension)
78 , m_id(id)
79 , m_ringId(ringId)
80 , m_inputGeom(inputGeom)
81 , m_parentPolygonal(poly)
82 {}
83
84
85 // Methods
86
87 static const RelateSegmentString* createSegmentString(
88 const CoordinateSequence* pts,
89 bool isA, int dim, int elementId, int ringId,
90 const Geometry* poly, const RelateGeometry* parent);
91
99 const CoordinateXY* prevVertex(
100 std::size_t segIndex,
101 const CoordinateXY* pt) const;
102
109 const CoordinateXY* nextVertex(
110 std::size_t segIndex,
111 const CoordinateXY* pt) const;
112
113
114public:
115
116 static const RelateSegmentString* createLine(
117 const CoordinateSequence* pts,
118 bool isA, int elementId,
119 const RelateGeometry* parent);
120
121 static const RelateSegmentString* createRing(
122 const CoordinateSequence* pts,
123 bool isA, int elementId, int ringId,
124 const Geometry* poly, const RelateGeometry* parent);
125
126 inline bool isA() const {
127 return m_isA;
128 }
129
130 inline const RelateGeometry* getGeometry() const {
131 return m_inputGeom;
132 }
133
134 inline const Geometry* getPolygonal() const {
135 return m_parentPolygonal;
136 }
137
138 NodeSection* createNodeSection(std::size_t segIndex, const CoordinateXY intPt) const;
139
154 bool isContainingSegment(std::size_t segIndex, const CoordinateXY* pt) const;
155
156};
157
158} // namespace geos.operation.relateng
159} // namespace geos.operation
160} // namespace geos
161
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
Represents a list of contiguous line segments, and supports noding the segments.
Definition BasicSegmentString.h:44
Basic namespace for all GEOS functionalities.
Definition geos.h:39