GEOS  3.11.0
IndexedFacetDistance.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2016 Daniel Baston
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: operation/distance/IndexedFacetDistance.java (f6187ee2 JTS-1.14)
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <geos/operation/distance/FacetSequenceTreeBuilder.h>
22 
23 namespace geos {
24 namespace operation {
25 namespace distance {
26 
46 class GEOS_DLL IndexedFacetDistance {
47 public:
48 
61  cachedTree(FacetSequenceTreeBuilder::build(g))
62  {}
63 
72  static double distance(const geom::Geometry* g1, const geom::Geometry* g2);
73 
79  static std::vector<geom::Coordinate> nearestPoints(const geom::Geometry* g1, const geom::Geometry* g2);
80 
86  double distance(const geom::Geometry* g) const;
87 
92  std::vector<GeometryLocation> nearestLocations(const geom::Geometry* g) const;
93 
98  std::vector<geom::Coordinate> nearestPoints(const geom::Geometry* g) const;
99 
100 private:
101  std::unique_ptr<geos::index::strtree::TemplateSTRtree<const FacetSequence*>> cachedTree;
102 
103 };
104 }
105 }
106 }
107 
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Computes the distance between the facets (segments and vertices) of two Geometrys using a Branch-and-...
Definition: IndexedFacetDistance.h:46
std::vector< geom::Coordinate > nearestPoints(const geom::Geometry *g) const
Compute the nearest locations on the target geometry and the given geometry.
static std::vector< geom::Coordinate > nearestPoints(const geom::Geometry *g1, const geom::Geometry *g2)
Computes the nearest points of the facets of two geometries.
double distance(const geom::Geometry *g) const
Computes the distance from the base geometry to the given geometry.
static double distance(const geom::Geometry *g1, const geom::Geometry *g2)
Computes the distance between facets of two geometries.
std::vector< GeometryLocation > nearestLocations(const geom::Geometry *g) const
Computes the nearest locations on the base geometry and the given geometry.
IndexedFacetDistance(const geom::Geometry *g)
Creates a new distance-finding instance for a given target geom::Geometry.
Definition: IndexedFacetDistance.h:60
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25