GEOS  3.8.0dev
geomgraph/index/SegmentIntersector.h
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 <vector>
21 
22 #include <geos/geom/Coordinate.h> // for composition
23 
24 #ifdef _MSC_VER
25 #pragma warning(push)
26 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
27 #endif
28 
29 // Forward declarations
30 namespace geos {
31 namespace algorithm {
32 class LineIntersector;
33 }
34 namespace geomgraph {
35 class Node;
36 class Edge;
37 }
38 }
39 
40 namespace geos {
41 namespace geomgraph { // geos::geomgraph
42 namespace index { // geos::geomgraph::index
43 
44 
45 class GEOS_DLL SegmentIntersector {
46 
47 private:
48 
53  bool hasIntersectionVar;
54 
55  bool hasProper;
56 
57  bool hasProperInterior;
58 
59  bool isDone;
60 
61  bool isDoneWhenProperInt;
62 
63  // the proper intersection point found
64  geom::Coordinate properIntersectionPoint;
65 
66  algorithm::LineIntersector* li;
67 
68  bool includeProper;
69 
70  bool recordIsolated;
71 
72  //bool isSelfIntersection;
73 
74  //bool intersectionFound;
75 
76  int numIntersections;
77 
79  std::vector<std::vector<Node*>*> bdyNodes;
80 
81  bool isTrivialIntersection(Edge* e0, size_t segIndex0, Edge* e1, size_t segIndex1);
82 
83  bool isBoundaryPoint(algorithm::LineIntersector* li,
84  std::vector<std::vector<Node*>*>& tstBdyNodes);
85 
86  bool isBoundaryPoint(algorithm::LineIntersector* li,
87  std::vector<Node*>* tstBdyNodes);
88 
89 public:
90 
91  static bool isAdjacentSegments(size_t i1, size_t i2);
92 
93  // testing only
94  int numTests;
95 
96  //SegmentIntersector();
97 
98  virtual
99  ~SegmentIntersector() {}
100 
101  SegmentIntersector(algorithm::LineIntersector* newLi,
102  bool newIncludeProper, bool newRecordIsolated)
103  :
104  hasIntersectionVar(false),
105  hasProper(false),
106  hasProperInterior(false),
107  isDone(false),
108  isDoneWhenProperInt(false),
109  li(newLi),
110  includeProper(newIncludeProper),
111  recordIsolated(newRecordIsolated),
112  numIntersections(0),
113  bdyNodes(2),
114  numTests(0)
115  {}
116 
120  void setBoundaryNodes(std::vector<Node*>* bdyNodes0,
121  std::vector<Node*>* bdyNodes1);
122 
123  geom::Coordinate& getProperIntersectionPoint();
124 
125  bool hasIntersection();
126 
127  bool hasProperIntersection();
128 
129  bool hasProperInteriorIntersection();
130 
131  void addIntersections(Edge* e0, size_t segIndex0, Edge* e1, size_t segIndex1);
132 
133  void setIsDoneIfProperInt(bool isDoneWhenProperInt);
134 
135  bool getIsDone();
136 
137 };
138 
139 } // namespace geos.geomgraph.index
140 } // namespace geos.geomgraph
141 } // namespace geos
142 
143 #ifdef _MSC_VER
144 #pragma warning(pop)
145 #endif
146 
147 #endif
148 
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25