Exemplo n.º 1
0
        public virtual void testMultiPointAndMultiPoint2()
        {
            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(-118, 21));
            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 ip = (com.esri.core.geometry.MultiPoint)intersectGeom;
            NUnit.Framework.Assert.AreEqual(-116, 0.1E7, ip.getPoint(0).getX());
            NUnit.Framework.Assert.AreEqual(20, 0.1E7, ip.getPoint(0).getY());
            NUnit.Framework.Assert.AreEqual(-118, 0.1E7, ip.getPoint(0).getX());
            NUnit.Framework.Assert.AreEqual(21, 0.1E7, ip.getPoint(0).getY());
        }
Exemplo n.º 2
0
 public virtual void testOffsetPoint()
 {
     try
     {
         com.esri.core.geometry.Point point = new com.esri.core.geometry.Point();
         point.setXY(0, 0);
         com.esri.core.geometry.OperatorOffset offset = (com.esri.core.geometry.OperatorOffset
                                                         )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                                .Offset);
         com.esri.core.geometry.Geometry outputGeom = offset.execute(point, null, 2, com.esri.core.geometry.OperatorOffset.JoinType
                                                                     .Round, 2, 0, null);
         NUnit.Framework.Assert.IsNull(outputGeom);
     }
     catch (System.Exception)
     {
     }
     try
     {
         com.esri.core.geometry.MultiPoint mp = new com.esri.core.geometry.MultiPoint();
         mp.add(0, 0);
         mp.add(10, 10);
         com.esri.core.geometry.OperatorOffset offset = (com.esri.core.geometry.OperatorOffset
                                                         )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                                .Offset);
         com.esri.core.geometry.Geometry outputGeom = offset.execute(mp, null, 2, com.esri.core.geometry.OperatorOffset.JoinType
                                                                     .Round, 2, 0, null);
         NUnit.Framework.Assert.IsNull(outputGeom);
     }
     catch (System.Exception)
     {
     }
 }
Exemplo n.º 3
0
        public virtual void testMultiPointAndMultiPoint3()
        {
            com.esri.core.geometry.MultiPoint basePl = new com.esri.core.geometry.MultiPoint(
                );
            basePl.add(new com.esri.core.geometry.Point(-116, 21));
            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(-117, 21));
            compPl.add(new com.esri.core.geometry.Point(-118, 20));
            compPl.add(new com.esri.core.geometry.Point(-119, 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.IsTrue(intersectGeom.isEmpty());
        }
Exemplo n.º 4
0
        public virtual void testEqualsOnMultiPoints()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.MultiPoint baseMp = new com.esri.core.geometry.MultiPoint(
                );
            com.esri.core.geometry.MultiPoint compMp = new com.esri.core.geometry.MultiPoint(
                );
            baseMp.add(new com.esri.core.geometry.Point(-116, 40));
            baseMp.add(new com.esri.core.geometry.Point(-120, 39));
            baseMp.add(new com.esri.core.geometry.Point(-121, 10));
            baseMp.add(new com.esri.core.geometry.Point(-130, 12));
            baseMp.add(new com.esri.core.geometry.Point(-108, 25));
            compMp.add(new com.esri.core.geometry.Point(-116, 40));
            compMp.add(new com.esri.core.geometry.Point(-120, 39));
            compMp.add(new com.esri.core.geometry.Point(-121, 10));
            compMp.add(new com.esri.core.geometry.Point(-130, 12));
            compMp.add(new com.esri.core.geometry.Point(-108, 25));
            bool isEqual;

            try
            {
                isEqual = com.esri.core.geometry.GeometryEngine.equals(baseMp, compMp, sr);
            }
            catch (System.ArgumentException)
            {
                isEqual = false;
            }
            NUnit.Framework.Assert.IsTrue(isEqual);
        }
