GEOS: IndexedPointInAreaLocator.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# IndexedPointInAreaLocator.h

    00001 /**********************************************************************
    00002  * $Id: IndexedPointInAreaLocator.h 2770 2009-12-03 19:27:18Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    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> // inherited
    00021 #include <geos/index/ItemVisitor.h> // inherited
    00022
    00023 #include <vector> // composition
    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 { // geos::algorithm
    00044 namespace locate { // geos::algorithm::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                 // To keep track of allocated LineSegments
    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     // Declare type as noncopyable
    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 * /*const*/ p);
    00120
    00121 };
    00122
    00123 } // geos::algorithm::locate
    00124 } // geos::algorithm
    00125 } // geos
    00126
    00127 #endif // GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
    00128 /**********************************************************************
    00129  * $Log$
    00130  **********************************************************************/
    00131