GEOS  3.9.1dev
IntersectionAdder.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) 2006 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: noding/IntersectionAdder.java rev. 1.6 (JTS-1.9)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_NODING_INTERSECTIONADDER_H
20 #define GEOS_NODING_INTERSECTIONADDER_H
21 
22 #include <geos/export.h>
23 
24 #include <vector>
25 #include <iostream>
26 #include <cstdlib> // for abs()
27 
28 #include <geos/inline.h>
29 
30 #include <geos/geom/Coordinate.h>
31 #include <geos/noding/SegmentIntersector.h> // for inheritance
32 
33 // Forward declarations
34 namespace geos {
35 namespace noding {
36 class SegmentString;
37 }
38 namespace algorithm {
39 class LineIntersector;
40 }
41 }
42 
43 namespace geos {
44 namespace noding { // geos.noding
45 
58 
59 private:
60 
66  bool hasProper;
69 
70  // the proper intersection point found
72 
74  // bool isSelfIntersection;
75  // bool intersectionFound;
76 
83  bool isTrivialIntersection(const SegmentString* e0, size_t segIndex0,
84  const SegmentString* e1, size_t segIndex1);
85 
86  // Declare type as noncopyable
87  IntersectionAdder(const IntersectionAdder& other) = delete;
88  IntersectionAdder& operator=(const IntersectionAdder& rhs) = delete;
89 
90 public:
91 
95 
96  // testing only
97  int numTests;
98 
100  :
101  hasIntersectionVar(false),
102  hasProper(false),
103  hasProperInterior(false),
104  hasInterior(false),
105  properIntersectionPoint(),
106  li(newLi),
107  numIntersections(0),
108  numInteriorIntersections(0),
109  numProperIntersections(0),
110  numTests(0)
111  {}
112 
115  {
116  return li;
117  }
118 
123  const geom::Coordinate&
125  {
126  return properIntersectionPoint;
127  }
128 
129  bool
131  {
132  return hasIntersectionVar;
133  }
134 
144  bool
146  {
147  return hasProper;
148  }
149 
154  bool
156  {
157  return hasProperInterior;
158  }
159 
164  bool
166  {
167  return hasInterior;
168  }
169 
170 
179  void processIntersections(
180  SegmentString* e0, size_t segIndex0,
181  SegmentString* e1, size_t segIndex1) override;
182 
183 
184  static bool
185  isAdjacentSegments(size_t i1, size_t i2)
186  {
187  return (i1 > i2 ? i1 - i2 : i2 - i1) == 1;
188  }
189 
195  bool
196  isDone() const override
197  {
198  return false;
199  }
200 };
201 
202 
203 } // namespace geos.noding
204 } // namespace geos
205 
206 #endif // GEOS_NODING_INTERSECTIONADDER_H
bool hasProperIntersection()
A proper intersection is an intersection which is interior to at least two line segments.
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
bool hasInteriorIntersection()
An interior intersection is an intersection which is in the interior of some segment.
const geom::Coordinate & getProperIntersectionPoint()
algorithm::LineIntersector & li
bool isDone() const override
Always process all intersections.
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Computes the intersections between two line segments in SegmentString and adds them to each string...
algorithm::LineIntersector & getLineIntersector()
IntersectionAdder(algorithm::LineIntersector &newLi)
Basic namespace for all GEOS functionalities.
Processes possible intersections detected by a Noder.
bool hasProperInteriorIntersection()
A proper interior intersection is a proper intersection which is not contained in the set of boundary...
geom::Coordinate properIntersectionPoint
static bool isAdjacentSegments(size_t i1, size_t i2)