Exemplo n.º 5
0
 private static com.esri.core.geometry.MultiPoint makeMultiPoint()
 {
     com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
         );
     mpoint.add(0, 30);
     mpoint.add(15, 15);
     mpoint.add(0, 15);
     return(mpoint);
 }
		public virtual void testMultiPointGeometryEngine()
		{
			com.esri.core.geometry.MultiPoint mp = new com.esri.core.geometry.MultiPoint();
			mp.add(10.0, 20.0);
			mp.add(20.0, 30.0);
			string result = com.esri.core.geometry.GeometryEngine.geometryToGeoJson(mp);
			NUnit.Framework.Assert.AreEqual("{\"type\":\"MultiPoint\",\"coordinates\":[[10.0,20.0],[20.0,30.0]]}"
				, result);
		}
		public virtual void testMultiPoint()
		{
			com.esri.core.geometry.MultiPoint mp = new com.esri.core.geometry.MultiPoint();
			mp.add(10.0, 20.0);
			mp.add(20.0, 30.0);
			com.esri.core.geometry.OperatorExportToGeoJson exporter = (com.esri.core.geometry.OperatorExportToGeoJson
				)factory.getOperator(com.esri.core.geometry.Operator.Type.ExportToGeoJson);
			string result = exporter.execute(mp);
			NUnit.Framework.Assert.AreEqual("{\"type\":\"MultiPoint\",\"coordinates\":[[10.0,20.0],[20.0,30.0]]}"
				, result);
		}
		public virtual void testOGCMultiPoint()
		{
			com.esri.core.geometry.MultiPoint mp = new com.esri.core.geometry.MultiPoint();
			mp.add(10.0, 20.0);
			mp.add(20.0, 30.0);
			com.esri.core.geometry.ogc.OGCMultiPoint ogcMultiPoint = new com.esri.core.geometry.ogc.OGCMultiPoint
				(mp, null);
			string result = ogcMultiPoint.asGeoJson();
			NUnit.Framework.Assert.AreEqual("{\"type\":\"MultiPoint\",\"coordinates\":[[10.0,20.0],[20.0,30.0]]}"
				, result);
		}
 public static com.esri.core.geometry.MultiPoint makeMultiPoint3()
 {
     com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
         );
     com.esri.core.geometry.Point2D pt1 = new com.esri.core.geometry.Point2D();
     pt1.x = 1.0;
     pt1.y = 1.0;
     com.esri.core.geometry.Point2D pt2 = new com.esri.core.geometry.Point2D();
     pt2.x = 5.0;
     pt2.y = 5.0;
     mpoint.add(pt1.x, pt1.y);
     mpoint.add(pt2.x, pt2.y);
     return(mpoint);
 }
Exemplo n.º 10
0
 public virtual void testSerializeMultiPoint()
 {
     try
     {
         java.io.ByteArrayOutputStream     streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream        oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.MultiPoint pt        = new com.esri.core.geometry.MultiPoint();
         pt.add(10, 30);
         pt.add(120, 40);
         oo.writeObject(pt);
         java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut
                                                                                  .toByteArray());
         java.io.ObjectInputStream         ii    = new java.io.ObjectInputStream(streamIn);
         com.esri.core.geometry.MultiPoint ptRes = (com.esri.core.geometry.MultiPoint)ii.readObject
                                                       ();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         fail("MultiPoint serialization failure");
     }
     // try
     // {
     // FileOutputStream streamOut = new FileOutputStream(m_thisDirectory +
     // "savedMultiPoint.txt");
     // ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     // MultiPoint pt = new MultiPoint();
     // pt.add(10, 30);
     // pt.add(120, 40);
     // oo.writeObject(pt);
     // }
     // catch(Exception ex)
     // {
     // fail("MultiPoint serialization failure");
     // }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedMultiPoint.txt");
         java.io.ObjectInputStream         ii    = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.MultiPoint ptRes = (com.esri.core.geometry.MultiPoint)ii.readObject
                                                       ();
         NUnit.Framework.Assert.IsTrue(ptRes.getPoint(1).getY() == 40);
     }
     catch (System.Exception)
     {
         fail("MultiPoint serialization failure");
     }
 }
Exemplo n.º 11
0
        public static void test2()
        {
            com.esri.core.geometry.MultiPoint multipoint = new com.esri.core.geometry.MultiPoint
                                                               ();
            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    multipoint.add(i, j);
                }
            }
            com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D(
                );
            multipoint.queryEnvelope2D(extent);
            com.esri.core.geometry.MultiPointImpl multipointImpl = (com.esri.core.geometry.MultiPointImpl
                                                                    )multipoint._getImpl();
            com.esri.core.geometry.QuadTree quadtree = buildQuadTree_(multipointImpl);
            com.esri.core.geometry.QuadTree.QuadTreeIterator qtIter = quadtree.getIterator();
            NUnit.Framework.Assert.IsTrue(qtIter.next() == -1);
            int count = 0;

            qtIter.resetIterator(extent, 0.0);
            while (qtIter.next() != -1)
            {
                count++;
            }
            NUnit.Framework.Assert.IsTrue(count == 10000);
        }
Exemplo n.º 12
0
        public virtual void testBufferMultiPoint()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer
                                                            )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                                   .Buffer);
            com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify
                                                                )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                                       .Simplify);
            com.esri.core.geometry.MultiPoint inputGeom = new com.esri.core.geometry.MultiPoint
                                                              ();
            inputGeom.add(12, 120);
            inputGeom.add(20, 120);
            com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 40.0, null
                                                                    );
            NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                          .Polygon);
            com.esri.core.geometry.Polygon    poly  = (com.esri.core.geometry.Polygon)(result);
            com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
            result.queryEnvelope2D(env2D);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 80 - 8) < 0.001 &&
                                          System.Math.abs(env2D.getHeight() - 80) < 0.001);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 16) < 0.001 &&
                                          System.Math.abs(env2D.getCenterY() - 120) < 0.001);
            int pathCount = poly.getPathCount();

            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            int pointCount = poly.getPointCount();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 108.0) < 10);
            NUnit.Framework.Assert.IsTrue(simplify.isSimpleAsFeature(result, sr, null));
            {
                result = buffer.execute(inputGeom, sr, 0, null);
                NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                              .Polygon);
                NUnit.Framework.Assert.IsTrue(result.isEmpty());
            }
            {
                result = buffer.execute(inputGeom, sr, -1, null);
                NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                              .Polygon);
                NUnit.Framework.Assert.IsTrue(result.isEmpty());
            }
        }
