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  {
65  }
66 
72  bool
74  {
75  return !interiorIntersection.isNull();
76  }
77 
84  const geom::Coordinate&
86  {
87  return interiorIntersection;
88  }
89 
95  size_t
96  count() const
97  {
98  return intersectionCount;
99  }
100 
111  void
113  {
114  isCheckEndSegmentsOnly = isCESO;
115  }
116 
117 
128  void
130  {
131  findAllIntersections = fAI;
132  }
133 
139  const std::vector<geom::Coordinate>&
141  {
142  return intSegments;
143  }
144 
155  SegmentString* e0, size_t segIndex0,
156  SegmentString* e1, size_t segIndex1) override;
157 
158  bool
159  isDone() const override
160  {
161  return !interiorIntersection.isNull();
162  }
163 
164 private:
166  geom::Coordinate interiorIntersection;
167  size_t intersectionCount;
168  bool isCheckEndSegmentsOnly;
169  bool findAllIntersections;
170  std::vector<geom::Coordinate> intSegments;
171 
172  // Declare type as noncopyable
173  NodingIntersectionFinder(const NodingIntersectionFinder& other) = delete;
174  NodingIntersectionFinder& operator=(const NodingIntersectionFinder& rhs) = delete;
175 
186  bool isInteriorVertexIntersection(
187  const geom::Coordinate& p0, const geom::Coordinate& p1,
188  bool isEnd0, bool isEnd1);
189 
206  bool isInteriorVertexIntersection(
207  const geom::Coordinate& p00, const geom::Coordinate& p01,
208  const geom::Coordinate& p10, const geom::Coordinate& p11,
209  bool isEnd00, bool isEnd01, bool isEnd10, bool isEnd11);
210 
219  bool isEndSegment(const SegmentString* segStr, size_t index);
220 
221 
222 };
223 
224 } // namespace geos.noding
225 } // namespace geos
226 
227 #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:85
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:140
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:112
bool isDone() const override
Reports whether the client of this class needs to continue testing all intersections in an arrangemen...
Definition: NodingIntersectionFinder.h:159
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:96
bool hasIntersection() const
Tests whether an intersection was found.
Definition: NodingIntersectionFinder.h:73
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:129