00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_NODING_INTERSECTIONADDER_H
00017 #define GEOS_NODING_INTERSECTIONADDER_H
00018
00019 #include <vector>
00020 #include <iostream>
00021 #include <cmath>
00022
00023 #include <geos/inline.h>
00024
00025 #include <geos/geom/Coordinate.h>
00026 #include <geos/noding/SegmentIntersector.h>
00027
00028
00029 namespace geos {
00030 namespace geom {
00031 class Coordinate;
00032 }
00033 namespace noding {
00034 class SegmentString;
00035 }
00036 namespace algorithm {
00037 class LineIntersector;
00038 }
00039 }
00040
00041 namespace geos {
00042 namespace noding {
00043
00055 class IntersectionAdder: public SegmentIntersector {
00056
00057 private:
00058
00063 bool hasIntersectionVar;
00064 bool hasProper;
00065 bool hasProperInterior;
00066 bool hasInterior;
00067
00068
00069 const geom::Coordinate* properIntersectionPoint;
00070
00071 algorithm::LineIntersector& li;
00072 bool isSelfIntersection;
00073
00074
00081 bool isTrivialIntersection(const SegmentString* e0, int segIndex0,
00082 const SegmentString* e1, int segIndex1);
00083
00084
00085
00086 public:
00087
00088 int numIntersections;
00089 int numInteriorIntersections;
00090 int numProperIntersections;
00091
00092
00093 int numTests;
00094
00095 IntersectionAdder(algorithm::LineIntersector& newLi)
00096 :
00097 hasIntersectionVar(false),
00098 hasProper(false),
00099 hasProperInterior(false),
00100 hasInterior(false),
00101 properIntersectionPoint(NULL),
00102 li(newLi),
00103 numIntersections(0),
00104 numInteriorIntersections(0),
00105 numProperIntersections(0),
00106 numTests(0)
00107 {}
00108
00109 algorithm::LineIntersector& getLineIntersector() { return li; }
00110
00115 const geom::Coordinate* getProperIntersectionPoint() {
00116 return properIntersectionPoint;
00117 }
00118
00119 bool hasIntersection() { return hasIntersectionVar; }
00120
00129 bool hasProperIntersection() { return hasProper; }
00130
00136 bool hasProperInteriorIntersection() { return hasProperInterior; }
00137
00142 bool hasInteriorIntersection() { return hasInterior; }
00143
00144
00154 void processIntersections(
00155 SegmentString* e0, int segIndex0,
00156 SegmentString* e1, int segIndex1);
00157
00158
00159 static bool isAdjacentSegments(int i1, int i2) {
00160 return abs(i1 - i2) == 1;
00161 }
00162
00163 };
00164
00165
00166 }
00167 }
00168
00169
00170
00171
00172
00173 #endif // GEOS_NODING_INTERSECTIONADDER_H
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184