00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
00018 #define GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
00019
00020
00021 #include <geos/export.h>
00022 #include <vector>
00023
00024 #include <geos/geom/Coordinate.h>
00025
00026
00027 namespace geos {
00028 namespace algorithm {
00029 class LineIntersector;
00030 }
00031 namespace geomgraph {
00032 class Node;
00033 class Edge;
00034 }
00035 }
00036
00037 namespace geos {
00038 namespace geomgraph {
00039 namespace index {
00040
00041
00042 class GEOS_DLL SegmentIntersector{
00043
00044 private:
00045
00050 bool hasIntersectionVar;
00051
00052 bool hasProper;
00053
00054 bool hasProperInterior;
00055
00056
00057 geom::Coordinate properIntersectionPoint;
00058
00059 algorithm::LineIntersector *li;
00060
00061 bool includeProper;
00062
00063 bool recordIsolated;
00064
00065
00066
00067
00068
00069 int numIntersections;
00070
00072 std::vector<std::vector<Node*>*> bdyNodes;
00073
00074 bool isTrivialIntersection(Edge *e0,int segIndex0,Edge *e1, int segIndex1);
00075
00076 bool isBoundaryPoint(algorithm::LineIntersector *li,
00077 std::vector<std::vector<Node*>*>& tstBdyNodes);
00078
00079 bool isBoundaryPoint(algorithm::LineIntersector *li,
00080 std::vector<Node*> *tstBdyNodes);
00081
00082 public:
00083
00084 static bool isAdjacentSegments(int i1,int i2);
00085
00086
00087 int numTests;
00088
00089
00090
00091 virtual ~SegmentIntersector() {}
00092
00093 SegmentIntersector(algorithm::LineIntersector *newLi,
00094 bool newIncludeProper, bool newRecordIsolated)
00095 :
00096 hasIntersectionVar(false),
00097 hasProper(false),
00098 hasProperInterior(false),
00099 li(newLi),
00100 includeProper(newIncludeProper),
00101 recordIsolated(newRecordIsolated),
00102 numIntersections(0),
00103 bdyNodes(2),
00104 numTests(0)
00105 {}
00106
00110 void setBoundaryNodes(std::vector<Node*> *bdyNodes0,
00111 std::vector<Node*> *bdyNodes1);
00112
00113 geom::Coordinate& getProperIntersectionPoint();
00114
00115 bool hasIntersection();
00116
00117 bool hasProperIntersection();
00118
00119 bool hasProperInteriorIntersection();
00120
00121 void addIntersections(Edge *e0, int segIndex0, Edge *e1, int segIndex1);
00122
00123 };
00124
00125
00126 }
00127 }
00128 }
00129
00130 #endif
00131
00132
00133
00134
00135
00136
00137
00138