GEOS  3.13.0dev
SimplePointInAreaLocator.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 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 #pragma once
17 
18 #include <geos/algorithm/locate/PointOnGeometryLocator.h> // inherited
19 
20 // Forward declarations
21 namespace geos {
22 namespace geom {
23 class Geometry;
24 class Coordinate;
25 class Polygon;
26 }
27 }
28 
29 namespace geos {
30 namespace algorithm { // geos::algorithm
31 namespace locate { // geos::algorithm::locate
32 
47 
48 public:
49 
50  static geom::Location locate(const geom::CoordinateXY& p,
51  const geom::Geometry* geom);
52 
72  static geom::Location locatePointInPolygon(const geom::CoordinateXY& p,
73  const geom::Polygon* poly);
74 
87  static bool isContained(const geom::CoordinateXY& p,
88  const geom::Geometry* geom);
89 
91  : g(p_g)
92  { }
93 
95  : g(&p_g)
96  { }
97 
99  locate(const geom::CoordinateXY* p) override
100  {
101  return locate(*p, g);
102  }
103 
104 private:
105 
106  static geom::Location locateInGeometry(const geom::CoordinateXY& p,
107  const geom::Geometry* geom);
108 
109  const geom::Geometry* g;
110 
111 };
112 
113 } // geos::algorithm::locate
114 } // geos::algorithm
115 } // geos
116 
117 
An interface for classes which determine the Location of points in Polygon or MultiPolygon geometries...
Definition: PointOnGeometryLocator.h:36
Computes the location of points relative to a polygonal Geometry, using a simple O(n) algorithm.
Definition: SimplePointInAreaLocator.h:46
geom::Location locate(const geom::CoordinateXY *p) override
Definition: SimplePointInAreaLocator.h:99
static bool isContained(const geom::CoordinateXY &p, const geom::Geometry *geom)
Determines whether a point is contained in a Geometry, or lies on its boundary.
static geom::Location locatePointInPolygon(const geom::CoordinateXY &p, const geom::Polygon *poly)
Determines the Location of a point in a Polygon.
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Represents a linear polygon, which may include holes.
Definition: Polygon.h:60
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:32
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25