public virtual void TestInsertPoint() { 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(314, 217); poly.LineTo(60, 144); poly.StartPath(10, 1); poly.LineTo(125, 20); poly.LineTo(30, 14); poly.LineTo(600, 144); com.esri.core.geometry.Point pt = new com.esri.core.geometry.Point(-33, -34); poly.InsertPoint(1, 1, pt); pt = poly.GetPoint(4); NUnit.Framework.Assert.IsTrue(pt.GetX() == 10 && pt.GetY() == 1); pt = poly.GetPoint(5); NUnit.Framework.Assert.IsTrue(pt.GetX() == -33 && pt.GetY() == -34); pt = poly.GetPoint(6); NUnit.Framework.Assert.IsTrue(pt.GetX() == 15 && pt.GetY() == 20); NUnit.Framework.Assert.IsTrue(poly.GetPointCount() == 14); NUnit.Framework.Assert.IsTrue(poly.GetPathSize(1) == 6); NUnit.Framework.Assert.IsTrue(poly.GetPathSize(2) == 4); NUnit.Framework.Assert.IsTrue(poly.GetPathCount() == 3); }
public virtual void TestRemovePoint() { 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(314, 217); poly.LineTo(60, 144); poly.StartPath(10, 1); poly.LineTo(125, 20); poly.LineTo(30, 14); poly.LineTo(600, 144); poly.RemovePoint(1, 1); com.esri.core.geometry.Point pt; pt = poly.GetPoint(4); NUnit.Framework.Assert.IsTrue(pt.GetX() == 10 && pt.GetY() == 1); pt = poly.GetPoint(5); NUnit.Framework.Assert.IsTrue(pt.GetX() == 300 && pt.GetY() == 14); NUnit.Framework.Assert.IsTrue(poly.GetPointCount() == 12); NUnit.Framework.Assert.IsTrue(poly.GetPathSize(0) == 4); NUnit.Framework.Assert.IsTrue(poly.GetPathSize(1) == 4); NUnit.Framework.Assert.IsTrue(poly.GetPathSize(2) == 4); }
public virtual void TestInsertPoints() { { // forward insertion 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(314, 217); poly.LineTo(60, 144); poly.StartPath(10, 1); poly.LineTo(125, 20); poly.LineTo(30, 14); poly.LineTo(600, 144); com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); poly1.StartPath(1, 17); poly1.LineTo(1, 207); poly1.LineTo(3, 147); poly1.LineTo(6, 1447); poly1.StartPath(1000, 17); poly1.LineTo(1250, 207); poly1.LineTo(300, 147); poly1.LineTo(6000, 1447); poly1.InsertPoints(1, 2, poly, 1, 1, 3, true); // forward NUnit.Framework.Assert.IsTrue(poly1.GetPathCount() == 2); NUnit.Framework.Assert.IsTrue(poly1.GetPathStart(1) == 4); NUnit.Framework.Assert.IsTrue(poly1.IsClosedPath(0)); NUnit.Framework.Assert.IsTrue(poly1.IsClosedPath(1)); NUnit.Framework.Assert.IsTrue(poly1.GetPointCount() == 11); NUnit.Framework.Assert.IsTrue(poly1.GetPathSize(1) == 7); } { // Point2D ptOut; // ptOut = poly1.getXY(5); // assertTrue(ptOut.x == 1250 && ptOut.y == 207); // ptOut = poly1.getXY(6); // assertTrue(ptOut.x == 15 && ptOut.y == 20); // ptOut = poly1.getXY(7); // assertTrue(ptOut.x == 300 && ptOut.y == 14); // ptOut = poly1.getXY(8); // assertTrue(ptOut.x == 314 && ptOut.y == 217); // ptOut = poly1.getXY(9); // assertTrue(ptOut.x == 300 && ptOut.y == 147); // ptOut = poly1.getXY(10); // assertTrue(ptOut.x == 6000 && ptOut.y == 1447); // reverse insertion 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(314, 217); poly.LineTo(60, 144); poly.StartPath(10, 1); poly.LineTo(125, 20); poly.LineTo(30, 14); poly.LineTo(600, 144); com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); poly1.StartPath(1, 17); poly1.LineTo(1, 207); poly1.LineTo(3, 147); poly1.LineTo(6, 1447); poly1.StartPath(1000, 17); poly1.LineTo(1250, 207); poly1.LineTo(300, 147); poly1.LineTo(6000, 1447); poly1.InsertPoints(1, 2, poly, 1, 1, 3, false); // reverse NUnit.Framework.Assert.IsTrue(poly1.GetPathCount() == 2); NUnit.Framework.Assert.IsTrue(poly1.GetPathStart(1) == 4); NUnit.Framework.Assert.IsTrue(poly1.IsClosedPath(0)); NUnit.Framework.Assert.IsTrue(poly1.IsClosedPath(1)); NUnit.Framework.Assert.IsTrue(poly1.GetPointCount() == 11); NUnit.Framework.Assert.IsTrue(poly1.GetPathSize(1) == 7); } }