GEOS  3.9.1dev
geomgraph/index/SegmentIntersector.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
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 #ifndef GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
17 #define GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
18 
19 #include <geos/export.h>
20 #include <array>
21 #include <vector>
22 
23 #include <geos/geom/Coordinate.h> // for composition
24 
25 #ifdef _MSC_VER
26 #pragma warning(push)
27 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
28 #endif
29 
30 // Forward declarations
31 namespace geos {
32 namespace algorithm {
33 class LineIntersector;
34 }
35 namespace geomgraph {
36 class Node;
37 class Edge;
38 }
39 }
40 
41 namespace geos {
42 namespace geomgraph { // geos::geomgraph
43 namespace index { // geos::geomgraph::index
44 
48 
49 private:
50 
56 
57  bool hasProper;
58 
60 
61  bool isDone;
62 
64 
65  // the proper intersection point found
67 
69 
71 
73 
74  //bool isSelfIntersection;
75 
76  //bool intersectionFound;
77 
79 
81  std::array<std::vector<Node*>*, 2> bdyNodes;
82 
83  bool isTrivialIntersection(Edge* e0, size_t segIndex0, Edge* e1, size_t segIndex1);
84 
85  bool isBoundaryPoint(algorithm::LineIntersector* li,
86  std::array<std::vector<Node*>*, 2>& tstBdyNodes);
87 
88  bool isBoundaryPoint(algorithm::LineIntersector* li,
89  std::vector<Node*>* tstBdyNodes);
90 
91 public:
92 
93  static bool isAdjacentSegments(size_t i1, size_t i2);
94 
95  // testing only
96  int numTests;
97 
98  //SegmentIntersector();
99 
100  virtual
102 
104  bool newIncludeProper, bool newRecordIsolated)
105  :
106  hasIntersectionVar(false),
107  hasProper(false),
108  hasProperInterior(false),
109  isDone(false),
110  isDoneWhenProperInt(false),
111  li(newLi),
112  includeProper(newIncludeProper),
113  recordIsolated(newRecordIsolated),
114  numIntersections(0),
115  bdyNodes{nullptr, nullptr},
116  numTests(0)
117  {}
118 
122  void setBoundaryNodes(std::vector<Node*>* bdyNodes0,
123  std::vector<Node*>* bdyNodes1);
124 
125  geom::Coordinate& getProperIntersectionPoint();
126 
127  bool hasIntersection();
128 
129  bool hasProperIntersection();
130 
131  bool hasProperInteriorIntersection();
132 
133  void addIntersections(Edge* e0, size_t segIndex0, Edge* e1, size_t segIndex1);
134 
135  void setIsDoneIfProperInt(bool isDoneWhenProperInt);
136 
137  bool getIsDone();
138 
139 };
140 
141 } // namespace geos.geomgraph.index
142 } // namespace geos.geomgraph
143 } // namespace geos
144 
145 #ifdef GEOS_INLINE
146 #include <geos/geomgraph/index/SegmentIntersector.inl>
147 #endif
148 
149 #ifdef _MSC_VER
150 #pragma warning(pop)
151 #endif
152 
153 #endif
154 
#define GEOS_DLL
Definition: export.h:28
std::array< std::vector< Node * > *, 2 > bdyNodes
Elements are externally owned.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
SegmentIntersector(algorithm::LineIntersector *newLi, bool newIncludeProper, bool newRecordIsolated)
Computes the intersection of line segments, and adds the intersection to the edges containing the seg...
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Basic namespace for all GEOS functionalities.