public static void Test5() { com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon(); poly.StartPath(0, 0); poly.LineTo(0, 1); poly.LineTo(1, 1); poly.LineTo(1, 0); poly.StartPath(2, 0); poly.LineTo(2, 1); poly.LineTo(3, 1); poly.LineTo(3, 0); poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 1); poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0, 3); poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 6, 0, 1); poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0, 4); poly.InterpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 3, 1); poly.InterpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 3); poly.InterpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 2, 1); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 2); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 1); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 2); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0) == 4); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 6, 0) == 1); NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 7, 0) == 2); }
public virtual void TestPolygon() { com.esri.core.geometry.Polygon mp = new com.esri.core.geometry.Polygon(); mp.StartPath(new com.esri.core.geometry.Point(100, 200)); mp.LineTo(new com.esri.core.geometry.Point(101, 201)); mp.LineTo(new com.esri.core.geometry.Point(102, 202)); NUnit.Framework.Assert.IsFalse(mp.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); mp.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); NUnit.Framework.Assert.IsTrue(mp.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsTrue(double.IsNaN(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0))); NUnit.Framework.Assert.IsTrue(double.IsNaN(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0))); NUnit.Framework.Assert.IsTrue(double.IsNaN(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0))); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 1); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 2); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 3); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 1); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 2); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 3); NUnit.Framework.Assert.IsFalse(mp.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); mp.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z); NUnit.Framework.Assert.IsTrue(mp.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0) == 0); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0) == 0); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0) == 0); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0, 11); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0, 21); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0, 31); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 1); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 2); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 3); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0) == 11); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0) == 21); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0) == 31); NUnit.Framework.Assert.IsFalse(mp.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID)); mp.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID); NUnit.Framework.Assert.IsTrue(mp.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID)); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 0) == 0); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 1, 0) == 0); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 2, 0) == 0); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 0, -11); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID, 1, 0, -21); mp.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID, 2, 0, -31); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 1); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 2); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 3); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0) == 11); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0) == 21); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0) == 31); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 0) == -11); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 1, 0) == -21); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 2, 0) == -31); mp.DropAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); NUnit.Framework.Assert.IsFalse(mp.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0) == 11); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0) == 21); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0) == 31); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 0) == -11); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 1, 0) == -21); NUnit.Framework.Assert.IsTrue(mp.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 2, 0) == -31); com.esri.core.geometry.Polygon mp1 = new com.esri.core.geometry.Polygon(); mp.CopyTo(mp1); NUnit.Framework.Assert.IsFalse(mp1.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0) == 11); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0) == 21); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0) == 31); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 0) == -11); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 1, 0) == -21); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 2, 0) == -31); mp1.DropAllAttributes(); mp1.MergeVertexDescription(mp.GetDescription()); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0) == 0); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0) == 0); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0) == 0); NUnit.Framework.Assert.IsTrue(double.IsNaN(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0))); NUnit.Framework.Assert.IsTrue(double.IsNaN(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0))); NUnit.Framework.Assert.IsTrue(double.IsNaN(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0))); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 0) == 0); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 1, 0) == 0); NUnit.Framework.Assert.IsTrue(mp1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.ID, 2, 0) == 0); }