Example #1
0
        /// <summary>
        /// Computes the <see cref="LineString" /> for the interval
        /// on the line between the given indices.
        /// If the <paramref name="endIndex" /> lies before the <paramref name="startIndex" />,
        /// the computed geometry is reversed.
        /// </summary>
        /// <param name="startIndex"></param>
        /// <param name="endIndex"></param>
        /// <returns></returns>
        public Geometry ExtractLine(double startIndex, double endIndex)
        {
            double startIndex2 = ClampIndex(startIndex);
            double endIndex2   = ClampIndex(endIndex);
            // if extracted line is zero-length, resolve start lower as well to ensure they are equal
            bool resolveStartLower = startIndex2 == endIndex2;
            var  startLoc          = LocationOf(startIndex2, resolveStartLower);
            //    LinearLocation endLoc = locationOf(endIndex2, true);
            //    LinearLocation startLoc = locationOf(startIndex2);
            var endLoc = LocationOf(endIndex2);

            return(ExtractLineByLocation.Extract(_linearGeom, startLoc, endLoc));
        }
        /// <summary>
        /// Computes the subline of a <see cref="ILineString" /> between
        /// two <see cref="LinearLocation"/>s on the line.
        /// If the start location is after the end location,
        /// the computed geometry is reversed.
        /// </summary>
        /// <param name="line">The line to use as the baseline.</param>
        /// <param name="start">The start location.</param>
        /// <param name="end">The end location.</param>
        /// <returns>The extracted subline.</returns>
        public static IGeometry Extract(IGeometry line, LinearLocation start, LinearLocation end)
        {
            var ls = new ExtractLineByLocation(line);

            return(ls.Extract(start, end));
        }
Example #3
0
 /// <summary>
 /// Computes the <see cref="LineString" /> for the interval
 /// on the line between the given indices.
 /// If the start location is after the end location,
 /// the computed linear geometry has reverse orientation to the input line.
 /// </summary>
 /// <param name="startIndex">The index of the start of the interval.</param>
 /// <param name="endIndex">The index of the end of the interval.</param>
 /// <returns>The linear interval between the indices.</returns>
 public Geometry ExtractLine(LinearLocation startIndex, LinearLocation endIndex)
 {
     return(ExtractLineByLocation.Extract(_linearGeom, startIndex, endIndex));
 }
 /// <summary>
 /// Computes the subline of a <see cref="ILineString" /> between
 /// two <see cref="LinearLocation"/>s on the line.
 /// If the start location is after the end location,
 /// the computed linear geometry has reverse orientation to the input line.
 /// </summary>
 /// <param name="line">The line to use as the baseline.</param>
 /// <param name="start">The start location.</param>
 /// <param name="end">The end location.</param>
 /// <returns>The extracted subline.</returns>
 public static IGeometry Extract(IGeometry line, LinearLocation start, LinearLocation end)
 {
     var ls = new ExtractLineByLocation(line);
     return ls.Extract(start, end);
 }