GEOS  3.9.0dev
NodingIntersectionFinder.h
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 #ifndef GEOS_NODING_NODINGINTERSECTIONFINDER_H
16 #define GEOS_NODING_NODINGINTERSECTIONFINDER_H
17 
18 #include <geos/noding/SegmentIntersector.h> // for inheritance
19 #include <geos/geom/Coordinate.h> // for composition
20 
21 #include <vector>
22 
23 // Forward declarations
24 namespace geos {
25 namespace algorithm {
26 class LineIntersector;
27 }
28 namespace noding {
29 class SegmentString;
30 }
31 }
32 
33 namespace geos {
34 namespace noding { // geos.noding
35 
48 
49 public:
50 
58  :
59  li(newLi),
60  interiorIntersection(geom::Coordinate::getNull()),
61  intersectionCount(0),
62  isCheckEndSegmentsOnly(false),
63  findAllIntersections(false),
64  keepIntersections(true)
65  {
66  }
67 
73  bool
75  {
76  return !interiorIntersection.isNull();
77  }
78 
85  const geom::Coordinate&
87  {
88  return interiorIntersection;
89  }
90 
96  size_t
97  count() const
98  {
99  return intersectionCount;
100  }
101 
112  void
114  {
115  isCheckEndSegmentsOnly = isCESO;
116  }
117 
118 
129  void
131  {
132  findAllIntersections = fAI;
133  }
134 
140  const std::vector<geom::Coordinate>&
142  {
143  return intSegments;
144  }
145 
156  SegmentString* e0, size_t segIndex0,
157  SegmentString* e1, size_t segIndex1) override;
158 
159  bool
160  isDone() const override
161  {
162  return !interiorIntersection.isNull();
163  }
164 
165 private:
167  geom::Coordinate interiorIntersection;
168  size_t intersectionCount;
169  bool isCheckEndSegmentsOnly;
170  bool findAllIntersections;
171  bool keepIntersections;
172  std::vector<geom::Coordinate> intSegments;
173 
174  // Declare type as noncopyable
175  NodingIntersectionFinder(const NodingIntersectionFinder& other) = delete;
176  NodingIntersectionFinder& operator=(const NodingIntersectionFinder& rhs) = delete;
177 
188  bool isInteriorVertexIntersection(
189  const geom::Coordinate& p0, const geom::Coordinate& p1,
190  bool isEnd0, bool isEnd1);
191 
208  bool isInteriorVertexIntersection(
209  const geom::Coordinate& p00, const geom::Coordinate& p01,
210  const geom::Coordinate& p10, const geom::Coordinate& p11,
211  bool isEnd00, bool isEnd01, bool isEnd10, bool isEnd11);
212 
221  bool isEndSegment(const SegmentString* segStr, size_t index);
222 
223 
224 };
225 
226 } // namespace geos.noding
227 } // namespace geos
228 
229 #endif // GEOS_NODING_NODINGINTERSECTIONFINDER_H
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
const geom::Coordinate & getInteriorIntersection() const
Gets the computed location of the intersection. Due to round-off, the location may not be exact...
Definition: NodingIntersectionFinder.h:86
void processIntersections(SegmentString *e0, size_t segIndex0, SegmentString *e1, size_t segIndex1) override
This method is called by clients of the SegmentIntersector class to process intersections for two seg...
const std::vector< geom::Coordinate > & getIntersectionSegments() const
Gets the endpoints of the intersecting segments.
Definition: NodingIntersectionFinder.h:141
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:49
void setCheckEndSegmentsOnly(bool isCESO)
Sets whether only end segments should be tested for interior intersection.
Definition: NodingIntersectionFinder.h:113
bool isDone() const override
Reports whether the client of this class needs to continue testing all intersections in an arrangemen...
Definition: NodingIntersectionFinder.h:160
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26
Finds non-noded intersections in a set of SegmentStrings, if any exist.
Definition: NodingIntersectionFinder.h:47
Processes possible intersections detected by a Noder.
Definition: noding/SegmentIntersector.h:48
size_t count() const
Gets the count of intersections found.
Definition: NodingIntersectionFinder.h:97
bool hasIntersection() const
Tests whether an intersection was found.
Definition: NodingIntersectionFinder.h:74
NodingIntersectionFinder(algorithm::LineIntersector &newLi)
Creates an intersection finder which finds an interior intersection if one exists.
Definition: NodingIntersectionFinder.h:57
void setFindAllIntersections(bool fAI)
Sets whether all intersections should be computed.
Definition: NodingIntersectionFinder.h:130