Example #1
0
        /// <summary>
        /// Computes the distance from the base geometry to the given geometry.
        /// </summary>
        /// <param name="g">The geometry to compute the distance to.</param>
        /// <returns>The computed distance</returns>
        public double GetDistance(IGeometry g)
        {
            var tree2 = FacetSequenceTreeBuilder.BuildSTRtree(g);
            var obj   = _cachedTree.NearestNeighbour(tree2, new FacetSequenceDistance());

            return(FacetDistance(obj));
        }
Example #2
0
 /// <summary>
 /// Creates a new distance-finding instance for a given target <see cref="IGeometry"/>.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Distances will be computed to all facets of the input geometry.
 /// The facets of the geometry are the discrete segments and points
 /// contained in its components.  </para>
 /// <para>
 /// In the case of <see cref="ILineal"/> and <see cref="IPuntal"/> inputs,
 /// this is equivalent to computing the conventional distance.
 /// </para><para>
 /// In the case of <see cref="IPolygonal"/> inputs, this is equivalent
 /// to computing the distance to the polygons boundaries.
 /// </para>
 /// </remarks>
 /// <param name="g1">A Geometry, which may be of any type.</param>
 public IndexedFacetDistance(IGeometry g1)
 {
     _cachedTree = FacetSequenceTreeBuilder.BuildSTRtree(g1);
 }