コード例 #1
0
        /// <summary>
        /// Finds the two nearest items from this tree
        /// and another tree,
        /// using <see cref="IItemDistance{Envelope, TItem}"/> as the distance metric.
        /// A Branch-and-Bound tree traversal algorithm is used
        /// to provide an efficient search.
        /// The result value is a pair of items,
        /// the first from this tree and the second
        /// from the argument tree.
        /// </summary>
        /// <param name="tree">Another tree</param>
        /// <param name="itemDist">A distance metric applicable to the items in the trees</param>
        /// <returns>The pair of the nearest items, one from each tree or <c>null</c> if no pair of distinct items can be found.</returns>
        public TItem[] NearestNeighbour(STRtree <TItem> tree, IItemDistance <Envelope, TItem> itemDist)
        {
            if (IsEmpty || tree.IsEmpty)
            {
                return(null);
            }
            var bp = new BoundablePair <TItem>(Root, tree.Root, itemDist);

            return(NearestNeighbour(bp));
        }
コード例 #2
0
        /**
         * Tests whether some two items from this tree and another tree
         * lie within a given distance.
         * {@link ItemDistance} is used as the distance metric.
         * A Branch-and-Bound tree traversal algorithm is used
         * to provide an efficient search.
         *
         * @param tree another tree
         * @param itemDist a distance metric applicable to the items in the trees
         * @param maxDistance the distance limit for the search
         * @return true if there are items within the distance
         */
        public bool IsWithinDistance(STRtree <TItem> tree, IItemDistance <Envelope, TItem> itemDist, double maxDistance)
        {
            var bp = new BoundablePair <TItem>(Root, tree.Root, itemDist);

            return(IsWithinDistance(bp, maxDistance));
        }