00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_NODING_INTERSECTIONADDER_H
00021 #define GEOS_NODING_INTERSECTIONADDER_H
00022
00023 #include <geos/export.h>
00024
00025 #include <vector>
00026 #include <iostream>
00027 #include <cstdlib>
00028
00029 #include <geos/inline.h>
00030
00031 #include <geos/geom/Coordinate.h>
00032 #include <geos/noding/SegmentIntersector.h>
00033
00034
00035 namespace geos {
00036 namespace geom {
00037 class Coordinate;
00038 }
00039 namespace noding {
00040 class SegmentString;
00041 }
00042 namespace algorithm {
00043 class LineIntersector;
00044 }
00045 }
00046
00047 namespace geos {
00048 namespace noding {
00049
00059 class GEOS_DLL IntersectionAdder: public SegmentIntersector {
00060
00061 private:
00062
00067 bool hasIntersectionVar;
00068 bool hasProper;
00069 bool hasProperInterior;
00070 bool hasInterior;
00071
00072
00073 const geom::Coordinate* properIntersectionPoint;
00074
00075 algorithm::LineIntersector& li;
00076 bool isSelfIntersection;
00077
00078
00085 bool isTrivialIntersection(const SegmentString* e0, int segIndex0,
00086 const SegmentString* e1, int segIndex1);
00087
00088
00089 IntersectionAdder(const IntersectionAdder& other);
00090 IntersectionAdder& operator=(const IntersectionAdder& rhs);
00091
00092 public:
00093
00094 int numIntersections;
00095 int numInteriorIntersections;
00096 int numProperIntersections;
00097
00098
00099 int numTests;
00100
00101 IntersectionAdder(algorithm::LineIntersector& newLi)
00102 :
00103 hasIntersectionVar(false),
00104 hasProper(false),
00105 hasProperInterior(false),
00106 hasInterior(false),
00107 properIntersectionPoint(NULL),
00108 li(newLi),
00109 numIntersections(0),
00110 numInteriorIntersections(0),
00111 numProperIntersections(0),
00112 numTests(0)
00113 {}
00114
00115 algorithm::LineIntersector& getLineIntersector() { return li; }
00116
00121 const geom::Coordinate* getProperIntersectionPoint() {
00122 return properIntersectionPoint;
00123 }
00124
00125 bool hasIntersection() { return hasIntersectionVar; }
00126
00135 bool hasProperIntersection() { return hasProper; }
00136
00142 bool hasProperInteriorIntersection() { return hasProperInterior; }
00143
00148 bool hasInteriorIntersection() { return hasInterior; }
00149
00150
00160 void processIntersections(
00161 SegmentString* e0, int segIndex0,
00162 SegmentString* e1, int segIndex1);
00163
00164
00165 static bool isAdjacentSegments(int i1, int i2) {
00166 return std::abs(i1 - i2) == 1;
00167 }
00168
00174 virtual bool isDone() const {
00175 return false;
00176 }
00177 };
00178
00179
00180 }
00181 }
00182
00183
00184
00185
00186
00187 #endif // GEOS_NODING_INTERSECTIONADDER_H
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198