GEOS: IndexedPointInAreaLocator.h Source File

GEOS 3.3.8

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

- File List

IndexedPointInAreaLocator.h
1 /**********************************************************************
2 * $Id: IndexedPointInAreaLocator.h 2770 2009-12-03 19:27:18Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 *
15 **********************************************************************/
16
17 #ifndef GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
18 #define GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
19
20 #include <geos/algorithm/locate/PointOnGeometryLocator.h> // inherited
21 #include <geos/index/ItemVisitor.h> // inherited
22
23 #include <vector> // composition
24
25 namespace geos {
26 namespace algorithm {
27 class RayCrossingCounter;
28 }
29 namespace geom {
30 class Geometry;
31 class Coordinate;
32 class CoordinateSequence;
33 class LineSegment;
34 }
35 namespace index {
36 namespace intervalrtree {
37 class SortedPackedIntervalRTree;
38 }
39 }
40 }
41
42 namespace geos {
43 namespace algorithm { // geos::algorithm
44 namespace locate { // geos::algorithm::locate
45
56 class IndexedPointInAreaLocator : public PointOnGeometryLocator
57 {
58 private:
59 class IntervalIndexedGeometry
60 {
61 private:
62 index::intervalrtree::SortedPackedIntervalRTree * index;
63
64 void init( const geom::Geometry & g);
65 void addLine( geom::CoordinateSequence * pts);
66
67 // To keep track of allocated LineSegments
68 std::vector< geom::LineSegment* > allocatedSegments;
69
70 public:
71 IntervalIndexedGeometry( const geom::Geometry & g);
72 ~IntervalIndexedGeometry();
73
74 void query(double min, double max, index::ItemVisitor * visitor);
75 };
76
77
78 class SegmentVisitor : public index::ItemVisitor
79 {
80 private:
81 algorithm::RayCrossingCounter * counter;
82
83 public:
84 SegmentVisitor( algorithm::RayCrossingCounter * counter)
85 : counter( counter)
86 { }
87
88 ~SegmentVisitor()
89 { }
90
91 void visitItem( void * item);
92 };
93
94
95 const geom::Geometry & areaGeom;
96 IntervalIndexedGeometry * index;
97
98 void buildIndex( const geom::Geometry & g);
99
100 // Declare type as noncopyable
101 IndexedPointInAreaLocator(const IndexedPointInAreaLocator& other);
102 IndexedPointInAreaLocator& operator=(const IndexedPointInAreaLocator& rhs);
103
104 public:
109 IndexedPointInAreaLocator( const geom::Geometry & g);
110
111 ~IndexedPointInAreaLocator();
112
119 int locate( const geom::Coordinate * /*const*/ p);
120
121 };
122
123 } // geos::algorithm::locate
124 } // geos::algorithm
125 } // geos
126
127 #endif // GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
128 /**********************************************************************
129 * $Log$
130 **********************************************************************/
131