GEOS: IndexedPointInAreaLocator.h Source File

GEOS 3.5.0

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

- File List

IndexedPointInAreaLocator.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 *
14 **********************************************************************/
15
16 #ifndef GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
17 #define GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
18
19 #include <geos/algorithm/locate/PointOnGeometryLocator.h> // inherited
20 #include <geos/index/ItemVisitor.h> // inherited
21
22 #include <vector> // composition
23
24 namespace geos {
25 namespace algorithm {
26 class RayCrossingCounter;
27 }
28 namespace geom {
29 class Geometry;
30 class Coordinate;
31 class CoordinateSequence;
32 class LineSegment;
33 }
34 namespace index {
35 namespace intervalrtree {
36 class SortedPackedIntervalRTree;
37 }
38 }
39 }
40
41 namespace geos {
42 namespace algorithm { // geos::algorithm
43 namespace locate { // geos::algorithm::locate
44
55 class IndexedPointInAreaLocator : public PointOnGeometryLocator
56 {
57 private:
58 class IntervalIndexedGeometry
59 {
60 private:
61 index::intervalrtree::SortedPackedIntervalRTree * index;
62
63 void init( const geom::Geometry & g);
64 void addLine( geom::CoordinateSequence * pts);
65
66 // To keep track of allocated LineSegments
67 std::vector< geom::LineSegment* > allocatedSegments;
68
69 public:
70 IntervalIndexedGeometry( const geom::Geometry & g);
71 ~IntervalIndexedGeometry();
72
73 void query(double min, double max, index::ItemVisitor * visitor);
74 };
75
76
77 class SegmentVisitor : public index::ItemVisitor
78 {
79 private:
80 algorithm::RayCrossingCounter * counter;
81
82 public:
83 SegmentVisitor( algorithm::RayCrossingCounter * counter)
84 : counter( counter)
85 { }
86
87 ~SegmentVisitor()
88 { }
89
90 void visitItem( void * item);
91 };
92
93
94 const geom::Geometry & areaGeom;
95 IntervalIndexedGeometry * index;
96
97 void buildIndex( const geom::Geometry & g);
98
99 // Declare type as noncopyable
100 IndexedPointInAreaLocator(const IndexedPointInAreaLocator& other);
101 IndexedPointInAreaLocator& operator=(const IndexedPointInAreaLocator& rhs);
102
103 public:
108 IndexedPointInAreaLocator( const geom::Geometry & g);
109
110 ~IndexedPointInAreaLocator();
111
118 int locate( const geom::Coordinate * /*const*/ p);
119
120 };
121
122 } // geos::algorithm::locate
123 } // geos::algorithm
124 } // geos
125
126 #endif // GEOS_ALGORITHM_LOCATE_INDEXEDPOINTINAREALOCATOR_H
geos::algorithm::locate::IndexedPointInAreaLocator
Determines the location of Coordinates relative to a Polygon or MultiPolygon geometry, using indexing for efficiency.
Definition: IndexedPointInAreaLocator.h:55
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::index::intervalrtree::SortedPackedIntervalRTree
A static index on a set of 1-dimensional intervals, using an R-Tree packed based on the order of the ...
Definition: SortedPackedIntervalRTree.h:49
geos::algorithm::locate::PointOnGeometryLocator
An interface for classes which determine the Location of points in Polygon or MultiPolygon geometries...
Definition: PointOnGeometryLocator.h:35
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
geos::index::ItemVisitor
A visitor for items in an index.
Definition: ItemVisitor.h:29
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
geos::algorithm::RayCrossingCounter
Counts the number of segments crossed by a horizontal ray extending to the right from a given point...
Definition: RayCrossingCounter.h:66