public virtual void TestReversepath() { com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon(); poly.StartPath(10, 1); poly.LineTo(15, 20); poly.LineTo(30, 14); poly.LineTo(60, 144); poly.StartPath(10, 1); poly.LineTo(15, 20); poly.LineTo(300, 14); poly.LineTo(60, 144); poly.StartPath(10, 1); poly.LineTo(125, 20); poly.LineTo(30, 14); poly.LineTo(600, 144); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 0, 0, // 2); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 1, 0, // 3); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 2, 0, // 5); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 3, 0, // 7); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 4, 0, // 11); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 5, 0, // 13); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 6, 0, // 17); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 7, 0, // 19); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 8, 0, // 23); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 9, 0, // 29); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 10, // 0, 31); // poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 11, // 0, 37); poly.ReversePath(1); NUnit.Framework.Assert.IsTrue(poly.GetPathCount() == 3); NUnit.Framework.Assert.IsTrue(poly.GetPathStart(1) == 4); NUnit.Framework.Assert.IsTrue(poly.IsClosedPath(0)); NUnit.Framework.Assert.IsTrue(poly.IsClosedPath(1)); com.esri.core.geometry.Point ptOut = poly.GetPoint(4); NUnit.Framework.Assert.IsTrue(ptOut.GetX() == 10 && ptOut.GetY() == 1); }
public static void TestStar() { com.esri.core.geometry.OperatorConvexHull bounding = (com.esri.core.geometry.OperatorConvexHull)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ConvexHull); com.esri.core.geometry.OperatorDensifyByLength densify = (com.esri.core.geometry.OperatorDensifyByLength)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.DensifyByLength); com.esri.core.geometry.Polygon star = new com.esri.core.geometry.Polygon(); star.StartPath(0, 0); star.LineTo(0, 0); star.LineTo(5, 10); star.LineTo(5, 10); star.LineTo(10, 0); star.LineTo(10, 0); star.StartPath(0, 5); star.LineTo(0, 5); star.LineTo(10, 5); star.LineTo(10, 5); star.LineTo(5, -5); star.LineTo(5, -5); star.ReversePath(1); com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(star, 1.0, null)); com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)(bounding.Execute(densified, null)); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); com.esri.core.geometry.Point2D p1 = convex_hull.GetXY(0); com.esri.core.geometry.Point2D p2 = convex_hull.GetXY(1); com.esri.core.geometry.Point2D p3 = convex_hull.GetXY(2); com.esri.core.geometry.Point2D p4 = convex_hull.GetXY(3); com.esri.core.geometry.Point2D p5 = convex_hull.GetXY(4); com.esri.core.geometry.Point2D p6 = convex_hull.GetXY(5); NUnit.Framework.Assert.IsTrue(p1.x == 0.0 && p1.y == 0.0); NUnit.Framework.Assert.IsTrue(p2.x == 0.0 && p2.y == 5.0); NUnit.Framework.Assert.IsTrue(p3.x == 5.0 && p3.y == 10.0); NUnit.Framework.Assert.IsTrue(p4.x == 10.0 && p4.y == 5.0); NUnit.Framework.Assert.IsTrue(p5.x == 10.0 && p5.y == 0.0); NUnit.Framework.Assert.IsTrue(p6.x == 5.0 && p6.y == -5.0); }