GEOS  3.13.0dev
IndexedDistanceToPoint.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2023 Martin Davis <mtnclimb@gmail.com>
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  * Last port: algorithm/construct/IndexedDistanceToPoint.java
16  * https://github.com/locationtech/jts/commit/d92f783163d9440fcc10c729143787bf7b9fe8f9
17  *
18  **********************************************************************/
19 
20 #pragma once
21 
22 #include <geos/geom/CoordinateSequence.h>
23 #include <geos/geom/Geometry.h>
24 #include <geos/geom/Point.h>
25 #include <geos/algorithm/construct/IndexedPointInPolygonsLocator.h>
26 #include <geos/operation/distance/IndexedFacetDistance.h>
27 
29 using geos::geom::Point;
31 
32 namespace geos {
33 namespace algorithm { // geos::algorithm
34 namespace construct { // geos::algorithm::construct
35 
45 class GEOS_DLL IndexedDistanceToPoint {
46 
47 public:
54 
62  double distance(const Point& pt);
63 
74  std::unique_ptr<geom::CoordinateSequence> nearestPoints(const Point& pt);
75 
76 private:
77  void init();
78 
79  bool isInArea(const Point& pt);
80 
81  //-- members
82  const Geometry& targetGeometry;
83  std::unique_ptr<operation::distance::IndexedFacetDistance> facetDistance;
84  std::unique_ptr<IndexedPointInPolygonsLocator> ptLocator;
85 
86 };
87 
88 }}}
Computes the distance between a point and a geometry (which may be a collection containing any type o...
Definition: IndexedDistanceToPoint.h:45
IndexedDistanceToPoint(const Geometry &geom)
Creates an instance to find the distance from points to a geometry.
std::unique_ptr< geom::CoordinateSequence > nearestPoints(const Point &pt)
Computes the nearest point on the geometry to the point.
double distance(const Point &pt)
Computes the distance from the base geometry to the given point.
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Definition: Point.h:61
Computes the distance between the facets (segments and vertices) of two Geometrys using a Branch-and-...
Definition: IndexedFacetDistance.h:46
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25