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