GEOS 3.14.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
28namespace geos {
29namespace algorithm { // geos::algorithm
30namespace construct { // geos::algorithm::construct
31
41class GEOS_DLL IndexedDistanceToPoint {
45
46public:
53
61 double distance(const Point& pt);
62
73 std::unique_ptr<geom::CoordinateSequence> nearestPoints(const Point& pt);
74
75private:
76 void init();
77
78 bool isInArea(const Point& pt);
79
80 //-- members
81 const Geometry& targetGeometry;
82 std::unique_ptr<operation::distance::IndexedFacetDistance> facetDistance;
83 std::unique_ptr<IndexedPointInPolygonsLocator> ptLocator;
84
85};
86
87}}}
Computes the distance between a point and a geometry (which may be a collection containing any type o...
Definition IndexedDistanceToPoint.h:41
std::unique_ptr< geom::CoordinateSequence > nearestPoints(const Point &pt)
Computes the nearest point on the geometry to the point.
IndexedDistanceToPoint(const Geometry &geom)
Creates an instance to find the distance from points to a geometry.
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:197
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 geos.h:39