public virtual void TestCloneStuff() { 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.ClosePathWithLine(); com.esri.core.geometry.Polygon clone = (com.esri.core.geometry.Polygon)poly.Copy(); NUnit.Framework.Assert.IsTrue(clone.GetPathCount() == 3); NUnit.Framework.Assert.IsTrue(clone.GetPathStart(2) == 8); NUnit.Framework.Assert.IsTrue(clone.IsClosedPath(0)); NUnit.Framework.Assert.IsTrue(clone.IsClosedPath(1)); NUnit.Framework.Assert.IsTrue(clone.IsClosedPath(2)); NUnit.Framework.Assert.IsTrue(clone.GetXY(5).IsEqual(new com.esri.core.geometry.Point2D(15, 20))); }
public virtual void TestUnionTickTock() { com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); poly1.StartPath(0, 0); poly1.LineTo(0, 10); poly1.LineTo(10, 10); poly1.LineTo(10, 0); com.esri.core.geometry.Polygon poly2 = new com.esri.core.geometry.Polygon(); poly2.StartPath(10.5, 4); poly2.LineTo(10.5, 8); poly2.LineTo(14, 10); com.esri.core.geometry.Transformation2D trans = new com.esri.core.geometry.Transformation2D(); com.esri.core.geometry.Polygon poly3 = (com.esri.core.geometry.Polygon)poly1.Copy(); trans.SetShift(2, 3); poly3.ApplyTransformation(trans); com.esri.core.geometry.Polygon poly4 = (com.esri.core.geometry.Polygon)poly1.Copy(); trans.SetShift(-2, -3); poly4.ApplyTransformation(trans); // Create com.esri.core.geometry.ListeningGeometryCursor gc = new com.esri.core.geometry.ListeningGeometryCursor(); com.esri.core.geometry.GeometryCursor ticktock = com.esri.core.geometry.OperatorUnion.Local().Execute(gc, null, null); // Use tick-tock to push a geometry and do a piece of work. gc.Tick(poly1); ticktock.Tock(); gc.Tick(poly2); gc.Tick(poly3); // skiped one tock just for testing. ticktock.Tock(); gc.Tick(poly4); ticktock.Tock(); // Get the result com.esri.core.geometry.Geometry result = ticktock.Next(); // Use ListeningGeometryCursor to put all geometries in. com.esri.core.geometry.ListeningGeometryCursor gc2 = new com.esri.core.geometry.ListeningGeometryCursor(); gc2.Tick(poly1); gc2.Tick(poly2); gc2.Tick(poly3); gc2.Tick(poly4); com.esri.core.geometry.GeometryCursor res = com.esri.core.geometry.OperatorUnion.Local().Execute(gc2, null, null); // Calling next will process all geometries at once. com.esri.core.geometry.Geometry result2 = res.Next(); NUnit.Framework.Assert.IsTrue(result.Equals(result2)); }