示例#1
0
        public virtual void testPointAndPolyline1()
        {
            com.esri.core.geometry.Point    basePl = new com.esri.core.geometry.Point(-116, 20);
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(new com.esri.core.geometry.Point(-116, 20));
            compPl.lineTo(new com.esri.core.geometry.Point(-131, 10));
            compPl.lineTo(new com.esri.core.geometry.Point(-121, 50));
            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
                                          .Point);
            com.esri.core.geometry.Point ip = (com.esri.core.geometry.Point)intersectGeom;
            NUnit.Framework.Assert.AreEqual(-116, 0.1E7, ip.getX());
            NUnit.Framework.Assert.AreEqual(20, 0.1E7, ip.getY());
        }
示例#2
0
 public static void testGetXCorrectCR185697()
 {
     com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                          .getInstance();
     com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip
                                                   )engine.getOperator(com.esri.core.geometry.Operator.Type.Clip);
     com.esri.core.geometry.Polyline             polylineCR     = makePolylineCR();
     com.esri.core.geometry.SimpleGeometryCursor polylineCursCR = new com.esri.core.geometry.SimpleGeometryCursor
                                                                      (polylineCR);
     com.esri.core.geometry.SpatialReference gcsWGS84 = com.esri.core.geometry.SpatialReference
                                                        .create(4326);
     com.esri.core.geometry.Envelope2D envelopeCR = new com.esri.core.geometry.Envelope2D
                                                        ();
     envelopeCR.xmin = -180;
     envelopeCR.xmax = 180;
     envelopeCR.ymin = -90;
     envelopeCR.ymax = 90;
     // CR
     com.esri.core.geometry.Polyline clippedPolylineCR = (com.esri.core.geometry.Polyline
                                                          )clipOp.execute(polylineCR, envelopeCR, gcsWGS84, null);
     com.esri.core.geometry.Point pointResult = new com.esri.core.geometry.Point();
     clippedPolylineCR.getPointByVal(0, pointResult);
     NUnit.Framework.Assert.IsTrue(pointResult.getX() == -180);
     clippedPolylineCR.getPointByVal(1, pointResult);
     NUnit.Framework.Assert.IsTrue(pointResult.getX() == -90);
     clippedPolylineCR.getPointByVal(2, pointResult);
     NUnit.Framework.Assert.IsTrue(pointResult.getX() == 0);
     clippedPolylineCR.getPointByVal(3, pointResult);
     NUnit.Framework.Assert.IsTrue(pointResult.getX() == 100);
     clippedPolylineCR.getPointByVal(4, pointResult);
     NUnit.Framework.Assert.IsTrue(pointResult.getX() == 170);
     clippedPolylineCR.getPointByVal(5, pointResult);
     NUnit.Framework.Assert.IsTrue(pointResult.getX() == 180);
 }
示例#3
0
 public virtual void testSerializePoint()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.Point  pt        = new com.esri.core.geometry.Point(10, 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.Point ptRes = (com.esri.core.geometry.Point)ii.readObject(
             );
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         fail("Point serialization failure");
     }
     // try
     // {
     // FileOutputStream streamOut = new FileOutputStream(m_thisDirectory +
     // "savedPoint.txt");
     // ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     // Point pt = new Point(10, 40);
     // oo.writeObject(pt);
     // }
     // catch(Exception ex)
     // {
     // fail("Point serialization failure");
     // }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedPoint.txt");
         java.io.ObjectInputStream    ii    = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.Point ptRes = (com.esri.core.geometry.Point)ii.readObject(
             );
         NUnit.Framework.Assert.IsTrue(ptRes.getX() == 10 && ptRes.getY() == 40);
     }
     catch (System.Exception)
     {
         fail("Point serialization failure");
     }
 }
