public virtual void TestLine() { com.esri.core.geometry.Line env = new com.esri.core.geometry.Line(); env.SetStartXY(100, 200); env.SetEndXY(250, 300); NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); env.SetStartAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1); env.SetEndAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 2); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0) == 1); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0) == 2); NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z); NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); env.SetStartAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 3); env.SetEndAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 4); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 3); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 4); NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID)); env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID); NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID)); env.SetStartAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 5); env.SetEndAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 6); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0) == 5); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0) == 6); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0) == 1); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0) == 2); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 3); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 4); env.DropAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0) == 5); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0) == 6); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 3); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 4); com.esri.core.geometry.Line env1 = new com.esri.core.geometry.Line(); env.CopyTo(env1); NUnit.Framework.Assert.IsFalse(env1.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0) == 5); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0) == 6); NUnit.Framework.Assert.IsTrue(env.GetStartAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 3); NUnit.Framework.Assert.IsTrue(env.GetEndAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0) == 4); }
public static void TestMergeCursor() { 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.Polygon geom1 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Polygon geom2 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Point geom3 = new com.esri.core.geometry.Point(); com.esri.core.geometry.Line geom4 = new com.esri.core.geometry.Line(); com.esri.core.geometry.Envelope geom5 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.MultiPoint geom6 = new com.esri.core.geometry.MultiPoint(); // polygon geom1.StartPath(0, 0); geom1.LineTo(0, 0); geom1.LineTo(5, 11); geom1.LineTo(5, 11); geom1.LineTo(10, 0); geom1.LineTo(10, 0); // polygon geom2.StartPath(0, 5); geom2.LineTo(0, 5); geom2.LineTo(10, 5); geom2.LineTo(10, 5); geom2.LineTo(5, -5); geom2.LineTo(5, -5); // point geom3.SetXY(15, 1.25); // segment geom4.SetEndXY(-5, 1.25); geom4.SetStartXY(0, 0); // envelope geom5.SetCoords(0, 0, 5, 10); // multi_point geom6.Add(10, 5); geom6.Add(10, 10); // create cursor com.esri.core.geometry.Geometry[] geoms = new com.esri.core.geometry.Geometry[6]; geoms[0] = geom1; geoms[1] = geom2; geoms[2] = geom3; geoms[3] = geom4; geoms[4] = geom5; geoms[5] = geom6; com.esri.core.geometry.GeometryCursor cursor = new com.esri.core.geometry.SimpleGeometryCursor(geoms); // create convex hull from the cursor with b_merge set to true com.esri.core.geometry.GeometryCursor convex_hull_curs = bounding.Execute(cursor, true, null); com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)(convex_hull_curs.Next()); NUnit.Framework.Assert.IsTrue(convex_hull_curs.Next() == 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 == 5.0 && p1.y == 11.0); NUnit.Framework.Assert.IsTrue(p2.x == 10.0 && p2.y == 10); NUnit.Framework.Assert.IsTrue(p3.x == 15.0 && p3.y == 1.25); NUnit.Framework.Assert.IsTrue(p4.x == 5.0 && p4.y == -5.0); NUnit.Framework.Assert.IsTrue(p5.x == -5.0 && p5.y == 1.25); NUnit.Framework.Assert.IsTrue(p6.x == 0.0 && p6.y == 10.0); // Test GeometryEngine com.esri.core.geometry.Geometry[] merged_hull = com.esri.core.geometry.GeometryEngine.ConvexHull(geoms, true); convex_hull = (com.esri.core.geometry.Polygon)merged_hull[0]; p1 = convex_hull.GetXY(0); p2 = convex_hull.GetXY(1); p3 = convex_hull.GetXY(2); p4 = convex_hull.GetXY(3); p5 = convex_hull.GetXY(4); p6 = convex_hull.GetXY(5); NUnit.Framework.Assert.IsTrue(p1.x == 5.0 && p1.y == 11.0); NUnit.Framework.Assert.IsTrue(p2.x == 10.0 && p2.y == 10); NUnit.Framework.Assert.IsTrue(p3.x == 15.0 && p3.y == 1.25); NUnit.Framework.Assert.IsTrue(p4.x == 5.0 && p4.y == -5.0); NUnit.Framework.Assert.IsTrue(p5.x == -5.0 && p5.y == 1.25); NUnit.Framework.Assert.IsTrue(p6.x == 0.0 && p6.y == 10.0); }
public virtual void TestHullTickTock() { com.esri.core.geometry.Polygon geom1 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Polygon geom2 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Point geom3 = new com.esri.core.geometry.Point(); com.esri.core.geometry.Line geom4 = new com.esri.core.geometry.Line(); com.esri.core.geometry.Envelope geom5 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.MultiPoint geom6 = new com.esri.core.geometry.MultiPoint(); // polygon geom1.StartPath(0, 0); geom1.LineTo(0, 0); geom1.LineTo(5, 11); geom1.LineTo(5, 11); geom1.LineTo(10, 0); geom1.LineTo(10, 0); // polygon geom2.StartPath(0, 5); geom2.LineTo(0, 5); geom2.LineTo(10, 5); geom2.LineTo(10, 5); geom2.LineTo(5, -5); geom2.LineTo(5, -5); // point geom3.SetXY(15, 1.25); // segment geom4.SetEndXY(-5, 1.25); geom4.SetStartXY(0, 0); // envelope geom5.SetCoords(0, 0, 5, 10); // multi_point geom6.Add(10, 5); geom6.Add(10, 10); // Create com.esri.core.geometry.ListeningGeometryCursor gc = new com.esri.core.geometry.ListeningGeometryCursor(); com.esri.core.geometry.GeometryCursor ticktock = com.esri.core.geometry.OperatorConvexHull.Local().Execute(gc, true, null); // Use tick-tock to push a geometry and do a piece of work. gc.Tick(geom1); ticktock.Tock(); gc.Tick(geom2); ticktock.Tock(); gc.Tick(geom3); // skiped one tock just for testing. ticktock.Tock(); gc.Tick(geom4); ticktock.Tock(); gc.Tick(geom5); ticktock.Tock(); gc.Tick(geom6); ticktock.Tock(); // Get the result com.esri.core.geometry.Geometry result = ticktock.Next(); com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)result; NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.OperatorConvexHull.Local().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 == 5.0 && p1.y == 11.0); NUnit.Framework.Assert.IsTrue(p2.x == 10.0 && p2.y == 10); NUnit.Framework.Assert.IsTrue(p3.x == 15.0 && p3.y == 1.25); NUnit.Framework.Assert.IsTrue(p4.x == 5.0 && p4.y == -5.0); NUnit.Framework.Assert.IsTrue(p5.x == -5.0 && p5.y == 1.25); NUnit.Framework.Assert.IsTrue(p6.x == 0.0 && p6.y == 10.0); }
public static void TestDegenerate() { 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 polygon = new com.esri.core.geometry.Polygon(); polygon.StartPath(0, 0); polygon.LineTo(1, 0); polygon.LineTo(0, 0); polygon.LineTo(2, 0); polygon.LineTo(1, 0); polygon.LineTo(3, 0); polygon.StartPath(0, 0); polygon.LineTo(1, 0); polygon.LineTo(0, 0); polygon.LineTo(2, 0); polygon.LineTo(1, 0); polygon.LineTo(3, 0); com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, .5, 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)); NUnit.Framework.Assert.IsTrue(convex_hull.CalculateArea2D() == 0.0); com.esri.core.geometry.Point2D p1 = convex_hull.GetXY(0); com.esri.core.geometry.Point2D p2 = convex_hull.GetXY(1); NUnit.Framework.Assert.IsTrue(p1.x == 0.0 && p1.y == 0.0); NUnit.Framework.Assert.IsTrue(p2.x == 3.0 && p2.y == 0.0); } { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.StartPath(0, 0); polygon.LineTo(0, 0); polygon.LineTo(0, 0); polygon.LineTo(com.esri.core.geometry.NumberUtils.DoubleEps(), 0); polygon.LineTo(0, com.esri.core.geometry.NumberUtils.DoubleEps()); polygon.LineTo(10, 0); polygon.LineTo(10, 0); polygon.LineTo(10, 5); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(10, 0); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(0, 10); polygon.LineTo(0, 0); polygon.StartPath(0, 0); polygon.LineTo(0, 0); polygon.LineTo(0, 0); polygon.LineTo(10, 0); polygon.LineTo(10, 0); polygon.LineTo(10, 5); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(10, 0); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(0, 10); polygon.LineTo(0, 0); polygon.StartPath(0, 0); polygon.LineTo(0, 0); polygon.LineTo(0, 0); polygon.LineTo(10, 0); polygon.LineTo(5, 0); polygon.LineTo(10, 0); polygon.LineTo(10, 5); polygon.LineTo(10, 0); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(0, 10); polygon.LineTo(5, 10); polygon.LineTo(0, 0); com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1, null)); com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)(bounding.Execute(densified, null)); double area = convex_hull.CalculateArea2D(); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(area == 100.0); 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); NUnit.Framework.Assert.IsTrue(p1.x == 0.0 && p1.y == 0.0); NUnit.Framework.Assert.IsTrue(p2.x == 0.0 && p2.y == 10.0); NUnit.Framework.Assert.IsTrue(p3.x == 10.0 && p3.y == 10.0); NUnit.Framework.Assert.IsTrue(p4.x == 10.0 && p4.y == 0.0); } { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.StartPath(0, 0); polygon.LineTo(0, 10); polygon.LineTo(5, 10); polygon.LineTo(5, 5); polygon.LineTo(5, 8); polygon.LineTo(10, 10); polygon.LineTo(10, 0); com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1, null)); com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)(bounding.Execute(densified, null)); double area = convex_hull.CalculateArea2D(); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(area == 100.0); 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); NUnit.Framework.Assert.IsTrue(p1.x == 0.0 && p1.y == 0.0); NUnit.Framework.Assert.IsTrue(p2.x == 0.0 && p2.y == 10.0); NUnit.Framework.Assert.IsTrue(p3.x == 10.0 && p3.y == 10.0); NUnit.Framework.Assert.IsTrue(p4.x == 10.0 && p4.y == 0.0); } { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.StartPath(0, 0); polygon.LineTo(0, 0); polygon.LineTo(0, 0); polygon.LineTo(10, 0); polygon.LineTo(5, 0); polygon.LineTo(10, 0); polygon.LineTo(10, 5); polygon.LineTo(10, 0); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(10, 10); polygon.LineTo(5, 10); polygon.LineTo(0, 10); polygon.LineTo(5, 10); polygon.LineTo(0, 0); com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1, null)); com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)(bounding.Execute(densified, null)); double area = convex_hull.CalculateArea2D(); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(area == 100.0); 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); NUnit.Framework.Assert.IsTrue(p1.x == 0.0 && p1.y == 0.0); NUnit.Framework.Assert.IsTrue(p2.x == 0.0 && p2.y == 10.0); NUnit.Framework.Assert.IsTrue(p3.x == 10.0 && p3.y == 10.0); NUnit.Framework.Assert.IsTrue(p4.x == 10.0 && p4.y == 0.0); } { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.StartPath(0, 0); polygon.LineTo(0, 0); polygon.LineTo(0, 10); polygon.LineTo(0, 0); polygon.LineTo(10, 10); polygon.LineTo(0, 0); polygon.LineTo(10, 0); polygon.LineTo(0, 0); polygon.StartPath(0, 10); polygon.LineTo(0, 10); polygon.LineTo(10, 10); polygon.LineTo(0, 10); polygon.LineTo(10, 0); polygon.LineTo(0, 10); polygon.LineTo(0, 0); polygon.LineTo(0, 10); polygon.StartPath(10, 10); polygon.LineTo(10, 10); polygon.LineTo(10, 0); polygon.LineTo(10, 10); polygon.LineTo(0, 0); polygon.LineTo(10, 10); polygon.LineTo(0, 10); polygon.LineTo(10, 10); polygon.StartPath(10, 0); polygon.LineTo(10, 0); polygon.LineTo(0, 0); polygon.LineTo(10, 0); polygon.LineTo(0, 10); polygon.LineTo(10, 0); polygon.LineTo(10, 10); polygon.LineTo(10, 0); com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1, 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); NUnit.Framework.Assert.IsTrue(p1.x == 0.0 && p1.y == 0.0); NUnit.Framework.Assert.IsTrue(p2.x == 0.0 && p2.y == 10.0); NUnit.Framework.Assert.IsTrue(p3.x == 10.0 && p3.y == 10.0); NUnit.Framework.Assert.IsTrue(p4.x == 10.0 && p4.y == 0.0); } { com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(); mpoint.Add(4, 4); mpoint.Add(4, 4); mpoint.Add(4, 4); mpoint.Add(4, 4); com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)(bounding.Execute(mpoint, null)); NUnit.Framework.Assert.IsTrue(convex_hull.GetPointCount() == 2); NUnit.Framework.Assert.IsTrue(convex_hull.CalculateArea2D() == 0.0); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); } { com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(); mpoint.Add(4, 4); com.esri.core.geometry.MultiPoint convex_hull = (com.esri.core.geometry.MultiPoint)(bounding.Execute(mpoint, null)); NUnit.Framework.Assert.IsTrue(convex_hull.GetPointCount() == 1); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(convex_hull == mpoint); } { com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(); mpoint.Add(4, 4); mpoint.Add(4, 5); com.esri.core.geometry.Polyline convex_hull = (com.esri.core.geometry.Polyline)(bounding.Execute(mpoint, null)); NUnit.Framework.Assert.IsTrue(convex_hull.GetPointCount() == 2); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(convex_hull.CalculateLength2D() == 1.0); } { com.esri.core.geometry.Line line = new com.esri.core.geometry.Line(); line.SetStartXY(0, 0); line.SetEndXY(0, 1); com.esri.core.geometry.Polyline convex_hull = (com.esri.core.geometry.Polyline)(bounding.Execute(line, null)); NUnit.Framework.Assert.IsTrue(convex_hull.GetPointCount() == 2); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(convex_hull.CalculateLength2D() == 1.0); } { com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline(); polyline.StartPath(0, 0); polyline.LineTo(0, 1); com.esri.core.geometry.Polyline convex_hull = (com.esri.core.geometry.Polyline)(bounding.Execute(polyline, null)); NUnit.Framework.Assert.IsTrue(convex_hull.GetPointCount() == 2); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(polyline == convex_hull); NUnit.Framework.Assert.IsTrue(convex_hull.CalculateLength2D() == 1.0); } { com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(0, 0, 10, 10); com.esri.core.geometry.Envelope convex_hull = (com.esri.core.geometry.Envelope)(bounding.Execute(env, null)); NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null)); NUnit.Framework.Assert.IsTrue(env == convex_hull); } }