GEOS 3.10.1
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/inline.h>
19#include <geos/noding/SegmentIntersector.h> // for inheritance
20#include <geos/geom/Coordinate.h> // for composition
21
22#include <vector>
23
24// Forward declarations
25namespace geos {
26namespace algorithm {
27class LineIntersector;
28}
29namespace noding {
30class SegmentString;
31}
32}
33
34namespace geos {
35namespace noding { // geos.noding
36
49
50public:
51
59 :
60 li(newLi),
61 interiorIntersection(geom::Coordinate::getNull()),
62 intersectionCount(0),
63 isCheckEndSegmentsOnly(false),
64 findAllIntersections(false)
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, std::size_t segIndex0,
157 SegmentString* e1, std::size_t segIndex1) override;
158
159 bool
160 isDone() const override
161 {
162 return !interiorIntersection.isNull();
163 }
164
165private:
167 geom::Coordinate interiorIntersection;
168 std::size_t intersectionCount;
169 bool isCheckEndSegmentsOnly;
170 bool findAllIntersections;
171 std::vector<geom::Coordinate> intSegments;
172
173 // Declare type as noncopyable
175 NodingIntersectionFinder& operator=(const NodingIntersectionFinder& rhs) = delete;
176
187 static bool isInteriorVertexIntersection(
188 const geom::Coordinate& p0, const geom::Coordinate& p1,
189 bool isEnd0, bool isEnd1);
190
207 static bool isInteriorVertexIntersection(
208 const geom::Coordinate& p00, const geom::Coordinate& p01,
209 const geom::Coordinate& p10, const geom::Coordinate& p11,
210 bool isEnd00, bool isEnd01, bool isEnd10, bool isEnd11);
211
220 static bool isEndSegment(const SegmentString* segStr, std::size_t index);
221
222
223};
224
225} // namespace geos.noding
226} // namespace geos
227
228#ifdef GEOS_INLINE
229#include "geos/noding/NodingIntersectionFinder.inl"
230#endif
231
232#endif // GEOS_NODING_NODINGINTERSECTIONFINDER_H
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:50
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Finds non-noded intersections in a set of SegmentStrings, if any exist.
Definition: NodingIntersectionFinder.h:48
void setFindAllIntersections(bool fAI)
Sets whether all intersections should be computed.
Definition: NodingIntersectionFinder.h:130
const std::vector< geom::Coordinate > & getIntersectionSegments() const
Gets the endpoints of the intersecting segments.
Definition: NodingIntersectionFinder.h:141
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 setCheckEndSegmentsOnly(bool isCESO)
Sets whether only end segments should be tested for interior intersection.
Definition: NodingIntersectionFinder.h:113
NodingIntersectionFinder(algorithm::LineIntersector &newLi)
Creates an intersection finder which finds an interior intersection if one exists.
Definition: NodingIntersectionFinder.h:58
bool hasIntersection() const
Tests whether an intersection was found.
Definition: NodingIntersectionFinder.h:74
void processIntersections(SegmentString *e0, std::size_t segIndex0, SegmentString *e1, std::size_t segIndex1) override
This method is called by clients of the SegmentIntersector class to process intersections for two seg...
bool isDone() const override
Reports whether the client of this class needs to continue testing all intersections in an arrangemen...
Definition: NodingIntersectionFinder.h:160
size_t count() const
Gets the count of intersections found.
Definition: NodingIntersectionFinder.h:97
Processes possible intersections detected by a Noder.
Definition: noding/SegmentIntersector.h:48
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
Basic namespace for all GEOS functionalities.
Definition: geos.h:40