/// <summary>
        /// 
        /// </summary>
        /// <param name="subLine"></param>
        /// <returns></returns>
        public virtual LinearLocation[] IndicesOf(IGeometry subLine)
        {
            var startPt = ((ILineString) subLine.GetGeometryN(0)).GetCoordinateN(0);
            var lastLine = (ILineString) subLine.GetGeometryN(subLine.NumGeometries - 1);
            var endPt = lastLine.GetCoordinateN(lastLine.NumPoints - 1);

            var locPt = new LocationIndexOfPoint(_linearGeom);
            var subLineLoc = new LinearLocation[2];
            subLineLoc[0] = locPt.IndexOf(startPt);

            // check for case where subline is zero length
            if (subLine.Length == 0)
                 subLineLoc[1] = (LinearLocation) subLineLoc[0].Clone();
            else subLineLoc[1] = locPt.IndexOfAfter(endPt, subLineLoc[0]);
            return subLineLoc;
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="subLine"></param>
        /// <returns></returns>
        public virtual LinearLocation[] IndicesOf(IGeometry subLine)
        {
            var startPt  = ((ILineString)subLine.GetGeometryN(0)).GetCoordinateN(0);
            var lastLine = (ILineString)subLine.GetGeometryN(subLine.NumGeometries - 1);
            var endPt    = lastLine.GetCoordinateN(lastLine.NumPoints - 1);

            var locPt      = new LocationIndexOfPoint(_linearGeom);
            var subLineLoc = new LinearLocation[2];

            subLineLoc[0] = locPt.IndexOf(startPt);

            // check for case where subline is zero length
            if (subLine.Length == 0)
            {
                subLineLoc[1] = (LinearLocation)subLineLoc[0].Copy();
            }
            else
            {
                subLineLoc[1] = locPt.IndexOfAfter(endPt, subLineLoc[0]);
            }
            return(subLineLoc);
        }
        public static LinearLocation IndexOfAfter(IGeometry linearGeom, Coordinate inputPt, LinearLocation minIndex)
        {
            var locater = new LocationIndexOfPoint(linearGeom);

            return(locater.IndexOfAfter(inputPt, minIndex));
        }
예제 #4
0
 /// <summary>
 /// Finds the index for a point on the line which is greater than the given index.
 /// If no such index exists, returns <paramref name="minIndex" />.
 /// </summary>
 /// <remarks>
 /// <para>
 /// This method can be used to determine all indexes for
 /// a point which occurs more than once on a non-simple line.
 /// It can also be used to disambiguate cases where the given point lies
 /// slightly off the line and is equidistant from two different
 /// points on the line.
 /// </para>
 /// <para>
 /// The supplied point does not <i>necessarily</i> have to lie precisely
 /// on the line, but if it is far from the line the accuracy and
 /// performance of this function is not guaranteed.
 /// Use <see cref="Project"/> to compute a guaranteed result for points
 /// which may be far from the line.
 /// </para>
 /// </remarks>
 /// <param name="pt">A point on the line</param>
 /// <param name="minIndex">The value the returned index must be greater than</param>
 /// <returns>The index of the point greater than the given minimum index</returns>
 /// <seealso cref="Project(Coordinate)"/>
 public LinearLocation IndexOfAfter(Coordinate pt, LinearLocation minIndex)
 {
     return(LocationIndexOfPoint.IndexOfAfter(_linearGeom, pt, minIndex));
 }
 public static LinearLocation IndexOfAfter(IGeometry linearGeom, Coordinate inputPt, LinearLocation minIndex)
 {
     var locater = new LocationIndexOfPoint(linearGeom);
     return locater.IndexOfAfter(inputPt, minIndex);
 }