GEOS  3.13.0dev
RelateComputer.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: operation/relate/RelateComputer.java rev. 1.24 (JTS-1.10)
18  *
19  **********************************************************************/
20 
21 #pragma once
22 
23 #include <geos/export.h>
24 
25 #include <geos/algorithm/PointLocator.h> // for RelateComputer composition
26 #include <geos/algorithm/LineIntersector.h> // for RelateComputer composition
27 #include <geos/geomgraph/NodeMap.h> // for RelateComputer composition
28 #include <geos/geom/Coordinate.h> // for RelateComputer composition
29 #include <geos/geom/IntersectionMatrix.h>
30 
31 #include <vector>
32 #include <memory>
33 
34 #ifdef _MSC_VER
35 #pragma warning(push)
36 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
37 #endif
38 
39 // Forward declarations
40 namespace geos {
41 namespace algorithm {
42 class BoundaryNodeRule;
43 }
44 namespace geom {
45 class Geometry;
46 }
47 namespace geomgraph {
48 class GeometryGraph;
49 class Edge;
50 class EdgeEnd;
51 class Node;
52 namespace index {
53 class SegmentIntersector;
54 }
55 }
56 }
57 
58 
59 namespace geos {
60 namespace operation { // geos::operation
61 namespace relate { // geos::operation::relate
62 
77 class GEOS_DLL RelateComputer {
78 public:
79  RelateComputer(std::vector<geomgraph::GeometryGraph*>* newArg);
80  ~RelateComputer() = default;
81 
82  std::unique_ptr<geom::IntersectionMatrix> computeIM();
83 private:
84 
86 
87  algorithm::PointLocator ptLocator;
88 
90  std::vector<geomgraph::GeometryGraph*>* arg;
91 
92  geomgraph::NodeMap nodes;
93 
95  std::unique_ptr<geom::IntersectionMatrix> im;
96 
97  std::vector<geomgraph::Edge*> isolatedEdges;
98 
100  geom::Coordinate invalidPoint;
101 
102  void insertEdgeEnds(std::vector<std::unique_ptr<geomgraph::EdgeEnd>>& ee);
103 
104  void computeProperIntersectionIM(
107 
108  void copyNodesAndLabels(uint8_t argIndex);
109  void computeIntersectionNodes(uint8_t argIndex);
110  void labelIntersectionNodes(uint8_t argIndex);
111 
116  void computeDisjointIM(geom::IntersectionMatrix* imX,
117  const algorithm::BoundaryNodeRule& boundaryNodeRule);
118 
119  void labelNodeEdges();
120 
124  void updateIM(geom::IntersectionMatrix& imX);
125 
138  static int getBoundaryDim(const geom::Geometry& geom,
139  const algorithm::BoundaryNodeRule& boundaryNodeRule);
140 
149  void labelIsolatedEdges(uint8_t thisIndex, uint8_t targetIndex);
150 
158  void labelIsolatedEdge(geomgraph::Edge* e, uint8_t targetIndex,
159  const geom::Geometry* target);
160 
170  void labelIsolatedNodes();
171 
175  void labelIsolatedNode(geomgraph::Node* n, uint8_t targetIndex);
176 };
177 
178 
179 } // namespace geos:operation:relate
180 } // namespace geos:operation
181 } // namespace geos
182 
183 #ifdef _MSC_VER
184 #pragma warning(pop)
185 #endif
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
Definition: BoundaryNodeRule.h:50
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:53
Computes the topological relationship (Location) of a single point to a Geometry.
Definition: PointLocator.h:56
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix.
Definition: IntersectionMatrix.h:51
Definition: geomgraph/Edge.h:63
The node component of a geometry graph.
Definition: geomgraph/Node.h:59
Computes the intersection of line segments, and adds the intersection to the edges containing the seg...
Definition: geomgraph/index/SegmentIntersector.h:46
Computes the topological relationship between two Geometries.
Definition: RelateComputer.h:77
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25