public virtual void TestCreation2() { com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon(); int state1 = poly.GetStateFlag(); poly.StartPath(10, 1); poly.LineTo(15, 20); poly.LineTo(30, 14); poly.LineTo(60, 144); poly.ClosePathWithLine(); int state2 = poly.GetStateFlag(); NUnit.Framework.Assert.IsTrue(state2 == state1 + 1); // MultiPathImpl::Pointer mpImpl = // (MultiPathImpl::Pointer)poly->_GetImpl(); // // assertTrue(mpImpl.getPointCount() == 4); // assertTrue(mpImpl.getPathCount() == 1); // AttributeStreamBase xy = // mpImpl.getAttributeStreamRef(enum_value2(VertexDescription, // Semantics, POSITION)); // double x, y; // x = xy.readAsDbl(2 * 2); // y = xy.readAsDbl(2 * 2 + 1); // assertTrue(x == 30); assertTrue(y == 14); // // AttributeStreamOfIndexType parts = mpImpl.getPathStreamRef(); // assertTrue(parts.size() == 2); // assertTrue(parts.read(0) == 0); // assertTrue(parts.read(1) == 4); // assertTrue(mpImpl.isClosedPath(0)); // assertTrue(mpImpl.getSegmentFlagsStreamRef() == NULLPTR); // assertTrue(mpImpl.getSegmentIndexStreamRef() == NULLPTR); // assertTrue(mpImpl.getSegmentDataStreamRef() == NULLPTR); poly.StartPath(20, 13); poly.LineTo(150, 120); poly.LineTo(300, 414); poly.LineTo(610, 14); poly.LineTo(6210, 140); poly.ClosePathWithLine(); // assertTrue(mpImpl.getPointCount() == 9); // assertTrue(mpImpl.getPathCount() == 2); // assertTrue(mpImpl.isClosedPath(1)); // xy = mpImpl.getAttributeStreamRef(enum_value2(VertexDescription, // Semantics, POSITION)); // x = xy.readAsDbl(2 * 3); // y = xy.readAsDbl(2 * 3 + 1); // assertTrue(x == 60); assertTrue(y == 144); // // x = xy.readAsDbl(2 * 6); // y = xy.readAsDbl(2 * 6 + 1); // assertTrue(x == 300); assertTrue(y == 414); // parts = mpImpl.getPathStreamRef(); // assertTrue(parts.size() == 3); // assertTrue(parts.read(0) == 0); // assertTrue(parts.read(1) == 4); // assertTrue(parts.read(2) == 9); // assertTrue(mpImpl.getSegmentIndexStreamRef() == NULLPTR); // assertTrue(mpImpl.getSegmentFlagsStreamRef() == NULLPTR); // assertTrue(mpImpl.getSegmentDataStreamRef() == NULLPTR); poly.StartPath(200, 1333); poly.LineTo(1150, 1120); poly.LineTo(300, 4114); poly.LineTo(6110, 114); poly.LineTo(61210, 1140); NUnit.Framework.Assert.IsTrue(poly.IsClosedPath(2) == true); poly.CloseAllPaths(); NUnit.Framework.Assert.IsTrue(poly.IsClosedPath(2) == true); { com.esri.core.geometry.Polygon poly2 = new com.esri.core.geometry.Polygon(); poly2.StartPath(10, 10); poly2.LineTo(100, 10); poly2.LineTo(100, 100); poly2.LineTo(10, 100); } { com.esri.core.geometry.Polygon poly3 = new com.esri.core.geometry.Polygon(); // create a star (non-simple) poly3.StartPath(1, 0); poly3.LineTo(5, 10); poly3.LineTo(9, 0); poly3.LineTo(0, 6); poly3.LineTo(10, 6); } }
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))); }