public static void test2() { com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline(); poly.startPath(0, 0); poly.lineTo(0, 1.0 / 3.0); poly.startPath(0, System.Math.sqrt(8.0)); poly.lineTo(0, System.Math.sqrt(10.0)); poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, System.Math .sqrt(3.0)); poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 1, 0); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 1, 0) == System.Math.sqrt(3.0)); NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl (com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0))); poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0, System.Math .sqrt(5.0)); poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 1, 1); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 1, 0) == System.Math.sqrt(3.0)); double a2 = poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 2, 0); NUnit.Framework.Assert.IsTrue(a2 == System.Math.sqrt(3.0)); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 3, 0) == System.Math.sqrt(5.0)); }
public static void test1() { com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline(); poly.startPath(0, 0); poly.lineTo(0, 1.0 / 3.0); poly.lineTo(0, 2.0 / 3.0); poly.lineTo(0, 4.0 / 3.0); poly.lineTo(0, System.Math.sqrt(6.0)); poly.lineTo(0, System.Math.sqrt(7.0)); poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 3); poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 5); poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 7); poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0, 11); poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 0, 1); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 0, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 1, 0) == 5); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 2, 0) == 7); NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl (com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0))); NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl (com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0))); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 5, 0) == 11); poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 0, 2); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 0, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 1, 0) == 5); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 2, 0) == 7); NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl (com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0))); NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl (com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0))); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 5, 0) == 11); poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 2, 0, 5); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 0, 0) == 3); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 1, 0) == 5); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 2, 0) == 7); double a3 = poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 3, 0); NUnit.Framework.Assert.IsTrue(a3 > 7 && a3 < 11); double a4 = poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 4, 0); NUnit.Framework.Assert.IsTrue(a4 > a3 && a4 < 11); NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 5, 0) == 11); poly.startPath(0, System.Math.sqrt(8.0)); poly.lineTo(0, System.Math.sqrt(10.0)); poly.lineTo(0, System.Math.sqrt(11.0)); }