GEOS 3.6.2
SegmentIntersectionDetector.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
16#ifndef GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
17#define GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
18
19#include <geos/noding/SegmentIntersector.h>
20#include <geos/algorithm/LineIntersector.h>
21#include <geos/geom/Coordinate.h>
22#include <geos/geom/CoordinateSequence.h>
23#include <geos/noding/SegmentString.h>
24
25using namespace geos::algorithm;
26
27namespace geos {
28namespace noding { // geos::noding
29
43class SegmentIntersectionDetector : public SegmentIntersector
44{
45private:
46 LineIntersector * li;
47
48 bool findProper;
49 bool findAllTypes;
50
51 bool _hasIntersection;
52 bool _hasProperIntersection;
53 bool _hasNonProperIntersection;
54
55 const geom::Coordinate * intPt;
56 geom::CoordinateSequence * intSegments;
57
58protected:
59public:
60 SegmentIntersectionDetector( LineIntersector * li)
61 :
62 li( li),
63 findProper(false),
64 findAllTypes(false),
65 _hasIntersection(false),
66 _hasProperIntersection(false),
67 _hasNonProperIntersection(false),
68 intPt( NULL),
69 intSegments( NULL)
70 { }
71
72 ~SegmentIntersectionDetector()
73 {
74 //delete intPt;
75 delete intSegments;
76 }
77
78
79 void setFindProper( bool findProper)
80 {
81 this->findProper = findProper;
82 }
83
84 void setFindAllIntersectionTypes( bool findAllTypes)
85 {
86 this->findAllTypes = findAllTypes;
87 }
88
94 bool hasIntersection() const
95 {
96 return _hasIntersection;
97 }
98
105 {
106 return _hasProperIntersection;
107 }
108
115 {
116 return _hasNonProperIntersection;
117 }
118
125 const geom::Coordinate * const getIntersection() const
126 {
127 return intPt;
128 }
129
130
137 {
138 return intSegments;
139 }
140
141 bool isDone() const
142 {
143 // If finding all types, we can stop
144 // when both possible types have been found.
145 if (findAllTypes)
146 return _hasProperIntersection && _hasNonProperIntersection;
147
148 // If searching for a proper intersection, only stop if one is found
149 if (findProper)
150 return _hasProperIntersection;
151
152 return _hasIntersection;
153 }
154
164 noding::SegmentString * e1, int segIndex1 );
165
166};
167
168} // namespace geos::noding
169} // namespace geos
170
171#endif // GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:49
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
bool hasIntersection() const
Definition SegmentIntersectionDetector.h:94
void processIntersections(noding::SegmentString *e0, int segIndex0, noding::SegmentString *e1, int segIndex1)
const geom::CoordinateSequence * getIntersectionSegments() const
Definition SegmentIntersectionDetector.h:136
bool hasNonProperIntersection() const
Definition SegmentIntersectionDetector.h:114
bool hasProperIntersection() const
Definition SegmentIntersectionDetector.h:104
bool isDone() const
Reports whether the client of this class needs to continue testing all intersections in an arrangemen...
Definition SegmentIntersectionDetector.h:141
const geom::Coordinate *const getIntersection() const
Definition SegmentIntersectionDetector.h:125
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:46
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition PreparedLineString.h:27
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25