Exemplo n.º 13
0
 public static void testCopy()
 {
     com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
         );
     com.esri.core.geometry.Point pt0 = new com.esri.core.geometry.Point(0.0, 0.0, -1.0
                                                                         );
     com.esri.core.geometry.Point pt1 = new com.esri.core.geometry.Point(0.0, 0.0, 1.0
                                                                         );
     com.esri.core.geometry.Point pt2 = new com.esri.core.geometry.Point(0.0, 1.0, 1.0
                                                                         );
     mpoint.add(pt0);
     mpoint.add(pt1);
     mpoint.add(pt2);
     mpoint.removePoint(1);
     com.esri.core.geometry.MultiPoint mpCopy = (com.esri.core.geometry.MultiPoint)mpoint
                                                .copy();
     NUnit.Framework.Assert.IsTrue(mpCopy.Equals(mpoint));
     com.esri.core.geometry.Point pt;
     pt = mpCopy.getPoint(0);
     NUnit.Framework.Assert.IsTrue(pt.getX() == pt0.getX() && pt.getY() == pt0.getY());
     pt = mpCopy.getPoint(1);
     NUnit.Framework.Assert.IsTrue(pt.getX() == pt2.getX() && pt.getY() == pt2.getY());
     NUnit.Framework.Assert.IsTrue(mpCopy.getPointCount() == 2);
 }
        /// <exception cref="org.codehaus.jackson.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool testMultiPoint()
        {
            bool bAnswer = true;

            com.esri.core.geometry.MultiPoint multiPoint1 = new com.esri.core.geometry.MultiPoint
                                                                ();
            multiPoint1.add(-97.06138, 32.837);
            multiPoint1.add(-97.06133, 32.836);
            multiPoint1.add(-97.06124, 32.834);
            multiPoint1.add(-97.06127, 32.832);
            {
                string s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWGS84
                                                                                , multiPoint1);
                org.codehaus.jackson.JsonParser    mPointWgs84Parser = factory.createJsonParser(s);
                com.esri.core.geometry.MapGeometry mPointWgs84MP     = com.esri.core.geometry.GeometryEngine
                                                                       .jsonToGeometry(mPointWgs84Parser);
                NUnit.Framework.Assert.IsTrue(multiPoint1.getPointCount() == ((com.esri.core.geometry.MultiPoint
                                                                               )mPointWgs84MP.getGeometry()).getPointCount());
                NUnit.Framework.Assert.IsTrue(multiPoint1.getPoint(0).getX() == ((com.esri.core.geometry.MultiPoint
                                                                                  )mPointWgs84MP.getGeometry()).getPoint(0).getX());
                NUnit.Framework.Assert.IsTrue(multiPoint1.getPoint(0).getY() == ((com.esri.core.geometry.MultiPoint
                                                                                  )mPointWgs84MP.getGeometry()).getPoint(0).getY());
                int lastIndex = multiPoint1.getPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(multiPoint1.getPoint(lastIndex).getX() == ((com.esri.core.geometry.MultiPoint
                                                                                          )mPointWgs84MP.getGeometry()).getPoint(lastIndex).getX());
                NUnit.Framework.Assert.IsTrue(multiPoint1.getPoint(lastIndex).getY() == ((com.esri.core.geometry.MultiPoint
                                                                                          )mPointWgs84MP.getGeometry()).getPoint(lastIndex).getY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.getID() == mPointWgs84MP.getSpatialReference
                                                  ().getID());
                if (!checkResultSpatialRef(mPointWgs84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.esri.core.geometry.MultiPoint p = new com.esri.core.geometry.MultiPoint();
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z);
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
                string s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                                , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"points\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
                p.add(10.0, 20.0, 30.0);
                p.add(20.0, 40.0, 60.0);
                s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                         , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"points\":[[10,20,30,null],[20,40,60,null]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
            }
            {
                string points = "{\"hasM\" : false, \"hasZ\" : true, \"uncle remus\" : null, \"points\" : [ [0,0,1], [0.0,10.0,1], [10.0,10.0,1], [10.0,0.0,1, 6666] ],\"spatialReference\" : {\"wkid\" : 4326}}";
                com.esri.core.geometry.MapGeometry mp = com.esri.core.geometry.GeometryEngine.jsonToGeometry
                                                            (factory.createJsonParser(points));
                com.esri.core.geometry.MultiPoint multipoint = (com.esri.core.geometry.MultiPoint
                                                                )mp.getGeometry();
                NUnit.Framework.Assert.IsTrue(multipoint.getPointCount() == 4);
                com.esri.core.geometry.Point2D point2d;
                point2d = multipoint.getXY(0);
                NUnit.Framework.Assert.IsTrue(point2d.x == 0.0 && point2d.y == 0.0);
                point2d = multipoint.getXY(1);
                NUnit.Framework.Assert.IsTrue(point2d.x == 0.0 && point2d.y == 10.0);
                point2d = multipoint.getXY(2);
                NUnit.Framework.Assert.IsTrue(point2d.x == 10.0 && point2d.y == 10.0);
                point2d = multipoint.getXY(3);
                NUnit.Framework.Assert.IsTrue(point2d.x == 10.0 && point2d.y == 0.0);
                NUnit.Framework.Assert.IsTrue(multipoint.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics
                                                                      .Z));
                NUnit.Framework.Assert.IsTrue(!multipoint.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics
                                                                       .M));
                double z = multipoint.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                        .Z, 0, 0);
                NUnit.Framework.Assert.IsTrue(z == 1);
                com.esri.core.geometry.SpatialReference spatial_reference = mp.getSpatialReference
                                                                                ();
                NUnit.Framework.Assert.IsTrue(spatial_reference.getID() == 4326);
            }
            return(bAnswer);
        }
