IndexedDistanceToPoint.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2023 Martin Davis <mtnclimb@gmail.com>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: algorithm/construct/IndexedDistanceToPoint.java
* https://github.com/locationtech/jts/commit/d92f783163d9440fcc10c729143787bf7b9fe8f9
*
**********************************************************************/
#pragma once
#include <geos/geom/CoordinateSequence.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/Point.h>
#include <geos/algorithm/construct/IndexedPointInPolygonsLocator.h>
#include <geos/operation/distance/IndexedFacetDistance.h>
namespace geos {
namespace algorithm { // geos::algorithm
namespace construct { // geos::algorithm::construct
class GEOS_DLL IndexedDistanceToPoint {
using Geometry = geos::geom::Geometry;
using Point = geos::geom::Point;
using IndexedFacetDistance = geos::operation::distance::IndexedFacetDistance;
public:
IndexedDistanceToPoint(const Geometry& geom);
double distance(const Point& pt);
std::unique_ptr<geom::CoordinateSequence> nearestPoints(const Point& pt);
private:
void init();
bool isInArea(const Point& pt);
//-- members
const Geometry& targetGeometry;
std::unique_ptr<operation::distance::IndexedFacetDistance> facetDistance;
std::unique_ptr<IndexedPointInPolygonsLocator> ptLocator;
};
}}}
geos::algorithm::construct::IndexedDistanceToPoint::nearestPoints
std::unique_ptr< geom::CoordinateSequence > nearestPoints(const Point &pt)
Computes the nearest point on the geometry to the point.
geos::algorithm::construct::IndexedDistanceToPoint::IndexedDistanceToPoint
IndexedDistanceToPoint(const Geometry &geom)
Creates an instance to find the distance from points to a geometry.
geos::algorithm::construct::IndexedDistanceToPoint::distance
double distance(const Point &pt)
Computes the distance from the base geometry to the given point.
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::Point
Definition Point.h:61
geos::operation::distance::IndexedFacetDistance
Computes the distance between the facets (segments and vertices) of two Geometrys using a Branch-and-...
Definition IndexedFacetDistance.h:46
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38