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 #include <cstdlib>
00023
00024 #include <geos/inline.h>
00025
00026 #include <geos/geom/Coordinate.h>
00027 #include <geos/noding/SegmentIntersector.h>
00028
00029
00030 namespace geos {
00031 namespace geom {
00032 class Coordinate;
00033 }
00034 namespace noding {
00035 class SegmentString;
00036 }
00037 namespace algorithm {
00038 class LineIntersector;
00039 }
00040 }
00041
00042 namespace geos {
00043 namespace noding {
00044
00056 class IntersectionAdder: public SegmentIntersector {
00057
00058 private:
00059
00064 bool hasIntersectionVar;
00065 bool hasProper;
00066 bool hasProperInterior;
00067 bool hasInterior;
00068
00069
00070 const geom::Coordinate* properIntersectionPoint;
00071
00072 algorithm::LineIntersector& li;
00073 bool isSelfIntersection;
00074
00075
00082 bool isTrivialIntersection(const SegmentString* e0, int segIndex0,
00083 const SegmentString* e1, int segIndex1);
00084
00085
00086
00087 public:
00088
00089 int numIntersections;
00090 int numInteriorIntersections;
00091 int numProperIntersections;
00092
00093
00094 int numTests;
00095
00096 IntersectionAdder(algorithm::LineIntersector& newLi)
00097 :
00098 hasIntersectionVar(false),
00099 hasProper(false),
00100 hasProperInterior(false),
00101 hasInterior(false),
00102 properIntersectionPoint(NULL),
00103 li(newLi),
00104 numIntersections(0),
00105 numInteriorIntersections(0),
00106 numProperIntersections(0),
00107 numTests(0)
00108 {}
00109
00110 algorithm::LineIntersector& getLineIntersector() { return li; }
00111
00116 const geom::Coordinate* getProperIntersectionPoint() {
00117 return properIntersectionPoint;
00118 }
00119
00120 bool hasIntersection() { return hasIntersectionVar; }
00121
00130 bool hasProperIntersection() { return hasProper; }
00131
00137 bool hasProperInteriorIntersection() { return hasProperInterior; }
00138
00143 bool hasInteriorIntersection() { return hasInterior; }
00144
00145
00155 void processIntersections(
00156 SegmentString* e0, int segIndex0,
00157 SegmentString* e1, int segIndex1);
00158
00159
00160 static bool isAdjacentSegments(int i1, int i2) {
00161 return abs(i1 - i2) == 1;
00162 }
00163
00164 };
00165
00166
00167 }
00168 }
00169
00170
00171
00172
00173
00174 #endif // GEOS_NODING_INTERSECTIONADDER_H
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185