00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
00018 #define GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
00019
00020 #include <geos/noding/SegmentIntersector.h>
00021 #include <geos/algorithm/LineIntersector.h>
00022 #include <geos/geom/Coordinate.h>
00023 #include <geos/geom/CoordinateSequence.h>
00024 #include <geos/noding/SegmentString.h>
00025
00026 using namespace geos::algorithm;
00027
00028 namespace geos {
00029 namespace noding {
00030
00044 class SegmentIntersectionDetector : public SegmentIntersector
00045 {
00046 private:
00047 LineIntersector * li;
00048
00049 bool findProper;
00050 bool findAllTypes;
00051
00052 bool _hasIntersection;
00053 bool _hasProperIntersection;
00054 bool _hasNonProperIntersection;
00055
00056 const geom::Coordinate * intPt;
00057 geom::CoordinateSequence * intSegments;
00058
00059 protected:
00060 public:
00061 SegmentIntersectionDetector( LineIntersector * li)
00062 :
00063 li( li),
00064 findProper(false),
00065 findAllTypes(false),
00066 _hasIntersection(false),
00067 _hasProperIntersection(false),
00068 _hasNonProperIntersection(false),
00069 intPt( NULL),
00070 intSegments( NULL)
00071 { }
00072
00073 ~SegmentIntersectionDetector()
00074 {
00075
00076 delete intSegments;
00077 }
00078
00079
00080 void setFindProper( bool findProper)
00081 {
00082 this->findProper = findProper;
00083 }
00084
00085 void setFindAllIntersectionTypes( bool findAllTypes)
00086 {
00087 this->findAllTypes = findAllTypes;
00088 }
00089
00095 bool hasIntersection() const
00096 {
00097 return _hasIntersection;
00098 }
00099
00105 bool hasProperIntersection() const
00106 {
00107 return _hasProperIntersection;
00108 }
00109
00115 bool hasNonProperIntersection() const
00116 {
00117 return _hasNonProperIntersection;
00118 }
00119
00126 const geom::Coordinate * const getIntersection() const
00127 {
00128 return intPt;
00129 }
00130
00131
00137 const geom::CoordinateSequence * getIntersectionSegments() const
00138 {
00139 return intSegments;
00140 }
00141
00142 bool isDone() const
00143 {
00144
00145
00146 if (findAllTypes)
00147 return _hasProperIntersection && _hasNonProperIntersection;
00148
00149
00150 if (findProper)
00151 return _hasProperIntersection;
00152
00153 return _hasIntersection;
00154 }
00155
00164 void processIntersections( noding::SegmentString * e0, int segIndex0,
00165 noding::SegmentString * e1, int segIndex1 );
00166
00167 };
00168
00169 }
00170 }
00171
00172 #endif // GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
00173
00174
00175
00176
00177