Exemplo n.º 15
0
 public static void testPointTypes()
 {
     com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                          .getInstance();
     com.esri.core.geometry.OperatorDifference difference = (com.esri.core.geometry.OperatorDifference
                                                             )engine.getOperator(com.esri.core.geometry.Operator.Type.Difference);
     com.esri.core.geometry.OperatorSymmetricDifference sym_difference = (com.esri.core.geometry.OperatorSymmetricDifference
                                                                          )engine.getOperator(com.esri.core.geometry.Operator.Type.SymmetricDifference);
     {
         // point/point
         com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
         com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
         point_1.setXY(0, 0);
         point_2.setXY(0.000000009, 0.000000009);
         com.esri.core.geometry.Point differenced = (com.esri.core.geometry.Point)(difference
                                                                                   .execute(point_1, point_2, com.esri.core.geometry.SpatialReference.create(4326),
                                                                                            null));
         NUnit.Framework.Assert.IsTrue(differenced.isEmpty());
         com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint
                                                              )(sym_difference.execute(point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                       .create(4326), null));
         NUnit.Framework.Assert.IsTrue(sym_differenced.isEmpty());
     }
     {
         // point/point
         com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
         com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
         point_1.setXY(0, 0);
         point_2.setXY(0.000000009, 0.0);
         com.esri.core.geometry.Point differenced = (com.esri.core.geometry.Point)(difference
                                                                                   .execute(point_1, point_2, com.esri.core.geometry.SpatialReference.create(4326),
                                                                                            null));
         NUnit.Framework.Assert.IsTrue(differenced.isEmpty());
         com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint
                                                              )(sym_difference.execute(point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                       .create(4326), null));
         NUnit.Framework.Assert.IsTrue(sym_differenced.isEmpty());
     }
     {
         // point/point
         com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
         com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
         point_1.setXY(0, 0);
         point_2.setXY(0.00000002, 0.00000002);
         com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_1, point_2, com.esri.core.geometry.SpatialReference.create(4326),
                                                                                              null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         com.esri.core.geometry.Point differenced_2 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_2, point_1, com.esri.core.geometry.SpatialReference.create(4326),
                                                                                              null));
         NUnit.Framework.Assert.IsTrue(!differenced_2.isEmpty());
         com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint
                                                              )(sym_difference.execute(point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                       .create(4326), null));
         NUnit.Framework.Assert.IsTrue(!sym_differenced.isEmpty());
         NUnit.Framework.Assert.IsTrue(sym_differenced.getXY(0).x == 0 && sym_differenced.
                                       getXY(0).y == 0);
         NUnit.Framework.Assert.IsTrue(sym_differenced.getXY(1).x == 0.00000002 && sym_differenced
                                       .getXY(1).y == 0.00000002);
     }
     {
         // multi_point/point
         com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint
                                                               ();
         com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
         multi_point_1.add(0, 0);
         multi_point_1.add(1, 1);
         point_2.setXY(0.000000009, 0.000000009);
         com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint
                                                            )(difference.execute(multi_point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                 .create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1.getPointCount() == 1);
         NUnit.Framework.Assert.IsTrue(differenced_1.getXY(0).x == 1 && differenced_1.getXY
                                           (0).y == 1);
         com.esri.core.geometry.Point differenced_2 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_2, multi_point_1, com.esri.core.geometry.SpatialReference.create(
                                                                                                  4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_2.isEmpty());
     }
     {
         // multi_point/point
         com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint
                                                               ();
         com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
         multi_point_1.add(0, 0);
         multi_point_1.add(1, 1);
         point_2.setXY(0.000000009, 0.0);
         com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint
                                                            )(difference.execute(multi_point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                 .create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1.getXY(0).x == 1.0 && differenced_1.getXY
                                           (0).y == 1.0);
         com.esri.core.geometry.Point differenced_2 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_2, multi_point_1, com.esri.core.geometry.SpatialReference.create(
                                                                                                  4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_2.isEmpty());
         com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint
                                                              )(sym_difference.execute(multi_point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                       .create(4326), null));
         NUnit.Framework.Assert.IsTrue(!sym_differenced.isEmpty());
         NUnit.Framework.Assert.IsTrue(sym_differenced.getPointCount() == 1);
         NUnit.Framework.Assert.IsTrue(sym_differenced.getXY(0).x == 1 && sym_differenced.
                                       getXY(0).y == 1);
     }
     {
         // multi_point/point
         com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint
                                                               ();
         com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
         multi_point_1.add(0, 0);
         multi_point_1.add(0, 0);
         point_2.setXY(0.000000009, 0.0);
         com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint
                                                            )(difference.execute(multi_point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                 .create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.isEmpty());
         com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint
                                                              )(sym_difference.execute(multi_point_1, point_2, com.esri.core.geometry.SpatialReference
                                                                                       .create(4326), null));
         NUnit.Framework.Assert.IsTrue(sym_differenced.isEmpty());
     }
     {
         // multi_point/polygon
         com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint
                                                               ();
         com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.geometry.Polygon();
         multi_point_1.add(0, 0);
         multi_point_1.add(0, 0);
         multi_point_1.add(2, 2);
         polygon_2.startPath(-1, -1);
         polygon_2.lineTo(-1, 1);
         polygon_2.lineTo(1, 1);
         polygon_2.lineTo(1, -1);
         com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint
                                                            )(difference.execute(multi_point_1, polygon_2, com.esri.core.geometry.SpatialReference
                                                                                 .create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1.getPointCount() == 1);
         NUnit.Framework.Assert.IsTrue(differenced_1.getXY(0).x == 2 && differenced_1.getXY
                                           (0).y == 2);
     }
     {
         // multi_point/polygon
         com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint
                                                               ();
         com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.geometry.Polygon();
         multi_point_1.add(0, 0);
         multi_point_1.add(0, 0);
         multi_point_1.add(1, 1);
         polygon_2.startPath(-1, -1);
         polygon_2.lineTo(-1, 1);
         polygon_2.lineTo(1, 1);
         polygon_2.lineTo(1, -1);
         com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint
                                                            )(difference.execute(multi_point_1, polygon_2, com.esri.core.geometry.SpatialReference
                                                                                 .create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.isEmpty());
     }
     {
         // multi_point/envelope
         com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint
                                                               ();
         com.esri.core.geometry.Envelope envelope_2 = new com.esri.core.geometry.Envelope(
             );
         multi_point_1.add(-2, 0);
         multi_point_1.add(0, 2);
         multi_point_1.add(2, 0);
         multi_point_1.add(0, -2);
         envelope_2.setCoords(-1, -1, 1, 1);
         com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint
                                                            )(difference.execute(multi_point_1, envelope_2, com.esri.core.geometry.SpatialReference
                                                                                 .create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty() && differenced_1 == multi_point_1
                                       );
     }
     {
         // multi_point/polygon
         com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint
                                                               ();
         com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.geometry.Polygon();
         multi_point_1.add(2, 2);
         multi_point_1.add(2, 2);
         multi_point_1.add(-2, -2);
         polygon_2.startPath(-1, -1);
         polygon_2.lineTo(-1, 1);
         polygon_2.lineTo(1, 1);
         polygon_2.lineTo(1, -1);
         com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint
                                                            )(difference.execute(multi_point_1, polygon_2, com.esri.core.geometry.SpatialReference
                                                                                 .create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty() && differenced_1 == multi_point_1
                                       );
     }
     {
         // point/polygon
         com.esri.core.geometry.Point   point_1   = new com.esri.core.geometry.Point();
         com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.geometry.Polygon();
         point_1.setXY(0, 0);
         polygon_2.startPath(-1, -1);
         polygon_2.lineTo(-1, 1);
         polygon_2.lineTo(1, 1);
         polygon_2.lineTo(1, -1);
         com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_1, polygon_2, com.esri.core.geometry.SpatialReference.create(4326
                                                                                                                                                                 ), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.isEmpty());
         polygon_2.setEmpty();
         polygon_2.startPath(1, 1);
         polygon_2.lineTo(1, 2);
         polygon_2.lineTo(2, 2);
         polygon_2.lineTo(2, 1);
         differenced_1 = (com.esri.core.geometry.Point)(difference.execute(point_1, polygon_2
                                                                           , com.esri.core.geometry.SpatialReference.create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
     }
     {
         // point/polygon
         com.esri.core.geometry.Point   point_1   = new com.esri.core.geometry.Point();
         com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.geometry.Polygon();
         point_1.setXY(0, 0);
         polygon_2.startPath(1, 0);
         polygon_2.lineTo(0, 1);
         polygon_2.lineTo(1, 1);
         com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_1, polygon_2, com.esri.core.geometry.SpatialReference.create(4326
                                                                                                                                                                 ), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
         point_1.setEmpty();
         point_1.setXY(0.5, 0.5);
         polygon_2.setEmpty();
         polygon_2.startPath(1, 0);
         polygon_2.lineTo(0, 1);
         polygon_2.lineTo(1, 1);
         differenced_1 = (com.esri.core.geometry.Point)(difference.execute(point_1, polygon_2
                                                                           , com.esri.core.geometry.SpatialReference.create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.isEmpty());
     }
     {
         // point/envelope
         com.esri.core.geometry.Point    point_1    = new com.esri.core.geometry.Point();
         com.esri.core.geometry.Envelope envelope_2 = new com.esri.core.geometry.Envelope(
             );
         point_1.setXY(0, 0);
         envelope_2.setCoords(-1, -1, 1, 1);
         com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_1, envelope_2, com.esri.core.geometry.SpatialReference.create(4326
                                                                                                                                                                  ), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.isEmpty());
         envelope_2.setEmpty();
         envelope_2.setCoords(1, 1, 2, 2);
         differenced_1 = (com.esri.core.geometry.Point)(difference.execute(point_1, envelope_2
                                                                           , com.esri.core.geometry.SpatialReference.create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
     }
     {
         // point/polyline
         com.esri.core.geometry.Point    point_1    = new com.esri.core.geometry.Point();
         com.esri.core.geometry.Polyline polyline_2 = new com.esri.core.geometry.Polyline(
             );
         point_1.setXY(0, 0);
         polyline_2.startPath(-1, 0);
         polyline_2.lineTo(1, 0);
         com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference
                                                                                     .execute(point_1, polyline_2, com.esri.core.geometry.SpatialReference.create(4326
                                                                                                                                                                  ), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.isEmpty());
         polyline_2.setEmpty();
         polyline_2.startPath(1, 0);
         polyline_2.lineTo(2, 0);
         differenced_1 = (com.esri.core.geometry.Point)(difference.execute(point_1, polyline_2
                                                                           , com.esri.core.geometry.SpatialReference.create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
         polyline_2.setEmpty();
         polyline_2.startPath(-1, -1);
         polyline_2.lineTo(-1, 1);
         polyline_2.lineTo(1, 1);
         polyline_2.lineTo(1, -1);
         differenced_1 = (com.esri.core.geometry.Point)(difference.execute(point_1, polyline_2
                                                                           , com.esri.core.geometry.SpatialReference.create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.isEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
     }
 }
Exemplo n.º 16
0
        public static void testCreation()
        {
            {
                // simple create
                com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
                    );
                NUnit.Framework.Assert.IsTrue(Sharpen.Runtime.getClassForObject(mpoint) == Sharpen.Runtime.getClassForType
                                                  (typeof(com.esri.core.geometry.MultiPoint)));
                // assertFalse(mpoint.getClass() == Polyline.class);
                NUnit.Framework.Assert.IsTrue(mpoint != null);
                NUnit.Framework.Assert.IsTrue(mpoint.getType() == com.esri.core.geometry.Geometry.Type
                                              .MultiPoint);
                NUnit.Framework.Assert.IsTrue(mpoint.isEmpty());
                NUnit.Framework.Assert.IsTrue(mpoint.getPointCount() == 0);
                mpoint = null;
                NUnit.Framework.Assert.IsFalse(mpoint != null);
            }
            {
                // play with default attributes
                com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
                    );
                simpleTest(mpoint);
            }
            {
                // simple create 2D
                com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
                    );
                NUnit.Framework.Assert.IsTrue(mpoint != null);
                com.esri.core.geometry.MultiPoint mpoint1 = new com.esri.core.geometry.MultiPoint
                                                                ();
                NUnit.Framework.Assert.IsTrue(mpoint1 != null);
                mpoint.setEmpty();
                com.esri.core.geometry.Point pt = new com.esri.core.geometry.Point(0, 0);
                mpoint.add(pt);
                com.esri.core.geometry.Point pt3 = mpoint.getPoint(0);
                NUnit.Framework.Assert.IsTrue(pt3.getX() == 0 && pt3.getY() == 0);
                // assertFalse(mpoint->HasAttribute(VertexDescription::Semantics::Z));
                // pt3.setZ(115.0);
                mpoint.setPoint(0, pt3);
                pt3 = mpoint.getPoint(0);
                NUnit.Framework.Assert.IsTrue(pt3.getX() == 0 && pt3.getY() == 0);
            }
            {
                /* && pt3.getZ() == 115 */
                // assertTrue(mpoint->HasAttribute(VertexDescription::Semantics::Z));
                // CompareGeometryContent(mpoint, &pt, 1);
                // move 3d
                com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
                    );
                NUnit.Framework.Assert.IsTrue(mpoint != null);
                com.esri.core.geometry.Point pt = new com.esri.core.geometry.Point(0, 0);
                mpoint.add(pt);
                com.esri.core.geometry.Point pt3 = mpoint.getPoint(0);
                NUnit.Framework.Assert.IsTrue(pt3.getX() == 0 && pt3.getY() == 0);
            }
            {
                /* && pt3.getZ() == 0 */
                // test QueryInterval
                com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
                    );
                com.esri.core.geometry.Point pt1 = new com.esri.core.geometry.Point(0.0, 0.0);
                // pt1.setZ(-1.0);
                com.esri.core.geometry.Point pt2 = new com.esri.core.geometry.Point(0.0, 0.0);
                // pt2.setZ(1.0);
                mpoint.add(pt1);
                mpoint.add(pt2);
                // Envelope1D e =
                // mpoint->QueryInterval(enum_value2(VertexDescription, Semantics,
                // Z), 0);
                com.esri.core.geometry.Envelope e = new com.esri.core.geometry.Envelope();
                mpoint.queryEnvelope(e);
            }
            {
                // assertTrue(e.get == -1.0 && e.vmax == 1.0);
                com.esri.core.geometry.MultiPoint geom = new com.esri.core.geometry.MultiPoint();
            }
            {
                // int sz = sizeof(openString) / sizeof(openString[0]);
                // for (int i = 0; i < sz; i++)
                // geom.add(openString[i]);
                // CompareGeometryContent(geom, openString, sz);
                com.esri.core.geometry.MultiPoint geom = new com.esri.core.geometry.MultiPoint();
            }
            {
                // int sz = sizeof(openString) / sizeof(openString[0]);
                // Point point = GCNEW Point;
                // for (int i = 0; i < sz; i++)
                // {
                // point.setXY(openString[i]);
                // geom.add(point);
                // }
                // CompareGeometryContent(geom, openString, sz);
                // Test AddPoints
                com.esri.core.geometry.MultiPoint geom = new com.esri.core.geometry.MultiPoint();
            }
            {
                // int sz = sizeof(openString) / sizeof(openString[0]);
                // geom.addPoints(openString, sz, 0, -1);
                // CompareGeometryContent((MultiVertexGeometry)geom, openString,
                // sz);
                // Test InsertPoint(Point2D)
                com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
                    );
                com.esri.core.geometry.Point pt0 = new com.esri.core.geometry.Point(0.0, 0.0);
                // pt0.setZ(-1.0);
                // pt0.setID(7);
                com.esri.core.geometry.Point pt1 = new com.esri.core.geometry.Point(0.0, 0.0);
                // pt1.setZ(1.0);
                // pt1.setID(11);
                com.esri.core.geometry.Point pt2 = new com.esri.core.geometry.Point(0.0, 1.0);
                // pt2.setZ(1.0);
                // pt2.setID(13);
                mpoint.add(pt0);
                mpoint.add(pt1);
                mpoint.add(pt2);
                com.esri.core.geometry.Point pt3 = new com.esri.core.geometry.Point(-11.0, -13.0);
                mpoint.add(pt3);
                mpoint.insertPoint(1, pt3);
                NUnit.Framework.Assert.IsTrue(mpoint.getPointCount() == 5);
                com.esri.core.geometry.Point pt;
                pt = mpoint.getPoint(0);
                NUnit.Framework.Assert.IsTrue(pt.getX() == pt0.getX() && pt.getY() == pt0.getY());

                /*
                 * &&
                 * pt.
                 * getZ
                 * () ==
                 * pt0
                 * .getZ
                 * ()
                 */
                pt = mpoint.getPoint(1);
                NUnit.Framework.Assert.IsTrue(pt.getX() == pt3.getX() && pt.getY() == pt3.getY());
                pt = mpoint.getPoint(2);
                NUnit.Framework.Assert.IsTrue(pt.getX() == pt1.getX() && pt.getY() == pt1.getY());

                /*
                 * &&
                 * pt.
                 * getZ
                 * () ==
                 * pt1
                 * .getZ
                 * ()
                 */
                pt = mpoint.getPoint(3);
                NUnit.Framework.Assert.IsTrue(pt.getX() == pt2.getX() && pt.getY() == pt2.getY());

                /*
                 * &&
                 * pt.
                 * getZ
                 * () ==
                 * pt2
                 * .getZ
                 * ()
                 */
                com.esri.core.geometry.Point point = new com.esri.core.geometry.Point();
                point.setXY(17.0, 19.0);
                // point.setID(12);
                // point.setM(5);
                mpoint.insertPoint(2, point);
                mpoint.add(point);
                NUnit.Framework.Assert.IsTrue(mpoint.getPointCount() == 7);
            }
            // double m;
            // int id;
            // pt = mpoint.getXYZ(2);
            // assertTrue(pt.x == 17.0 && pt.y == 19.0 && pt.z == defaultZ);
            // m = mpoint.getAttributeAsDbl(enum_value2(VertexDescription,
            // Semantics, M), 2, 0);
            // assertTrue(m == 5);
            // id = mpoint.getAttributeAsInt(enum_value2(VertexDescription,
            // Semantics, ID), 2, 0);
            // assertTrue(id == 23);
            //
            // pt = mpoint.getXYZ(3);
            // assertTrue(pt.x == pt1.x && pt.y == pt1.y && pt.z == pt1.z);
            // m = mpoint.getAttributeAsDbl(enum_value2(VertexDescription,
            // Semantics, M), 3, 0);
            // assertTrue(NumberUtils::IsNaN(m));
            // id = mpoint.getAttributeAsInt(enum_value2(VertexDescription,
            // Semantics, ID), 3, 0);
            // assertTrue(id == 11);
            com.esri.core.geometry.MultiPoint mpoint_1 = new com.esri.core.geometry.MultiPoint
                                                             ();
            com.esri.core.geometry.Point pt0_1 = new com.esri.core.geometry.Point(0.0, 0.0, -
                                                                                  1.0);
            com.esri.core.geometry.Point pt1_1 = new com.esri.core.geometry.Point(0.0, 0.0, 1.0
                                                                                  );
            com.esri.core.geometry.Point pt2_1 = new com.esri.core.geometry.Point(0.0, 1.0, 1.0
                                                                                  );
            mpoint_1.add(pt0_1);
            mpoint_1.add(pt1_1);
            mpoint_1.add(pt2_1);
            mpoint_1.removePoint(1);
            com.esri.core.geometry.Point pt_1;
            pt_1 = mpoint_1.getPoint(0);
            NUnit.Framework.Assert.IsTrue(pt_1.getX() == pt0_1.getX() && pt_1.getY() == pt0_1
                                          .getY());
            pt_1 = mpoint_1.getPoint(1);
            NUnit.Framework.Assert.IsTrue(pt_1.getX() == pt2_1.getX() && pt_1.getY() == pt2_1
                                          .getY());
            NUnit.Framework.Assert.IsTrue(mpoint_1.getPointCount() == 2);
        }
