GEOS 3.15.0dev
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 95fbe34b (JTS-1.15.2-SNAPSHOT)
17 *
18 **********************************************************************/
19
20#pragma once
21
22#include <geos/export.h>
23#include <geos/geom/Location.h> // for inlines
24
25// Forward declarations
26namespace geos {
27namespace geom {
28class CircularString;
29class CompoundCurve;
30class CoordinateXY;
31class Curve;
32class Geometry;
33class LinearRing;
34class LineString;
35class Polygon;
36class Point;
37class Surface;
38}
39}
40
41namespace geos {
42namespace algorithm { // geos::algorithm
43
60class GEOS_DLL PointLocator {
61public:
62 PointLocator() {}
63 ~PointLocator() {}
64
73 geom::Location locate(const geom::CoordinateXY& p, const geom::Geometry* geom);
74
83 bool
84 intersects(const geom::CoordinateXY& p, const geom::Geometry* geom)
85 {
86 return locate(p, geom) != geom::Location::EXTERIOR;
87 }
88
89private:
90
91 bool isIn; // true if the point lies in or on any Geometry element
92
93 int numBoundaries; // the number of sub-elements whose boundaries the point lies in
94
95 void computeLocation(const geom::CoordinateXY& p, const geom::Geometry* geom);
96
97 void updateLocationInfo(geom::Location loc);
98
99 geom::Location locate(const geom::CoordinateXY& p, const geom::Point* pt);
100
101 geom::Location locate(const geom::CoordinateXY& p, const geom::LineString* l);
102
103 geom::Location locate(const geom::CoordinateXY& p, const geom::CircularString* cs);
104
105 geom::Location locate(const geom::CoordinateXY& p, const geom::CompoundCurve* cs);
106
107 static geom::Location locateInPolygonRing(const geom::CoordinateXY& p, const geom::Curve* ring);
108
109 static geom::Location locate(const geom::CoordinateXY& p, const geom::Surface* poly);
110
111};
112
113} // namespace geos::algorithm
114} // namespace geos
115
116
Computes the topological relationship (Location) of a single point to a Geometry.
Definition PointLocator.h:60
bool intersects(const geom::CoordinateXY &p, const geom::Geometry *geom)
Definition PointLocator.h:84
geom::Location locate(const geom::CoordinateXY &p, const geom::Geometry *geom)
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:200
Definition LineString.h:66
Definition Point.h:61
Definition Surface.h:27
Location
Constants representing the location of a point relative to a geometry.
Definition Location.h:32
Basic namespace for all GEOS functionalities.
Definition geos.h:38