GEOS 3.4.2

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

- File List

PointLocator.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2011 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions 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 * Last port: algorithm/PointLocator.java r320 (JTS-1.12)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_ALGORITHM_POINTLOCATOR_H
21 #define GEOS_ALGORITHM_POINTLOCATOR_H
22
23 #include <geos/export.h>
24 #include <geos/geom/Location.h> // for inlines
25
26 // Forward declarations
27 namespace geos {
28 namespace geom {
29 class Coordinate;
30 class Geometry;
31 class LinearRing;
32 class LineString;
33 class Polygon;
34 }
35 }
36
37 namespace geos {
38 namespace algorithm { // geos::algorithm
39
57 class GEOS_DLL PointLocator {
58 public:
59 PointLocator() {}
60 ~PointLocator() {}
61
72 int locate(const geom::Coordinate& p, const geom::Geometry *geom);
73
82 bool intersects(const geom::Coordinate& p, const geom::Geometry *geom) {
83 return locate(p, geom) != geom::Location::EXTERIOR;
84 }
85
86 private:
87
88 bool isIn; // true if the point lies in or on any Geometry element
89
90 int numBoundaries; // the number of sub-elements whose boundaries the point lies in
91
92 void computeLocation(const geom::Coordinate& p, const geom::Geometry *geom);
93
94 void updateLocationInfo(int loc);
95
96 int locate(const geom::Coordinate& p, const geom::LineString *l);
97
98 int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring);
99
100 int locate(const geom::Coordinate& p, const geom::Polygon *poly);
101
102 };
103
104 } // namespace geos::algorithm
105 } // namespace geos
106
107
108 #endif // GEOS_ALGORITHM_POINTLOCATOR_H
109