18#include <geos/algorithm/BoundaryNodeRule.h>
19#include <geos/geom/Coordinate.h>
20#include <geos/geom/Dimension.h>
21#include <geos/geom/Location.h>
22#include <geos/operation/relateng/RelatePointLocator.h>
23#include <geos/operation/relateng/RelateSegmentString.h>
24#include <geos/export.h>
56class GEOS_DLL RelateGeometry {
63 bool m_isPrepared =
false;
66 int geomDim = Dimension::False;
67 bool isLineZeroLen =
false;
68 bool isGeomEmpty =
false;
70 Coordinate::ConstXYSet uniquePoints;
71 std::unique_ptr<RelatePointLocator> locator;
73 bool hasPoints =
false;
74 bool hasLines =
false;
75 bool hasAreas =
false;
80 std::vector<std::unique_ptr<const RelateSegmentString>> segStringTempStore;
81 std::vector<std::unique_ptr<const RelateSegmentString>> segStringPermStore;
82 std::vector<std::unique_ptr<CoordinateSequence>> csStore;
87 void analyzeDimensions();
96 static bool isZeroLength(
const Geometry* geom);
98 static bool isZeroLength(
const LineString* line);
100 bool isZeroLengthLine(
const Geometry* g)
const {
102 if (getDimension() != Dimension::L)
104 return isZeroLength(g);
107 RelatePointLocator* getLocator();
109 Coordinate::ConstXYSet createUniquePoints();
111 void extractSegmentStringsFromAtomic(
bool isA,
114 std::vector<const SegmentString*>& segStrings,
115 std::vector<std::unique_ptr<const RelateSegmentString>>& segStore);
117 void extractRingToSegmentString(
bool isA,
120 std::vector<const SegmentString*>& segStrings,
121 std::vector<std::unique_ptr<const RelateSegmentString>>& segStore);
123 void extractSegmentStrings(
bool isA,
125 std::vector<const SegmentString*>& segStrings,
126 std::vector<std::unique_ptr<const RelateSegmentString>>& segStore);
136 static constexpr bool GEOM_A =
true;
137 static constexpr bool GEOM_B =
false;
139 RelateGeometry(
const Geometry* input)
144 : RelateGeometry(input, false, bnRule)
149 static std::string name(
bool isA);
151 const Geometry* getGeometry()
const {
155 bool isPrepared()
const {
159 const Envelope* getEnvelope()
const {
163 inline int getDimension()
const {
167 bool hasDimension(
int dim)
const {
169 case Dimension::P:
return hasPoints;
170 case Dimension::L:
return hasLines;
171 case Dimension::A:
return hasAreas;
176 bool hasAreaAndLine()
const {
177 return hasAreas && hasLines;
186 int getDimensionReal()
const;
188 bool hasEdges()
const;
190 bool isNodeInArea(
const CoordinateXY* nodePt,
const Geometry* parentPolygonal);
192 int locateLineEndWithDim(
const CoordinateXY* p);
204 Location locateAreaVertex(
const CoordinateXY* pt);
206 Location locateNode(
const CoordinateXY* pt,
const Geometry* parentPolygonal);
208 int locateWithDim(
const CoordinateXY* pt);
226 bool isSelfNodingRequired()
const;
238 bool isPolygonal()
const;
240 bool isEmpty()
const;
244 Coordinate::ConstXYSet& getUniquePoints();
246 std::vector<const Point*> getEffectivePoints();
257 std::vector<const SegmentString*> extractSegmentStrings(
bool isA,
const Envelope* env);
259 std::string toString()
const;
261 friend std::ostream& operator<<(std::ostream& os,
const RelateGeometry& rg);
268 RelateGeometry(
const RelateGeometry&) =
delete;
269 RelateGeometry& operator=(
const RelateGeometry&) =
delete;
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
Definition BoundaryNodeRule.h:52
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Definition LineString.h:66
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
Definition MultiPolygon.h:58
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:47
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