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