GEOS: SegmentIntersectionDetector.h Source File

GEOS 3.5.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

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
25 using namespace geos::algorithm;
26
27 namespace geos {
28 namespace noding { // geos::noding
29
43 class SegmentIntersectionDetector : public SegmentIntersector
44 {
45 private:
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
58 protected:
59 public:
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
104 bool hasProperIntersection() const
105 {
106 return _hasProperIntersection;
107 }
108
114 bool hasNonProperIntersection() const
115 {
116 return _hasNonProperIntersection;
117 }
118
125 const geom::Coordinate * const getIntersection() const
126 {
127 return intPt;
128 }
129
130
136 const geom::CoordinateSequence * getIntersectionSegments() const
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
163 void processIntersections( noding::SegmentString * e0, int segIndex0,
164 noding::SegmentString * e1, int segIndex1 );
165
166 };
167
168 } // namespace geos::noding
169 } // namespace geos
170
171 #endif // GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
geos::noding::SegmentIntersectionDetector
Detects and records an intersection between two SegmentStrings, if one exists.
Definition: SegmentIntersectionDetector.h:43
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::noding::SegmentString
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
geos::noding::SegmentIntersectionDetector::hasNonProperIntersection
bool hasNonProperIntersection() const
Definition: SegmentIntersectionDetector.h:114
geos::algorithm::LineIntersector
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:49
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::noding::SegmentIntersectionDetector::getIntersectionSegments
const geom::CoordinateSequence * getIntersectionSegments() const
Definition: SegmentIntersectionDetector.h:136
geos::noding::SegmentIntersector
Processes possible intersections detected by a Noder.
Definition: noding/SegmentIntersector.h:47
geos::noding::SegmentIntersectionDetector::getIntersection
const geom::Coordinate *const getIntersection() const
Definition: SegmentIntersectionDetector.h:125
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition: Angle.h:33
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
geos::noding::SegmentIntersectionDetector::hasIntersection
bool hasIntersection() const
Definition: SegmentIntersectionDetector.h:94
geos::noding::SegmentIntersectionDetector::isDone
bool isDone() const
Reports whether the client of this class needs to continue testing all intersections in an arrangemen...
Definition: SegmentIntersectionDetector.h:141
geos::noding::SegmentIntersectionDetector::hasProperIntersection
bool hasProperIntersection() const
Definition: SegmentIntersectionDetector.h:104