00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
00018 #define GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
00019
00020 #include <vector>
00021
00022 #include <geos/geom/Envelope.h>
00023
00024 #include <geos/index/sweepline/SweepLineOverlapAction.h>
00025 #include <geos/index/sweepline/SweepLineIndex.h>
00026
00027
00028 namespace geos {
00029 namespace geom {
00030 class LinearRing;
00031 class Envelope;
00032 class Coordinate;
00033 }
00034 namespace index {
00035 namespace sweepline {
00036 class SweepLineIndex;
00037 }
00038 }
00039 namespace geomgraph {
00040 class GeometryGraph;
00041 }
00042 }
00043
00044 namespace geos {
00045 namespace operation {
00046 namespace valid {
00047
00053 class SweeplineNestedRingTester {
00054
00055 private:
00056 geomgraph::GeometryGraph *graph;
00057 std::vector<geom::LinearRing*> rings;
00058 geom::Envelope *totalEnv;
00059 index::sweepline::SweepLineIndex *sweepLine;
00060 geom::Coordinate *nestedPt;
00061 void buildIndex();
00062
00063 public:
00064
00065 SweeplineNestedRingTester(geomgraph::GeometryGraph *newGraph)
00066 :
00067 graph(newGraph),
00068 rings(),
00069 totalEnv(new geom::Envelope()),
00070 sweepLine(new index::sweepline::SweepLineIndex()),
00071 nestedPt(NULL)
00072 {}
00073
00074 ~SweeplineNestedRingTester()
00075 {
00076 delete totalEnv;
00077 delete sweepLine;
00078 }
00079
00080
00081
00082
00083
00084
00085
00086 geom::Coordinate *getNestedPoint() { return nestedPt; }
00087
00088 void add(geom::LinearRing* ring) {
00089 rings.push_back(ring);
00090 }
00091
00092 bool isNonNested();
00093 bool isInside(geom::LinearRing *innerRing, geom::LinearRing *searchRing);
00094 class OverlapAction: public index::sweepline::SweepLineOverlapAction {
00095 public:
00096 bool isNonNested;
00097 OverlapAction(SweeplineNestedRingTester *p);
00098 void overlap(index::sweepline::SweepLineInterval *s0,
00099 index::sweepline::SweepLineInterval *s1);
00100 private:
00101 SweeplineNestedRingTester *parent;
00102 };
00103 };
00104
00105
00106 }
00107 }
00108 }
00109
00110 #endif // GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121