GEOS: PointLocator.h Source File

GEOS 3.3.8

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

- File List

PointLocator.h
1 /**********************************************************************
2 * $Id: PointLocator.h 3174 2011-02-02 19:24:03Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2005-2011 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: algorithm/PointLocator.java r320 (JTS-1.12)
18 *
19 **********************************************************************/
20
21 #ifndef GEOS_ALGORITHM_POINTLOCATOR_H
22 #define GEOS_ALGORITHM_POINTLOCATOR_H
23
24 #include <geos/export.h>
25 #include <geos/geom/Location.h> // for inlines
26
27 // Forward declarations
28 namespace geos {
29 namespace geom {
30 class Coordinate;
31 class Geometry;
32 class LinearRing;
33 class LineString;
34 class Polygon;
35 }
36 }
37
38 namespace geos {
39 namespace algorithm { // geos::algorithm
40
58 class GEOS_DLL PointLocator {
59 public:
60 PointLocator() {}
61 ~PointLocator() {}
62
73 int locate(const geom::Coordinate& p, const geom::Geometry *geom);
74
83 bool intersects(const geom::Coordinate& p, const geom::Geometry *geom) {
84 return locate(p, geom) != geom::Location::EXTERIOR;
85 }
86
87 private:
88
89 bool isIn; // true if the point lies in or on any Geometry element
90
91 int numBoundaries; // the number of sub-elements whose boundaries the point lies in
92
93 void computeLocation(const geom::Coordinate& p, const geom::Geometry *geom);
94
95 void updateLocationInfo(int loc);
96
97 int locate(const geom::Coordinate& p, const geom::LineString *l);
98
99 int locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing *ring);
100
101 int locate(const geom::Coordinate& p, const geom::Polygon *poly);
102
103 };
104
105 } // namespace geos::algorithm
106 } // namespace geos
107
108
109 #endif // GEOS_ALGORITHM_POINTLOCATOR_H
110
111 /**********************************************************************
112 * $Log$
113 * Revision 1.1 2006/03/09 16:46:48 strk
114 * geos::geom namespace definition, first pass at headers split
115 *
116 **********************************************************************/
117