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

            LocationIndexOfPoint locPt = new LocationIndexOfPoint(linearGeom);
            LinearLocation[] 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;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="subLine"></param>
        /// <returns></returns>
        public virtual LinearLocation[] IndicesOf(IGeometry subLine)
        {
            ICoordinate startPt = ((ILineString) subLine.GetGeometryN(0)).GetCoordinateN(0);
            ILineString lastLine = (ILineString) subLine.GetGeometryN(subLine.NumGeometries - 1);
            ICoordinate endPt = lastLine.GetCoordinateN(lastLine.NumPoints - 1);

            LocationIndexOfPoint locPt = new LocationIndexOfPoint(linearGeom);
            LinearLocation[] 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;
        }
Exemple #3
0
 /// <summary>
 /// Computes the index for the closest point on the line to the given point.
 /// If more than one point has the closest distance the first one along the line is returned.
 /// (The point does not necessarily have to lie precisely on the line.)
 /// </summary>
 /// <param name="pt">A point on the line.</param>
 /// <returns>The index of the point.</returns>
 public LinearLocation Project(ICoordinate pt)
 {
     return(LocationIndexOfPoint.IndexOf(linearGeom, pt));
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="linearGeom"></param>
 /// <param name="inputPt"></param>
 /// <returns></returns>
 public static LinearLocation IndexOf(IGeometry linearGeom, ICoordinate inputPt)
 {
     LocationIndexOfPoint locater = new LocationIndexOfPoint(linearGeom);
     return locater.IndexOf(inputPt);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="linearGeom"></param>
        /// <param name="inputPt"></param>
        /// <returns></returns>
        public static LinearLocation IndexOf(IGeometry linearGeom, ICoordinate inputPt)
        {
            LocationIndexOfPoint locater = new LocationIndexOfPoint(linearGeom);

            return(locater.IndexOf(inputPt));
        }