示例#1
0
        public virtual void testMultiPointAndMultiPoint1()
        {
            com.esri.core.geometry.MultiPoint basePl = new com.esri.core.geometry.MultiPoint(
                );
            basePl.add(new com.esri.core.geometry.Point(-116, 20));
            basePl.add(new com.esri.core.geometry.Point(-117, 20));
            com.esri.core.geometry.MultiPoint compPl = new com.esri.core.geometry.MultiPoint(
                );
            compPl.add(new com.esri.core.geometry.Point(-116, 20));
            compPl.add(new com.esri.core.geometry.Point(-118, 21));
            int noException = 1;

            // no exception
            com.esri.core.geometry.Geometry intersectGeom = null;
            try
            {
                intersectGeom = com.esri.core.geometry.GeometryEngine.intersect(basePl, compPl, com.esri.core.geometry.SpatialReference
                                                                                .create(4326));
            }
            catch (System.Exception)
            {
                noException = 0;
            }
            NUnit.Framework.Assert.AreEqual(noException, 1);
            NUnit.Framework.Assert.IsNotNull(intersectGeom);
            NUnit.Framework.Assert.IsTrue(intersectGeom.getType() == com.esri.core.geometry.Geometry.Type
                                          .MultiPoint);
            com.esri.core.geometry.MultiPoint imp = (com.esri.core.geometry.MultiPoint)intersectGeom;
            NUnit.Framework.Assert.AreEqual(imp.getCoordinates2D().Length, 1);
            NUnit.Framework.Assert.AreEqual(-116, 0.0, imp.getCoordinates2D()[0].x);
            NUnit.Framework.Assert.AreEqual(20, 0.0, imp.getCoordinates2D()[0].y);
        }