GEOS  3.8.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 #ifndef GEOS_OP_RELATE_RELATECOMPUTER_H
22 #define GEOS_OP_RELATE_RELATECOMPUTER_H
23 
24 #include <geos/export.h>
25 
26 #include <geos/algorithm/PointLocator.h> // for RelateComputer composition
27 #include <geos/algorithm/LineIntersector.h> // for RelateComputer composition
28 #include <geos/geomgraph/NodeMap.h> // for RelateComputer composition
29 #include <geos/geom/Coordinate.h> // for RelateComputer composition
30 #include <geos/geom/IntersectionMatrix.h>
31 
32 #include <vector>
33 #include <memory>
34 
35 #ifdef _MSC_VER
36 #pragma warning(push)
37 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
38 #endif
39 
40 // Forward declarations
41 namespace geos {
42 namespace geom {
43 class Geometry;
44 }
45 namespace geomgraph {
46 class GeometryGraph;
47 class Edge;
48 class EdgeEnd;
49 class Node;
50 namespace index {
51 class SegmentIntersector;
52 }
53 }
54 }
55 
56 
57 namespace geos {
58 namespace operation { // geos::operation
59 namespace relate { // geos::operation::relate
60 
75 class GEOS_DLL RelateComputer {
76 public:
77  RelateComputer(std::vector<geomgraph::GeometryGraph*>* newArg);
78  ~RelateComputer();
79 
80  std::unique_ptr<geom::IntersectionMatrix> computeIM();
81 private:
82 
84 
85  algorithm::PointLocator ptLocator;
86 
88  std::vector<geomgraph::GeometryGraph*>* arg;
89 
90  geomgraph::NodeMap nodes;
91 
93  std::unique_ptr<geom::IntersectionMatrix> im;
94 
95  std::vector<geomgraph::Edge*> isolatedEdges;
96 
98  geom::Coordinate invalidPoint;
99 
100  void insertEdgeEnds(std::vector<geomgraph::EdgeEnd*>* ee);
101 
102  void computeProperIntersectionIM(
103  geomgraph::index::SegmentIntersector* intersector,
105 
106  void copyNodesAndLabels(int argIndex);
107  void computeIntersectionNodes(int argIndex);
108  void labelIntersectionNodes(int argIndex);
109 
114  void computeDisjointIM(geom::IntersectionMatrix* imX);
115 
116  void labelNodeEdges();
117 
121  void updateIM(geom::IntersectionMatrix& imX);
122 
131  void labelIsolatedEdges(int thisIndex, int targetIndex);
132 
140  void labelIsolatedEdge(geomgraph::Edge* e, int targetIndex,
141  const geom::Geometry* target);
142 
152  void labelIsolatedNodes();
153 
157  void labelIsolatedNode(geomgraph::Node* n, int targetIndex);
158 };
159 
160 
161 } // namespace geos:operation:relate
162 } // namespace geos:operation
163 } // namespace geos
164 
165 #ifdef _MSC_VER
166 #pragma warning(pop)
167 #endif
168 
169 #endif // GEOS_OP_RELATE_RELATECOMPUTER_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix. ...
Definition: IntersectionMatrix.h:54
Computes the topological relationship (Location) of a single point to a Geometry. ...
Definition: PointLocator.h:57
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:49
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Definition: geomgraph/Node.h:62
Definition: geomgraph/Edge.h:66
Computes the topological relationship between two Geometries.
Definition: RelateComputer.h:75