00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
00018 #define GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
00019
00020 #include <geos/algorithm/locate/PointOnGeometryLocator.h>
00021 #include <geos/index/ItemVisitor.h>
00022
00023 #include <vector>
00024
00025 namespace geos {
00026 namespace algorithm {
00027 class RayCrossingCounter;
00028 }
00029 namespace geom {
00030 class Geometry;
00031 class Coordinate;
00032 class CoordinateSequence;
00033 class LineSegment;
00034 }
00035 namespace index {
00036 namespace intervalrtree {
00037 class SortedPackedIntervalRTree;
00038 }
00039 }
00040 }
00041
00042 namespace geos {
00043 namespace algorithm {
00044 namespace locate {
00045
00056 class IndexedPointInAreaLocator : public PointOnGeometryLocator
00057 {
00058 private:
00059 class IntervalIndexedGeometry
00060 {
00061 private:
00062 index::intervalrtree::SortedPackedIntervalRTree * index;
00063
00064 void init( const geom::Geometry & g);
00065 void addLine( geom::CoordinateSequence * pts);
00066
00067
00068 std::vector< geom::LineSegment* > allocatedSegments;
00069
00070 public:
00071 IntervalIndexedGeometry( const geom::Geometry & g);
00072 ~IntervalIndexedGeometry();
00073
00074 void query(double min, double max, index::ItemVisitor * visitor);
00075 };
00076
00077
00078 class SegmentVisitor : public index::ItemVisitor
00079 {
00080 private:
00081 algorithm::RayCrossingCounter * counter;
00082
00083 public:
00084 SegmentVisitor( algorithm::RayCrossingCounter * counter)
00085 : counter( counter)
00086 { }
00087
00088 ~SegmentVisitor()
00089 { }
00090
00091 void visitItem( void * item);
00092 };
00093
00094
00095 const geom::Geometry & areaGeom;
00096 IntervalIndexedGeometry * index;
00097
00098 void buildIndex( const geom::Geometry & g);
00099
00100
00101 IndexedPointInAreaLocator(const IndexedPointInAreaLocator& other);
00102 IndexedPointInAreaLocator& operator=(const IndexedPointInAreaLocator& rhs);
00103
00104 public:
00109 IndexedPointInAreaLocator( const geom::Geometry & g);
00110
00111 ~IndexedPointInAreaLocator();
00112
00119 int locate( const geom::Coordinate * p);
00120
00121 };
00122
00123 }
00124 }
00125 }
00126
00127 #endif // GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
00128
00129
00130
00131