/// <summary> /// /// </summary> /// <param name="wkt"></param> /// <param name="start"></param> /// <param name="end"></param> public void RunExtractedLine(string wkt, double start, double end) { Console.WriteLine("========================="); IGeometry g1 = rdr.Read(wkt); Console.WriteLine("Input Geometry: " + g1); Console.WriteLine("Indices to extract: " + start + " " + end); LengthIndexedLine indexedLine = new LengthIndexedLine(g1); IGeometry subLine = indexedLine.ExtractLine(start, end); Console.WriteLine("Extracted Line: " + subLine); double[] index = indexedLine.IndicesOf(subLine); Console.WriteLine("Indices of extracted line: " + index[0] + " " + index[1]); Coordinate midpt = indexedLine.ExtractPoint((index[0] + index[1]) / 2); Console.WriteLine("Midpoint of extracted line: " + midpt); }
public static IGeometry ExtractLine(IGeometry g, double start, double end) { var ll = new LengthIndexedLine(g); return ll.ExtractLine(start, end); }
protected override IGeometry IndicesOfThenExtract(IGeometry linearGeom, IGeometry subLine) { LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom); double[] loc = indexedLine.IndicesOf(subLine); IGeometry result = indexedLine.ExtractLine(loc[0], loc[1]); return result; }
private void CheckExtractLine(String wkt, double start, double end, String expected) { IGeometry linearGeom = Read(wkt); LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom); IGeometry result = indexedLine.ExtractLine(start, end); CheckExpected(result, expected); }