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