コード例 #1
0
 public static IGeometry Project(IGeometry g, IGeometry g2)
 {
     var ll = new LengthIndexedLine(g);
     var index = ll.Project(g2.Coordinate);
     var p = ll.ExtractPoint(index);
     return g.Factory.CreatePoint(p);
 }
コード例 #2
0
 public static double ProjectIndex(IGeometry g, IGeometry g2)
 {
     var ll = new LengthIndexedLine(g);
     return ll.Project(g2.Coordinate);
 }
コード例 #3
0
 public void TestProjectExtractPoint()
 {
     IGeometry linearGeom = Read("MULTILINESTRING ((0 2, 0 0), (-1 1, 1 1))");
     LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
     var index = indexedLine.Project(new Coordinate(1, 0));
     Coordinate pt = indexedLine.ExtractPoint(index);
     Assert.IsTrue(pt.Equals(new Coordinate(0, 0)));
 }
コード例 #4
0
 public void TestComputeZNaN()
 {
     IGeometry linearGeom = Read("LINESTRING (0 0, 10 10 10)");
     LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
     double projIndex = indexedLine.Project(new Coordinate(5, 5));
     Coordinate projPt = indexedLine.ExtractPoint(projIndex);
     Assert.IsTrue(Double.IsNaN(projPt.Z));
 }
コード例 #5
0
 public void TestComputeZ()
 {
     IGeometry linearGeom = Read("LINESTRING (0 0 0, 10 10 10)");
     LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
     double projIndex = indexedLine.Project(new Coordinate(5, 5));
     Coordinate projPt = indexedLine.ExtractPoint(projIndex);
     //    System.out.println(projPt);
     Assert.IsTrue(projPt.Equals3D(new Coordinate(5, 5, 5)));
 }
コード例 #6
0
 public void TestProjectPointWithDuplicateCoords()
 {
     IGeometry linearGeom = Read("LINESTRING (0 0, 10 0, 10 0, 20 0)");
     LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
     double projIndex = indexedLine.Project(new Coordinate(10, 1));
     Assert.IsTrue(projIndex == 10.0);
 }