示例#4
0
		public virtual void testProximity2D_2()
		{
			com.esri.core.geometry.Point point1 = new com.esri.core.geometry.Point(3, 2);
			com.esri.core.geometry.Point point2 = new com.esri.core.geometry.Point(2, 4);
			com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope();
			envelope.setCoords(4, 3, 7, 6);
			com.esri.core.geometry.Polygon polygonToTest = new com.esri.core.geometry.Polygon
				();
			polygonToTest.addEnvelope(envelope, false);
			com.esri.core.geometry.Proximity2DResult prxResult1 = com.esri.core.geometry.GeometryEngine
				.getNearestVertex(envelope, point1);
			com.esri.core.geometry.Proximity2DResult prxResult2 = com.esri.core.geometry.GeometryEngine
				.getNearestVertex(polygonToTest, point1);
			com.esri.core.geometry.Proximity2DResult prxResult3 = com.esri.core.geometry.GeometryEngine
				.getNearestCoordinate(envelope, point2, false);
			com.esri.core.geometry.Proximity2DResult prxResult4 = com.esri.core.geometry.GeometryEngine
				.getNearestCoordinate(polygonToTest, point2, false);
			com.esri.core.geometry.Point result1 = prxResult1.getCoordinate();
			com.esri.core.geometry.Point result2 = prxResult2.getCoordinate();
			NUnit.Framework.Assert.IsTrue(result1.getX() == result2.getX());
			com.esri.core.geometry.Point result3 = prxResult3.getCoordinate();
			com.esri.core.geometry.Point result4 = prxResult4.getCoordinate();
			NUnit.Framework.Assert.IsTrue(result3.getX() == result4.getX());
		}
 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 testPoint()
        {
            bool bAnswer = true;

            com.esri.core.geometry.Point point1 = new com.esri.core.geometry.Point(10.0, 20.0
                                                                                   );
            com.esri.core.geometry.Point pointEmpty = new com.esri.core.geometry.Point();
            {
                org.codehaus.jackson.JsonParser pointWebMerc1Parser = factory.createJsonParser(com.esri.core.geometry.GeometryEngine
                                                                                               .geometryToJson(spatialReferenceWebMerc1, point1));
                com.esri.core.geometry.MapGeometry pointWebMerc1MP = com.esri.core.geometry.GeometryEngine
                                                                     .jsonToGeometry(pointWebMerc1Parser);
                NUnit.Framework.Assert.IsTrue(point1.getX() == ((com.esri.core.geometry.Point)pointWebMerc1MP
                                                                .getGeometry()).getX());
                NUnit.Framework.Assert.IsTrue(point1.getY() == ((com.esri.core.geometry.Point)pointWebMerc1MP
                                                                .getGeometry()).getY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWebMerc1.getID() == pointWebMerc1MP
                                              .getSpatialReference().getID() || pointWebMerc1MP.getSpatialReference().getID()
                                              == 3857);
                if (!checkResultSpatialRef(pointWebMerc1MP, 102100, 3857))
                {
                    bAnswer = false;
                }
                pointWebMerc1Parser = factory.createJsonParser(com.esri.core.geometry.GeometryEngine
                                                               .geometryToJson(null, point1));
                pointWebMerc1MP = com.esri.core.geometry.GeometryEngine.jsonToGeometry(pointWebMerc1Parser
                                                                                       );
                NUnit.Framework.Assert.IsTrue(null == pointWebMerc1MP.getSpatialReference());
                if (pointWebMerc1MP.getSpatialReference() != null)
                {
                    if (!checkResultSpatialRef(pointWebMerc1MP, 102100, 3857))
                    {
                        bAnswer = false;
                    }
                }
                string pointEmptyString = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                                               , pointEmpty);
                pointWebMerc1Parser = factory.createJsonParser(pointEmptyString);
            }
            org.codehaus.jackson.JsonParser pointWebMerc2Parser = factory.createJsonParser(com.esri.core.geometry.GeometryEngine
                                                                                           .geometryToJson(spatialReferenceWebMerc2, point1));
            com.esri.core.geometry.MapGeometry pointWebMerc2MP = com.esri.core.geometry.GeometryEngine
                                                                 .jsonToGeometry(pointWebMerc2Parser);
            NUnit.Framework.Assert.IsTrue(point1.getX() == ((com.esri.core.geometry.Point)pointWebMerc2MP
                                                            .getGeometry()).getX());
            NUnit.Framework.Assert.IsTrue(point1.getY() == ((com.esri.core.geometry.Point)pointWebMerc2MP
                                                            .getGeometry()).getY());
            NUnit.Framework.Assert.IsTrue(spatialReferenceWebMerc2.getLatestID() == pointWebMerc2MP
                                          .getSpatialReference().getLatestID());
            if (!checkResultSpatialRef(pointWebMerc2MP, spatialReferenceWebMerc2.getLatestID(
                                           ), 0))
            {
                bAnswer = false;
            }
            {
                org.codehaus.jackson.JsonParser pointWgs84Parser = factory.createJsonParser(com.esri.core.geometry.GeometryEngine
                                                                                            .geometryToJson(spatialReferenceWGS84, point1));
                com.esri.core.geometry.MapGeometry pointWgs84MP = com.esri.core.geometry.GeometryEngine
                                                                  .jsonToGeometry(pointWgs84Parser);
                NUnit.Framework.Assert.IsTrue(point1.getX() == ((com.esri.core.geometry.Point)pointWgs84MP
                                                                .getGeometry()).getX());
                NUnit.Framework.Assert.IsTrue(point1.getY() == ((com.esri.core.geometry.Point)pointWgs84MP
                                                                .getGeometry()).getY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.getID() == pointWgs84MP.getSpatialReference
                                                  ().getID());
                if (!checkResultSpatialRef(pointWgs84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.esri.core.geometry.Point p = new com.esri.core.geometry.Point();
                string s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                                , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"x\":null,\"y\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z);
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
                s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                         , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"x\":null,\"y\":null,\"z\":null,\"m\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
            }
            {
                com.esri.core.geometry.Point p = new com.esri.core.geometry.Point(10.0, 20.0, 30.0
                                                                                  );
                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("{\"x\":10,\"y\":20,\"z\":30,\"m\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
            }
            {
                // import
                string s = "{\"x\":0.0,\"y\":1.0,\"z\":5.0,\"m\":11.0,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}";
                org.codehaus.jackson.JsonParser    parser = factory.createJsonParser(s);
                com.esri.core.geometry.MapGeometry map_pt = com.esri.core.geometry.GeometryEngine
                                                            .jsonToGeometry(parser);
                com.esri.core.geometry.Point pt = (com.esri.core.geometry.Point)map_pt.getGeometry
                                                      ();
                NUnit.Framework.Assert.IsTrue(pt.getX() == 0.0);
                NUnit.Framework.Assert.IsTrue(pt.getY() == 1.0);
                NUnit.Framework.Assert.IsTrue(pt.getZ() == 5.0);
                NUnit.Framework.Assert.IsTrue(pt.getM() == 11.0);
            }
            {
                string s = "{\"x\" : 5.0, \"y\" : null, \"spatialReference\" : {\"wkid\" : 4326}} ";
                org.codehaus.jackson.JsonParser    parser = factory.createJsonParser(s);
                com.esri.core.geometry.MapGeometry map_pt = com.esri.core.geometry.GeometryEngine
                                                            .jsonToGeometry(parser);
                com.esri.core.geometry.Point pt = (com.esri.core.geometry.Point)map_pt.getGeometry
                                                      ();
                NUnit.Framework.Assert.IsTrue(pt.isEmpty());
                com.esri.core.geometry.SpatialReference spatial_reference = map_pt.getSpatialReference
                                                                                ();
                NUnit.Framework.Assert.IsTrue(spatial_reference.getID() == 4326);
            }
            return(bAnswer);
        }
示例#7
0
		public virtual void testProximity_2D_1()
		{
			com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
				.getInstance();
			com.esri.core.geometry.OperatorProximity2D proximityOp = (com.esri.core.geometry.OperatorProximity2D
				)engine.getOperator(com.esri.core.geometry.Operator.Type.Proximity2D);
			com.esri.core.geometry.Point inputPoint = new com.esri.core.geometry.Point(3, 2);
			com.esri.core.geometry.Point point0 = new com.esri.core.geometry.Point(2.75, 2);
			// Point point1 = new Point(3, 2.5);
			// Point point2 = new Point(3.75, 2);
			// Point point3 = new Point(2.25, 2.5);
			// Point point4 = new Point(4, 2.25);
			// GetNearestVertices for Polygon (Native and DotNet)
			com.esri.core.geometry.Polygon polygon = MakePolygon();
			com.esri.core.geometry.Proximity2DResult[] resultArray = com.esri.core.geometry.GeometryEngine
				.getNearestVertices(polygon, inputPoint, 2.0, 8);
			NUnit.Framework.Assert.IsTrue(resultArray.Length == 8);
			double lastdistance;
			double distance;
			com.esri.core.geometry.Proximity2DResult result0 = resultArray[0];
			lastdistance = result0.getDistance();
			NUnit.Framework.Assert.IsTrue(lastdistance <= 2.0);
			com.esri.core.geometry.Proximity2DResult result1 = resultArray[1];
			distance = result1.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result2 = resultArray[2];
			distance = result2.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result3 = resultArray[3];
			distance = result3.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result4 = resultArray[4];
			distance = result4.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result5 = resultArray[5];
			distance = result5.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result6 = resultArray[6];
			distance = result6.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result7 = resultArray[7];
			distance = result7.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			// lastdistance = distance;
			// Point[] coordinates = polygon.get.getCoordinates2D();
			// int pointCount = polygon.getPointCount();
			//
			// int hits = 0;
			// for (int i = 0; i < pointCount; i++)
			// {
			// Point ipoint = coordinates[i];
			// distance = Point::Distance(ipoint, inputPoint);
			//
			// if (distance < lastdistance)
			// hits++;
			// }
			// assertTrue(hits < 8);
			// GetNearestVertices for Point
			com.esri.core.geometry.Point point = MakePoint();
			resultArray = com.esri.core.geometry.GeometryEngine.getNearestVertices(point, inputPoint
				, 1.0, 1);
			NUnit.Framework.Assert.IsTrue(resultArray.Length == 1);
			result0 = resultArray[0];
			com.esri.core.geometry.Point resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == point.getX() && resultPoint0
				.getY() == point.getY());
			// GetNearestVertex for Polygon
			result0 = com.esri.core.geometry.GeometryEngine.getNearestVertex(polygon, inputPoint
				);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == point0.getX() && resultPoint0
				.getY() == point0.getY());
			// GetNearestVertex for Point
			result0 = com.esri.core.geometry.GeometryEngine.getNearestVertex(point, inputPoint
				);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == point.getX() && resultPoint0
				.getY() == point.getY());
			// GetNearestCoordinate for Polygon
			com.esri.core.geometry.Polygon polygon2 = MakePolygon2();
			result0 = com.esri.core.geometry.GeometryEngine.getNearestCoordinate(polygon2, inputPoint
				, true);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == inputPoint.getX() && resultPoint0
				.getY() == inputPoint.getY());
			// GetNearestCoordinate for Polyline
			com.esri.core.geometry.Polyline polyline = MakePolyline();
			result0 = com.esri.core.geometry.GeometryEngine.getNearestCoordinate(polyline, inputPoint
				, true);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == 0.0 && resultPoint0.getY() ==
				 2.0);
			com.esri.core.geometry.Polygon pp = new com.esri.core.geometry.Polygon();
			pp.startPath(0, 0);
			pp.lineTo(0, 10);
			pp.lineTo(10, 10);
			pp.lineTo(10, 0);
			inputPoint.setXY(15, -5);
			result0 = proximityOp.getNearestCoordinate(pp, inputPoint, true, true);
			bool is_right = result0.isRightSide();
			NUnit.Framework.Assert.IsTrue(!is_right);
		}
        public static void testDifferenceAndSymmetricDifference()
        {
            com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                                 .getInstance();
            com.esri.core.geometry.OperatorDifference differenceOp = (com.esri.core.geometry.OperatorDifference
                                                                      )engine.getOperator(com.esri.core.geometry.Operator.Type.Difference);
            com.esri.core.geometry.SpatialReference spatialRef = com.esri.core.geometry.SpatialReference
                                                                 .create(102113);
            com.esri.core.geometry.Polygon    polygon1      = makePolygon1();
            com.esri.core.geometry.Polygon    polygon2      = makePolygon2();
            com.esri.core.geometry.Polyline   polyline1     = makePolyline1();
            com.esri.core.geometry.MultiPoint multipoint1   = makeMultiPoint1();
            com.esri.core.geometry.MultiPoint multipoint2   = makeMultiPoint2();
            com.esri.core.geometry.MultiPoint multipoint3   = makeMultiPoint3();
            com.esri.core.geometry.Point      point1        = makePoint1();
            com.esri.core.geometry.Point      point2        = makePoint2();
            com.esri.core.geometry.Envelope   envelope1     = makeEnvelope1();
            com.esri.core.geometry.Envelope   envelope2     = makeEnvelope2();
            com.esri.core.geometry.Envelope   envelope3     = makeEnvelope3();
            com.esri.core.geometry.Polygon    outputPolygon = (com.esri.core.geometry.Polygon)differenceOp
                                                              .execute(polygon1, polygon2, spatialRef, null);
            double area = outputPolygon.calculateArea2D();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 75) <= 0.001);
            {
                com.esri.core.geometry.Point    point_1  = new com.esri.core.geometry.Point(-130, 10);
                com.esri.core.geometry.Point    point_2  = new com.esri.core.geometry.Point(-130, 10);
                com.esri.core.geometry.Geometry baseGeom = new com.esri.core.geometry.Point(point_1
                                                                                            .getX(), point_1.getY());
                com.esri.core.geometry.Geometry comparisonGeom = new com.esri.core.geometry.Point
                                                                     (point_2.getX(), point2.getY());
                com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                             .create(4326);
                com.esri.core.geometry.Geometry geom = differenceOp.execute(baseGeom, comparisonGeom
                                                                            , sr, null);
            }
            com.esri.core.geometry.OperatorSymmetricDifference symDifferenceOp = (com.esri.core.geometry.OperatorSymmetricDifference
                                                                                  )engine.getOperator(com.esri.core.geometry.Operator.Type.SymmetricDifference);
            outputPolygon = (com.esri.core.geometry.Polygon)symDifferenceOp.execute(polygon1,
                                                                                    polygon2, spatialRef, null);
            area = outputPolygon.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 150) <= 0.001);
            com.esri.core.geometry.Polyline outputPolyline = (com.esri.core.geometry.Polyline
                                                              )differenceOp.execute(polyline1, polygon1, spatialRef, null);
            double length = outputPolyline.calculateLength2D();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(length * length - 50) < 0.001);
            com.esri.core.geometry.MultiPoint outputMultiPoint = (com.esri.core.geometry.MultiPoint
                                                                  )differenceOp.execute(multipoint1, polygon1, spatialRef, null);
            int pointCount = outputMultiPoint.getPointCount();

            NUnit.Framework.Assert.IsTrue(pointCount == 1);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(symDifferenceOp.execute(multipoint1
                                                                                           , point1, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 2);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(symDifferenceOp.execute(multipoint1
                                                                                           , point2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 4);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint1
                                                                                        , point1, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 2);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint1
                                                                                        , point2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 3);
            outputPolygon = (com.esri.core.geometry.Polygon)(differenceOp.execute(polygon1, envelope1
                                                                                  , spatialRef, null));
            area = outputPolygon.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 75) <= 0.001);
            outputPolygon = (com.esri.core.geometry.Polygon)(differenceOp.execute(polygon2, envelope2
                                                                                  , spatialRef, null));
            area = outputPolygon.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 75) <= 0.001);
            outputPolyline = (com.esri.core.geometry.Polyline)(differenceOp.execute(polyline1
                                                                                    , envelope2, spatialRef, null));
            length = outputPolyline.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length * length - 50) <= 0.001);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint1
                                                                                        , envelope2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 1);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint2
                                                                                        , envelope2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 6);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint3
                                                                                        , envelope2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 0);
            com.esri.core.geometry.Point outputPoint = (com.esri.core.geometry.Point)(differenceOp
                                                                                      .execute(point1, envelope2, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(!outputPoint.isEmpty());
            outputPoint = (com.esri.core.geometry.Point)(differenceOp.execute(point2, envelope2
                                                                              , spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPoint.isEmpty());
            outputPolygon = (com.esri.core.geometry.Polygon)(differenceOp.execute(envelope3,
                                                                                  envelope2, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPolygon != null && outputPolygon.isEmpty());
            outputPolygon = (com.esri.core.geometry.Polygon)(symDifferenceOp.execute(envelope3
                                                                                     , envelope3, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPolygon != null && outputPolygon.isEmpty());
            outputPoint = (com.esri.core.geometry.Point)(differenceOp.execute(point1, polygon1
                                                                              , spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPoint != null);
        }
        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);
        }