public static com.epl.geometry.Polyline MakePolylineCutter1() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(1, 0); poly.LineTo(4, 0); poly.StartPath(6, -1); poly.LineTo(6, 1); poly.StartPath(6, 0); poly.LineTo(8, 0); poly.StartPath(9, -1); poly.LineTo(9, 1); poly.StartPath(10, 0); poly.LineTo(12, 0); poly.StartPath(12, 1); poly.LineTo(12, -1); poly.StartPath(12, 0); poly.LineTo(15, 0); poly.StartPath(15, 1); poly.LineTo(15, -1); poly.StartPath(16, 0); poly.LineTo(16, -1); poly.LineTo(17, -1); poly.LineTo(17, 1); poly.LineTo(17, 0); poly.LineTo(18, 0); poly.StartPath(18, 0); poly.LineTo(18, -1); return(poly); }
public static void Test4() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(0, System.Math.Sqrt(0.0)); poly.LineTo(0, System.Math.Sqrt(1.0)); poly.StartPath(0, System.Math.Sqrt(1.0)); poly.LineTo(0, System.Math.Sqrt(2.0)); poly.StartPath(0, System.Math.Sqrt(2.0)); poly.LineTo(0, System.Math.Sqrt(3.0)); poly.StartPath(0, System.Math.Sqrt(3.0)); poly.LineTo(0, System.Math.Sqrt(4.0)); poly.StartPath(0, System.Math.Sqrt(4.0)); poly.LineTo(0, System.Math.Sqrt(5.0)); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 1, 0, System.Math.Sqrt(1.0)); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 8, 0, System.Math.Sqrt(4.0)); poly.InterpolateAttributes(com.epl.geometry.VertexDescription.Semantics.M, 0, 1, 4, 0); NUnit.Framework.Assert.IsTrue(com.epl.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 0, 0))); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 1, 0) == System.Math.Sqrt(1.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 2, 0) == System.Math.Sqrt(1.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 3, 0) == System.Math.Sqrt(2.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 4, 0) == System.Math.Sqrt(2.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 5, 0) == System.Math.Sqrt(3.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 6, 0) == System.Math.Sqrt(3.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 7, 0) == System.Math.Sqrt(4.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 8, 0) == System.Math.Sqrt(4.0)); NUnit.Framework.Assert.IsTrue(com.epl.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 9, 0))); }
public static com.epl.geometry.Polyline MakePolylineCutter2() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(-1.5, 0); poly.LineTo(-.75, 0); poly.StartPath(-.5, 0); poly.LineTo(1, 0); poly.LineTo(1, 2); poly.LineTo(3, -2); poly.LineTo(4, 2); poly.LineTo(5, -2); poly.LineTo(5, 4); poly.LineTo(8, 2); poly.LineTo(6, 0); poly.LineTo(6, 3); poly.StartPath(9, 5); poly.LineTo(9, 2); poly.LineTo(10, 2); poly.LineTo(10, 5); poly.LineTo(10.5, 5); poly.LineTo(10.5, 3); poly.StartPath(11, 4); poly.LineTo(11, 5); poly.StartPath(12, 5); poly.LineTo(12, 4); return(poly); }
public virtual void TestPolyline() { com.epl.geometry.Polyline polyline = new com.epl.geometry.Polyline(); polyline.StartPath(-97.06138, 32.837); polyline.LineTo(-97.06133, 32.836); polyline.LineTo(-97.06124, 32.834); polyline.LineTo(-97.06127, 32.832); polyline.StartPath(-97.06326, 32.759); polyline.LineTo(-97.06298, 32.755); { com.fasterxml.jackson.core.JsonParser polylinePathsWgs84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, polyline)); com.epl.geometry.MapGeometry mPolylineWGS84MP = com.epl.geometry.GeometryEngine.JsonToGeometry(polylinePathsWgs84Parser); NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPointCount()); NUnit.Framework.Assert.IsTrue(polyline.GetPoint(0).GetX() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(0).GetX()); NUnit.Framework.Assert.IsTrue(polyline.GetPoint(0).GetY() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(0).GetY()); NUnit.Framework.Assert.IsTrue(polyline.GetPathCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPathCount()); NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount()); NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount(0) == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount(0)); NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount(1) == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount(1)); int lastIndex = polyline.GetPointCount() - 1; NUnit.Framework.Assert.IsTrue(polyline.GetPoint(lastIndex).GetX() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(lastIndex).GetX()); NUnit.Framework.Assert.IsTrue(polyline.GetPoint(lastIndex).GetY() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(lastIndex).GetY()); NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolylineWGS84MP.GetSpatialReference().GetID()); com.epl.geometry.Polyline emptyPolyline = new com.epl.geometry.Polyline(); string emptyString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, emptyPolyline); mPolylineWGS84MP = com.epl.geometry.GeometryEngine.JsonToGeometry(factory.CreateJsonParser(emptyString)); NUnit.Framework.Assert.IsTrue(mPolylineWGS84MP.GetGeometry().IsEmpty()); NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolylineWGS84MP.GetSpatialReference().GetID()); } }
public virtual void TestPolylineWithTwoPaths() { com.epl.geometry.Polyline p = new com.epl.geometry.Polyline(); p.StartPath(100.0, 0.0); p.LineTo(100.0, 1.0); p.StartPath(100.2, 0.2); p.LineTo(100.8, 0.2); string result = com.epl.geometry.GeometryEngine.GeometryToGeoJson(p); NUnit.Framework.Assert.AreEqual("{\"type\":\"MultiLineString\",\"coordinates\":[[[100,0],[100,1]],[[100.2,0.2],[100.8,0.2]]]}", result); }
public static com.epl.geometry.Polyline MakePolyline() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); // 0 poly.StartPath(0, 40); poly.LineTo(30, 0); // 1 poly.StartPath(20, 70); poly.LineTo(45, 100); // 2 poly.StartPath(50, 100); poly.LineTo(50, 60); // 3 poly.StartPath(35, 25); poly.LineTo(65, 45); // 4 poly.StartPath(60, 10); poly.LineTo(65, 35); // 5 poly.StartPath(60, 60); poly.LineTo(100, 60); // 6 poly.StartPath(80, 10); poly.LineTo(80, 99); // 7 poly.StartPath(60, 60); poly.LineTo(65, 35); return(poly); }
public static void Test3() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(0, System.Math.Sqrt(0.0)); poly.LineTo(0, System.Math.Sqrt(5.0)); poly.StartPath(0, System.Math.Sqrt(8.0)); poly.LineTo(0, System.Math.Sqrt(10.0)); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 0, 0, System.Math.Sqrt(3.0)); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 2, 0, System.Math.Sqrt(5.0)); poly.InterpolateAttributes(com.epl.geometry.VertexDescription.Semantics.M, 0, 0, 1, 0); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 0, 0) == System.Math.Sqrt(3.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 1, 0) == System.Math.Sqrt(5.0)); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 2, 0) == System.Math.Sqrt(5.0)); }
public static com.epl.geometry.Polyline MakePolyline1() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(0, 0); poly.LineTo(15, 15); return(poly); }
public virtual void TestTouchesOnPolylineAndPolygon() { com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(4326); com.epl.geometry.Polygon basePl = new com.epl.geometry.Polygon(); basePl.StartPath(new com.epl.geometry.Point(-117, 20)); basePl.LineTo(new com.epl.geometry.Point(-100, 20)); basePl.LineTo(new com.epl.geometry.Point(-100, 10)); basePl.LineTo(new com.epl.geometry.Point(-117, 10)); com.epl.geometry.Polyline compPl = new com.epl.geometry.Polyline(); compPl.StartPath(new com.epl.geometry.Point(-117, 20)); compPl.LineTo(new com.epl.geometry.Point(-108, 25)); compPl.LineTo(new com.epl.geometry.Point(-100, 20)); compPl.LineTo(new com.epl.geometry.Point(-100, 30)); bool isTouched; try { isTouched = com.epl.geometry.GeometryEngine.Touches(basePl, compPl, sr); } catch (System.ArgumentException) { isTouched = false; } NUnit.Framework.Assert.AreEqual(isTouched, true); }
public virtual void TestEqualsOnPolylines() { com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(4326); com.epl.geometry.Polyline baseMp = new com.epl.geometry.Polyline(); com.epl.geometry.Polyline compMp = new com.epl.geometry.Polyline(); baseMp.StartPath(-116, 40); baseMp.LineTo(-120, 39); baseMp.LineTo(-121, 10); baseMp.LineTo(-130, 12); baseMp.LineTo(-108, 25); compMp.StartPath(-116, 40); compMp.LineTo(-120, 39); compMp.LineTo(-121, 10); compMp.LineTo(-130, 12); compMp.LineTo(-108, 25); bool isEqual; try { isEqual = com.epl.geometry.GeometryEngine.Equals(baseMp, compMp, sr); } catch (System.ArgumentException) { isEqual = false; } NUnit.Framework.Assert.IsTrue(isEqual); }
public virtual void TestPointAndPolyline1() { com.epl.geometry.Point basePl = new com.epl.geometry.Point(-116, 20); com.epl.geometry.Polyline compPl = new com.epl.geometry.Polyline(); compPl.StartPath(new com.epl.geometry.Point(-116, 20)); compPl.LineTo(new com.epl.geometry.Point(-131, 10)); compPl.LineTo(new com.epl.geometry.Point(-121, 50)); int noException = 1; // no exception com.epl.geometry.Geometry intersectGeom = null; try { intersectGeom = com.epl.geometry.GeometryEngine.Intersect(basePl, compPl, com.epl.geometry.SpatialReference.Create(4326)); } catch (System.Exception) { noException = 0; } NUnit.Framework.Assert.AreEqual(noException, 1); NUnit.Framework.Assert.IsNotNull(intersectGeom); NUnit.Framework.Assert.IsTrue(intersectGeom.GetType() == com.epl.geometry.Geometry.Type.Point); com.epl.geometry.Point ip = (com.epl.geometry.Point)intersectGeom; NUnit.Framework.Assert.AreEqual(ip.GetX(), -116, 0.1E7); NUnit.Framework.Assert.AreEqual(ip.GetY(), 20, 0.1E7); }
public static com.epl.geometry.Polyline MakePolygonCutter9() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(5, -1); poly.LineTo(5, 51); return(poly); }
public virtual void TestIntersectBetweenPolylineAndPolygon() { com.epl.geometry.Polyline basePl = new com.epl.geometry.Polyline(); basePl.StartPath(new com.epl.geometry.Point(-117, 20)); basePl.LineTo(new com.epl.geometry.Point(-117, 10)); basePl.LineTo(new com.epl.geometry.Point(-130, 10)); basePl.LineTo(new com.epl.geometry.Point(-130, 20)); basePl.LineTo(new com.epl.geometry.Point(-117, 20)); com.epl.geometry.Polygon compPl = new com.epl.geometry.Polygon(); compPl.StartPath(-116, 20); compPl.LineTo(-131, 10); compPl.LineTo(-121, 50); com.epl.geometry.Geometry intersectGeom = null; int noException = 1; // no exception try { intersectGeom = com.epl.geometry.GeometryEngine.Intersect(basePl, compPl, com.epl.geometry.SpatialReference.Create(4326)); } catch (System.Exception) { noException = 0; } NUnit.Framework.Assert.IsNotNull(intersectGeom); }
public static void Test2() { com.epl.geometry.OperatorFactoryLocal engine = com.epl.geometry.OperatorFactoryLocal.GetInstance(); com.epl.geometry.OperatorGeneralize op = (com.epl.geometry.OperatorGeneralize)engine.GetOperator(com.epl.geometry.Operator.Type.Generalize); com.epl.geometry.Polyline polyline = new com.epl.geometry.Polyline(); polyline.StartPath(0, 0); polyline.LineTo(1, 1); polyline.LineTo(2, 0); polyline.LineTo(3, 2); polyline.LineTo(4, 1); polyline.LineTo(5, 0); polyline.LineTo(5, 10); polyline.LineTo(0, 10); com.epl.geometry.Geometry geom = op.Execute(polyline, 2, true, null); com.epl.geometry.Polyline p = (com.epl.geometry.Polyline)geom; com.epl.geometry.Point2D[] points = p.GetCoordinates2D(); NUnit.Framework.Assert.IsTrue(points.Length == 4); NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0); NUnit.Framework.Assert.IsTrue(points[1].x == 5 && points[1].y == 0); NUnit.Framework.Assert.IsTrue(points[2].x == 5 && points[2].y == 10); NUnit.Framework.Assert.IsTrue(points[3].x == 0 && points[3].y == 10); com.epl.geometry.Geometry geom1 = op.Execute(geom, 5, false, null); p = (com.epl.geometry.Polyline)geom1; points = p.GetCoordinates2D(); NUnit.Framework.Assert.IsTrue(points.Length == 2); NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0); NUnit.Framework.Assert.IsTrue(points[1].x == 0 && points[1].y == 10); geom1 = op.Execute(geom, 5, true, null); p = (com.epl.geometry.Polyline)geom1; points = p.GetCoordinates2D(); NUnit.Framework.Assert.IsTrue(points.Length == 2); NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0); NUnit.Framework.Assert.IsTrue(points[1].x == 0 && points[1].y == 10); }
public virtual void TestTouchPointLineCR183227() { // Tests CR 183227 com.epl.geometry.Geometry baseGeom = new com.epl.geometry.Point(-130, 10); com.epl.geometry.Polyline pl = new com.epl.geometry.Polyline(); // pl.startPath(new Point(-130, 10)); pl.StartPath(-130, 10); pl.LineTo(-131, 15); pl.LineTo(-140, 20); com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(4326); bool isTouched; bool isTouched2; isTouched = com.epl.geometry.GeometryEngine.Touches(baseGeom, pl, sr); isTouched2 = com.epl.geometry.GeometryEngine.Touches(pl, baseGeom, sr); NUnit.Framework.Assert.IsTrue(isTouched && isTouched2); { com.epl.geometry.Geometry baseGeom2 = (com.epl.geometry.Geometry) new com.epl.geometry.Point(-131, 15); bool bIsTouched; bool bIsTouched2; bIsTouched = com.epl.geometry.GeometryEngine.Touches(baseGeom2, pl, sr); bIsTouched2 = com.epl.geometry.GeometryEngine.Touches(pl, baseGeom2, sr); NUnit.Framework.Assert.IsTrue(!bIsTouched && !bIsTouched2); } }
internal static com.epl.geometry.Polyline MakePolyline() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(0, 0); poly.LineTo(10, 10); poly.LineTo(20, 0); return(poly); }
public virtual void TestSerializePolyline() { try { java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream(); java.io.ObjectOutputStream oo = new java.io.ObjectOutputStream(streamOut); com.epl.geometry.Polyline pt = new com.epl.geometry.Polyline(); pt.StartPath(10, 10); pt.LineTo(100, 100); pt.LineTo(200, 100); oo.WriteObject(pt); System.IO.BinaryWriter streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray()); java.io.ObjectInputStream ii = new java.io.ObjectInputStream(streamIn); com.epl.geometry.Polyline ptRes = (com.epl.geometry.Polyline)ii.ReadObject(); NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt)); } catch (System.Exception) { Fail("Polyline serialization failure"); } //try //{ //FileOutputStream streamOut = new FileOutputStream("c:/temp/savedPolyline1.txt"); //ObjectOutputStream oo = new ObjectOutputStream(streamOut); //Polyline pt = new Polyline(); //pt.startPath(10, 10); //pt.lineTo(100, 100); //pt.lineTo(200, 100); //oo.writeObject(pt); //} //catch(Exception ex) //{ //fail("Polyline serialization failure"); //} try { java.io.InputStream s = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPolyline.txt"); java.io.ObjectInputStream ii = new java.io.ObjectInputStream(s); com.epl.geometry.Polyline ptRes = (com.epl.geometry.Polyline)ii.ReadObject(); NUnit.Framework.Assert.IsTrue(ptRes != null); } catch (System.Exception) { Fail("Polyline serialization failure"); } try { java.io.InputStream s = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPolyline1.txt"); java.io.ObjectInputStream ii = new java.io.ObjectInputStream(s); com.epl.geometry.Polyline ptRes = (com.epl.geometry.Polyline)ii.ReadObject(); NUnit.Framework.Assert.IsTrue(ptRes != null); } catch (System.Exception) { Fail("Polyline serialization failure"); } }
public static com.epl.geometry.Polyline MakePolygonCutter8() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(10, 10); poly.LineTo(10, 20); poly.LineTo(20, 20); poly.LineTo(20, 10); poly.LineTo(10, 10); return(poly); }
public static void TestCR254240() { com.epl.geometry.OperatorProximity2D proximityOp = com.epl.geometry.OperatorProximity2D.Local(); com.epl.geometry.Point inputPoint = new com.epl.geometry.Point(-12, 12); com.epl.geometry.Polyline line = new com.epl.geometry.Polyline(); line.StartPath(-10, 0); line.LineTo(0, 0); com.epl.geometry.Proximity2DResult result = proximityOp.GetNearestCoordinate(line, inputPoint, false, true); NUnit.Framework.Assert.IsTrue(result.IsRightSide() == false); }
public static com.epl.geometry.Polyline MakePolygonCutter5() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(15, 0); poly.LineTo(0, 15); poly.LineTo(15, 30); poly.LineTo(30, 15); poly.LineTo(15, 0); return(poly); }
public static void Test1() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(0, 0); poly.LineTo(0, 1.0 / 3.0); poly.LineTo(0, 2.0 / 3.0); poly.LineTo(0, 4.0 / 3.0); poly.LineTo(0, System.Math.Sqrt(6.0)); poly.LineTo(0, System.Math.Sqrt(7.0)); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 0, 0, 3); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 1, 0, 5); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 2, 0, 7); poly.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 5, 0, 11); poly.InterpolateAttributes(com.epl.geometry.VertexDescription.Semantics.M, 0, 1, 0, 1); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 0, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 1, 0) == 5); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 2, 0) == 7); NUnit.Framework.Assert.IsTrue(com.epl.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 3, 0))); NUnit.Framework.Assert.IsTrue(com.epl.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 4, 0))); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 5, 0) == 11); poly.InterpolateAttributes(com.epl.geometry.VertexDescription.Semantics.M, 0, 1, 0, 2); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 0, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 1, 0) == 5); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 2, 0) == 7); NUnit.Framework.Assert.IsTrue(com.epl.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 3, 0))); NUnit.Framework.Assert.IsTrue(com.epl.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 4, 0))); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 5, 0) == 11); poly.InterpolateAttributes(com.epl.geometry.VertexDescription.Semantics.M, 0, 2, 0, 5); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 0, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 1, 0) == 5); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 2, 0) == 7); double a3 = poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 3, 0); NUnit.Framework.Assert.IsTrue(a3 > 7 && a3 < 11); double a4 = poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 4, 0); NUnit.Framework.Assert.IsTrue(a4 > a3 && a4 < 11); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.M, 5, 0) == 11); poly.StartPath(0, System.Math.Sqrt(8.0)); poly.LineTo(0, System.Math.Sqrt(10.0)); poly.LineTo(0, System.Math.Sqrt(11.0)); }
// ((MultiPathImpl::SPtr)clippedPolygon._GetImpl()).SaveToTextFileDbg("c:\\temp\\test_ArcObjects_failure_CR196492.txt"); internal static com.epl.geometry.Polyline MakePolylineCR() { com.epl.geometry.Polyline polyline = new com.epl.geometry.Polyline(); polyline.StartPath(-200, -90); polyline.LineTo(-180, -85); polyline.LineTo(-90, -70); polyline.LineTo(0, 0); polyline.LineTo(100, 25); polyline.LineTo(170, 45); polyline.LineTo(225, 65); return(polyline); }
public virtual void TestOGCLineString() { com.epl.geometry.Polyline p = new com.epl.geometry.Polyline(); p.StartPath(100.0, 0.0); p.LineTo(101.0, 0.0); p.LineTo(101.0, 1.0); p.LineTo(100.0, 1.0); com.epl.geometry.ogc.OGCLineString ogcLineString = new com.epl.geometry.ogc.OGCLineString(p, 0, null); string result = ogcLineString.AsGeoJson(); NUnit.Framework.Assert.AreEqual("{\"type\":\"LineString\",\"coordinates\":[[100,0],[101,0],[101,1],[100,1]],\"crs\":null}", result); }
public virtual void TestPolyline() { com.epl.geometry.Polyline p = new com.epl.geometry.Polyline(); p.StartPath(100.0, 0.0); p.LineTo(101.0, 0.0); p.LineTo(101.0, 1.0); p.LineTo(100.0, 1.0); com.epl.geometry.OperatorExportToGeoJson exporter = (com.epl.geometry.OperatorExportToGeoJson)factory.GetOperator(com.epl.geometry.Operator.Type.ExportToGeoJson); string result = exporter.Execute(p); NUnit.Framework.Assert.AreEqual("{\"type\":\"LineString\",\"coordinates\":[[100,0],[101,0],[101,1],[100,1]]}", result); }
public virtual void OffsetPolyline_(double distance, com.epl.geometry.OperatorOffset.JoinType joins) { com.epl.geometry.Polyline polyline = new com.epl.geometry.Polyline(); polyline.StartPath(0, 0); polyline.LineTo(6, 0); polyline.LineTo(6, 1); polyline.LineTo(4, 1); polyline.LineTo(4, 2); polyline.LineTo(10, 2); com.epl.geometry.OperatorOffset offset = (com.epl.geometry.OperatorOffset)com.epl.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.epl.geometry.Operator.Type.Offset); com.epl.geometry.Geometry outputGeom = offset.Execute(polyline, null, distance, joins, 2, 0, null); NUnit.Framework.Assert.IsNotNull(outputGeom); }
public virtual void TestLocalExport() { string s = com.epl.geometry.OperatorExportToJson.Local().Execute(null, new com.epl.geometry.Point(1000000.2, 2000000.3)); //assertTrue(s.contains(".")); //assertFalse(s.contains(",")); com.epl.geometry.Polyline line = new com.epl.geometry.Polyline(); line.StartPath(1.1, 2.2); line.LineTo(2.3, 4.5); string s1 = com.epl.geometry.OperatorExportToJson.Local().Execute(null, line); NUnit.Framework.Assert.IsTrue(s.Contains(".")); }
public static com.epl.geometry.Polyline MakePolyline2() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(-2, 0); poly.LineTo(-1, 0); poly.LineTo(0, 0); poly.LineTo(2, 0); poly.LineTo(4, 2); poly.LineTo(8, 2); poly.LineTo(10, 4); poly.LineTo(12, 4); return(poly); }
public virtual void TestTouchesBetweenMultipartPolylines() { com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(4326); com.epl.geometry.Polyline pl = new com.epl.geometry.Polyline(); pl.StartPath(2, 4); pl.LineTo(1, 10); pl.LineTo(6, 12); pl.StartPath(6, 12); pl.LineTo(12, 12); pl.LineTo(9, 9); com.epl.geometry.Polyline compPl = new com.epl.geometry.Polyline(); compPl.StartPath(2, 4); compPl.LineTo(2, 9); compPl.LineTo(9, 9); compPl.LineTo(9, 4); compPl.StartPath(2, 9); compPl.LineTo(6, 12); compPl.LineTo(9, 10); bool isTouched = com.epl.geometry.GeometryEngine.Touches(pl, compPl, sr); NUnit.Framework.Assert.IsTrue(!isTouched); }
public virtual void TestTouchesBetweenPointAndLine() { com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(4326); com.epl.geometry.Point p = new com.epl.geometry.Point(2, 4); com.epl.geometry.Polyline compPl = new com.epl.geometry.Polyline(); compPl.StartPath(2, 4); compPl.LineTo(9, 4); compPl.LineTo(9, 9); compPl.LineTo(2, 9); compPl.LineTo(2, 4); bool isTouched = com.epl.geometry.GeometryEngine.Touches(p, compPl, sr); NUnit.Framework.Assert.IsTrue(!isTouched); }
public static com.epl.geometry.Polyline MakePolyline1() { com.epl.geometry.Polyline poly = new com.epl.geometry.Polyline(); poly.StartPath(0, 0); poly.LineTo(2, 0); poly.LineTo(4, 0); poly.LineTo(6, 0); poly.LineTo(8, 0); poly.LineTo(10, 0); poly.LineTo(12, 0); poly.LineTo(14, 0); poly.LineTo(16, 0); poly.LineTo(18, 0); poly.LineTo(20, 0); return(poly); }