Exemple #1
0
 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);
 }