Beispiel #1
0
 /// <summary>
 /// Extracts a subline of the input.
 /// If <paramref name="end" /> is minor that <paramref name="start" />,
 /// the linear geometry computed will be reversed.
 /// </summary>
 /// <param name="start">The start location.</param>
 /// <param name="end">The end location.</param>
 /// <returns>A linear geometry.</returns>
 public IGeometry Extract(LinearLocation start, LinearLocation end)
 {
     if (end.CompareTo(start) < 0)
     {
         return(Reverse(ComputeLinear(end, start)));
     }
     return(ComputeLinear(start, end));
 }
        /// <summary>
        /// Find the nearest <see cref="LinearLocation" /> along the linear <see cref="Geometry" />
        /// to a given <see cref="Geometry" /> after the specified minimum <see cref="LinearLocation" />.
        /// If possible the location returned will be strictly greater than the <paramref name="minIndex" />.
        /// If this is not possible, the value returned will equal <paramref name="minIndex" />.
        /// (An example where this is not possible is when <paramref name="minIndex" /> = [end of line] ).
        /// </summary>
        /// <param name="inputPt">The coordinate to locate.</param>
        /// <param name="minIndex">The minimum location for the point location.</param>
        /// <returns>The location of the nearest point.</returns>
        public LinearLocation IndexOfAfter(ICoordinate inputPt, LinearLocation minIndex)
        {
            if (minIndex == null)
            {
                return(IndexOf(inputPt));
            }

            // sanity check for minLocation at or past end of line
            LinearLocation endLoc = LinearLocation.GetEndLocation(linearGeom);

            if (endLoc.CompareTo(minIndex) <= 0)
            {
                return(endLoc);
            }

            LinearLocation closestAfter = IndexOfFromStart(inputPt, minIndex);

            /*
             * Return the minDistanceLocation found.
             * This will not be null, since it was initialized to minLocation
             */
            Assert.IsTrue(closestAfter.CompareTo(minIndex) >= 0, "computed location is before specified minimum location");
            return(closestAfter);
        }