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
00090 public:
00091
00092 int numIntersections;
00093 int numInteriorIntersections;
00094 int numProperIntersections;
00095
00096
00097 int numTests;
00098
00099 IntersectionAdder(algorithm::LineIntersector& newLi)
00100 :
00101 hasIntersectionVar(false),
00102 hasProper(false),
00103 hasProperInterior(false),
00104 hasInterior(false),
00105 properIntersectionPoint(NULL),
00106 li(newLi),
00107 numIntersections(0),
00108 numInteriorIntersections(0),
00109 numProperIntersections(0),
00110 numTests(0)
00111 {}
00112
00113 algorithm::LineIntersector& getLineIntersector() { return li; }
00114
00119 const geom::Coordinate* getProperIntersectionPoint() {
00120 return properIntersectionPoint;
00121 }
00122
00123 bool hasIntersection() { return hasIntersectionVar; }
00124
00133 bool hasProperIntersection() { return hasProper; }
00134
00140 bool hasProperInteriorIntersection() { return hasProperInterior; }
00141
00146 bool hasInteriorIntersection() { return hasInterior; }
00147
00148
00158 void processIntersections(
00159 SegmentString* e0, int segIndex0,
00160 SegmentString* e1, int segIndex1);
00161
00162
00163 static bool isAdjacentSegments(int i1, int i2) {
00164 return std::abs(i1 - i2) == 1;
00165 }
00166
00172 virtual bool isDone() const {
00173 return false;
00174 }
00175 };
00176
00177
00178 }
00179 }
00180
00181
00182
00183
00184
00185 #endif // GEOS_NODING_INTERSECTIONADDER_H
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196