Exemplo n.º 17
0
 public static com.esri.core.geometry.MultiPoint makeMultiPoint2()
 {
     com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint(
         );
     com.esri.core.geometry.Point2D pt1 = new com.esri.core.geometry.Point2D();
     pt1.x = 1.0;
     pt1.y = 1.0;
     com.esri.core.geometry.Point2D pt2 = new com.esri.core.geometry.Point2D();
     pt2.x = 1.0;
     pt2.y = 1.0;
     com.esri.core.geometry.Point2D pt3 = new com.esri.core.geometry.Point2D();
     pt3.x = 15.0;
     pt3.y = 15.0;
     com.esri.core.geometry.Point2D pt4 = new com.esri.core.geometry.Point2D();
     pt4.x = 15.0;
     pt4.y = 15.0;
     com.esri.core.geometry.Point2D pt5 = new com.esri.core.geometry.Point2D();
     pt5.x = 1.0;
     pt5.y = 1.0;
     com.esri.core.geometry.Point2D pt6 = new com.esri.core.geometry.Point2D();
     pt6.x = 1.0;
     pt6.y = 1.0;
     com.esri.core.geometry.Point2D pt7 = new com.esri.core.geometry.Point2D();
     pt7.x = 15.0;
     pt7.y = 15.0;
     com.esri.core.geometry.Point2D pt8 = new com.esri.core.geometry.Point2D();
     pt8.x = 15.0;
     pt8.y = 15.0;
     com.esri.core.geometry.Point2D pt9 = new com.esri.core.geometry.Point2D();
     pt9.x = 15.0;
     pt9.y = 15.0;
     com.esri.core.geometry.Point2D pt10 = new com.esri.core.geometry.Point2D();
     pt10.x = 1.0;
     pt10.y = 1.0;
     com.esri.core.geometry.Point2D pt11 = new com.esri.core.geometry.Point2D();
     pt11.x = 15.0;
     pt11.y = 15.0;
     mpoint.add(pt1.x, pt1.y);
     mpoint.add(pt2.x, pt2.y);
     mpoint.add(pt3.x, pt3.y);
     mpoint.add(pt4.x, pt4.y);
     mpoint.add(pt5.x, pt5.y);
     mpoint.add(pt6.x, pt6.y);
     mpoint.add(pt7.x, pt7.y);
     mpoint.add(pt8.x, pt8.y);
     mpoint.add(pt9.x, pt9.y);
     mpoint.add(pt10.x, pt10.y);
     mpoint.add(pt11.x, pt11.y);
     return(mpoint);
 }
Exemplo n.º 18
0
 public virtual void testMultiPoint()
 {
     com.esri.core.geometry.MultiPoint mp = new com.esri.core.geometry.MultiPoint();
     mp.add(new com.esri.core.geometry.Point(100, 200));
     mp.add(new com.esri.core.geometry.Point(101, 201));
     mp.add(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.MultiPoint mp1 = new com.esri.core.geometry.MultiPoint();
     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);
 }