예제 #1
0
        protected override bool IndexOfAfterCheck(IGeometry linearGeom, Coordinate testPt)
        {
            LocationIndexedLine indexedLine = new LocationIndexedLine(linearGeom);

            // check locations are consecutive
            LinearLocation loc1 = indexedLine.IndexOf(testPt);
            LinearLocation loc2 = indexedLine.IndexOfAfter(testPt, loc1);

            if (loc2.CompareTo(loc1) <= 0)
            {
                return(false);
            }

            // check extracted points are the same as the input
            Coordinate pt1 = indexedLine.ExtractPoint(loc1);
            Coordinate pt2 = indexedLine.ExtractPoint(loc2);

            if (!pt1.Equals2D(testPt))
            {
                return(false);
            }
            if (!pt2.Equals2D(testPt))
            {
                return(false);
            }

            return(true);
        }
예제 #2
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);
 }