GEOS 3.14.0dev
NodeSection.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/export.h>
19#include <geos/geom/Coordinate.h>
20
21#include <string>
22#include <sstream>
23
24// Forward declarations
25namespace geos {
26namespace geom {
27 class Geometry;
28}
29}
30
31namespace geos { // geos.
32namespace operation { // geos.operation
33namespace relateng { // geos.operation.relateng
34
50class GEOS_DLL NodeSection {
51 using CoordinateXY = geos::geom::CoordinateXY;
53
54private:
55
56 // Members
57 bool m_isA;
58 int m_dim;
59 int m_id;
60 int m_ringId;
61 const Geometry* m_poly;
62 bool m_isNodeAtVertex;
63 const CoordinateXY* m_v0;
64 const CoordinateXY m_nodePt;
65 const CoordinateXY* m_v1;
66
67 // Methods
68
69 static int compareWithNull(const CoordinateXY* v0, const CoordinateXY* v1);
70
71 static int compare(int a, int b);
72
73public:
74
76 bool isA,
77 int dim,
78 int id,
79 int ringId,
80 const Geometry* poly,
81 bool isNodeAtVertex,
82 const CoordinateXY* v0,
83 const CoordinateXY nodePt,
84 const CoordinateXY* v1)
85 : m_isA(isA)
86 , m_dim(dim)
87 , m_id(id)
88 , m_ringId(ringId)
89 , m_poly(poly)
90 , m_isNodeAtVertex(isNodeAtVertex)
91 , m_v0(v0)
92 , m_nodePt(nodePt)
93 , m_v1(v1)
94 {};
95
96 NodeSection(const NodeSection* ns)
97 : m_isA(ns->isA())
98 , m_dim(ns->dimension())
99 , m_id(ns->id())
100 , m_ringId(ns->ringId())
101 , m_poly(ns->getPolygonal())
102 , m_isNodeAtVertex(ns->isNodeAtVertex())
103 , m_v0(ns->getVertex(0))
104 , m_nodePt(ns->nodePt())
105 , m_v1(ns->getVertex(1))
106 {};
107
108 const CoordinateXY* getVertex(int i) const;
109
110 const CoordinateXY& nodePt() const;
111
112 int dimension() const;
113
114 int id() const;
115
116 int ringId() const;
117
124 const Geometry* getPolygonal() const;
125
126 bool isShell() const;
127
128 bool isArea() const;
129
130 static bool isAreaArea(const NodeSection& a, const NodeSection& b);
131
132 bool isA() const;
133
134 bool isSameGeometry(const NodeSection& ns) const;
135
136 bool isSamePolygon(const NodeSection& ns) const;
137
138 bool isNodeAtVertex() const;
139
140 bool isProper() const;
141
142 static bool isProper(const NodeSection& a, const NodeSection& b);
143
144 std::string toString() const;
145
146 static std::string edgeRep(const CoordinateXY* p0, const CoordinateXY* p1);
147
148 friend std::ostream& operator<<(std::ostream& os, const NodeSection& ns);
149
155 int compareTo(const NodeSection& o) const;
156
157
158};
159
160} // namespace geos.operation.relateng
161} // namespace geos.operation
162} // namespace geos
163
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Definition NodeSection.h:50
const Geometry * getPolygonal() const
int compareTo(const NodeSection &o) const
Basic namespace for all GEOS functionalities.
Definition geos.h:39