/// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestMultiPoint()
        {
            bool bAnswer = true;

            com.epl.geometry.MultiPoint multiPoint1 = new com.epl.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.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, multiPoint1);
                com.fasterxml.jackson.core.JsonParser mPointWgs84Parser = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          mPointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(mPointWgs84Parser);
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPointCount() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPointCount());
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(0).GetX() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(0).GetX());
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(0).GetY() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(0).GetY());
                int lastIndex = multiPoint1.GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(lastIndex).GetX() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(lastIndex).GetX());
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(lastIndex).GetY() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(lastIndex).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPointWgs84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(mPointWgs84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.MultiPoint p = new com.epl.geometry.MultiPoint();
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.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.epl.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.epl.geometry.MapGeometry mp         = com.epl.geometry.GeometryEngine.JsonToGeometry(factory.CreateParser(points));
                com.epl.geometry.MultiPoint  multipoint = (com.epl.geometry.MultiPoint)mp.GetGeometry();
                NUnit.Framework.Assert.IsTrue(multipoint.GetPointCount() == 4);
                com.epl.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.epl.geometry.VertexDescription.Semantics.Z));
                NUnit.Framework.Assert.IsTrue(!multipoint.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
                double z = multipoint.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0);
                NUnit.Framework.Assert.IsTrue(z == 1);
                com.epl.geometry.SpatialReference spatial_reference = mp.GetSpatialReference();
                NUnit.Framework.Assert.IsTrue(spatial_reference.GetID() == 4326);
            }
            return(bAnswer);
        }
        private static int QuickTest2DMultiPointEnvelope(com.epl.geometry.MultiPoint geomA, com.epl.geometry.Envelope2D geomBEnv, double tolerance, int testType)
        {
            // Add early bailout for disjoint test.
            com.epl.geometry.Envelope2D envBMinus = geomBEnv;
            envBMinus.Inflate(-tolerance, -tolerance);
            com.epl.geometry.Envelope2D envBPlus = geomBEnv;
            envBPlus.Inflate(tolerance, tolerance);
            int dres = 0;

            for (int i = 0, n = geomA.GetPointCount(); i < n; i++)
            {
                com.epl.geometry.Point2D ptA;
                ptA = geomA.GetXY(i);
                int res = ReverseResult(QuickTest2DEnvelopePoint(envBPlus, envBMinus, ptA, tolerance));
                if (res != (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint)
                {
                    dres |= res;
                    if (testType == (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint)
                    {
                        return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Intersects);
                    }
                }
            }
            if (dres == 0)
            {
                return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint);
            }
            if (dres == (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Within)
            {
                return(dres);
            }
            return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Overlaps);
        }
        internal static com.epl.geometry.Geometry MultiPointMinusPolygon_(com.epl.geometry.MultiPoint multi_point, com.epl.geometry.Polygon polygon, double tolerance, com.epl.geometry.ProgressTracker progress_tracker)
        {
            com.epl.geometry.Envelope2D env = new com.epl.geometry.Envelope2D();
            polygon.QueryEnvelope2D(env);
            env.Inflate(tolerance, tolerance);
            int  point_count     = multi_point.GetPointCount();
            bool b_found_covered = false;

            bool[] covered = new bool[point_count];
            for (int i = 0; i < point_count; i++)
            {
                covered[i] = false;
            }
            com.epl.geometry.Point2D pt = new com.epl.geometry.Point2D();
            for (int i_1 = 0; i_1 < point_count; i_1++)
            {
                multi_point.GetXY(i_1, pt);
                if (!env.Contains(pt))
                {
                    continue;
                }
                com.epl.geometry.PolygonUtils.PiPResult result = com.epl.geometry.PolygonUtils.IsPointInPolygon2D(polygon, pt, tolerance);
                if (result == com.epl.geometry.PolygonUtils.PiPResult.PiPOutside)
                {
                    continue;
                }
                b_found_covered = true;
                covered[i_1]    = true;
            }
            if (!b_found_covered)
            {
                return(multi_point);
            }
            com.epl.geometry.MultiPoint new_multipoint = (com.epl.geometry.MultiPoint)multi_point.CreateInstance();
            for (int i_2 = 0; i_2 < point_count; i_2++)
            {
                if (!covered[i_2])
                {
                    new_multipoint.Add(multi_point, i_2, i_2 + 1);
                }
            }
            return(new_multipoint);
        }
 private static int QuickTest2DMultiPointPoint(com.epl.geometry.MultiPoint geomA, com.epl.geometry.Point2D ptB, double tolerance)
 {
     // TODO: Add Geometry accelerator. (RasterizedGeometry + kd-tree or
     // alike)
     for (int i = 0, n = geomA.GetPointCount(); i < n; i++)
     {
         com.epl.geometry.Point2D ptA;
         ptA = geomA.GetXY(i);
         int res = QuickTest2DPointPoint(ptA, ptB, tolerance);
         if (res != (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint)
         {
             if ((res & (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Within) != 0 && n != 1)
             {
                 // _ASSERT(res & (int)Relation.Contains);
                 return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains);
             }
             return(res);
         }
     }
     return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint);
 }
        private static int QuickTest2DMultiPointMultiPoint(com.epl.geometry.MultiPoint geomA, com.epl.geometry.MultiPoint geomB, double tolerance, int testType)
        {
            int counter = 0;

            for (int ib = 0, nb = geomB.GetPointCount(); ib < nb; ib++)
            {
                com.epl.geometry.Point2D ptB;
                ptB = geomB.GetXY(ib);
                int res = QuickTest2DMultiPointPoint(geomA, ptB, tolerance);
                if (res != (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint)
                {
                    counter++;
                    if (testType == (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Disjoint)
                    {
                        return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Intersects);
                    }
                }
            }
            if (counter > 0)
            {
                if (counter == geomB.GetPointCount())
                {
                    // every point from B is within
                    // A. Means the A contains B
                    if (testType == (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Equals)
                    {
                        // This is slow.
                        // Refactor.
                        int res = QuickTest2DMultiPointMultiPoint(geomB, geomA, tolerance, (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains);
                        return(res == (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains ? (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Equals : (int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Unknown);
                    }
                    return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Contains);
                }
                else
                {
                    return((int)com.epl.geometry.OperatorInternalRelationUtils.Relation.Overlaps);
                }
            }
            return(0);
        }
 public static void TestPointTypes()
 {
     com.epl.geometry.OperatorFactoryLocal        engine         = com.epl.geometry.OperatorFactoryLocal.GetInstance();
     com.epl.geometry.OperatorDifference          difference     = (com.epl.geometry.OperatorDifference)engine.GetOperator(com.epl.geometry.Operator.Type.Difference);
     com.epl.geometry.OperatorSymmetricDifference sym_difference = (com.epl.geometry.OperatorSymmetricDifference)engine.GetOperator(com.epl.geometry.Operator.Type.SymmetricDifference);
     {
         // point/point
         com.epl.geometry.Point point_1 = new com.epl.geometry.Point();
         com.epl.geometry.Point point_2 = new com.epl.geometry.Point();
         point_1.SetXY(0, 0);
         point_2.SetXY(0.000000009, 0.000000009);
         com.epl.geometry.Point differenced = (com.epl.geometry.Point)(difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced.IsEmpty());
         com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty());
     }
     {
         // point/point
         com.epl.geometry.Point point_1 = new com.epl.geometry.Point();
         com.epl.geometry.Point point_2 = new com.epl.geometry.Point();
         point_1.SetXY(0, 0);
         point_2.SetXY(0.000000009, 0.0);
         com.epl.geometry.Point differenced = (com.epl.geometry.Point)(difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced.IsEmpty());
         com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty());
     }
     {
         // point/point
         com.epl.geometry.Point point_1 = new com.epl.geometry.Point();
         com.epl.geometry.Point point_2 = new com.epl.geometry.Point();
         point_1.SetXY(0, 0);
         point_2.SetXY(0.00000002, 0.00000002);
         com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
         com.epl.geometry.Point differenced_2 = (com.epl.geometry.Point)(difference.Execute(point_2, point_1, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_2.IsEmpty());
         com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.epl.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.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint();
         com.epl.geometry.Point      point_2       = new com.epl.geometry.Point();
         multi_point_1.Add(0, 0);
         multi_point_1.Add(1, 1);
         point_2.SetXY(0.000000009, 0.000000009);
         com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.epl.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.epl.geometry.Point differenced_2 = (com.epl.geometry.Point)(difference.Execute(point_2, multi_point_1, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_2.IsEmpty());
     }
     {
         // multi_point/point
         com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint();
         com.epl.geometry.Point      point_2       = new com.epl.geometry.Point();
         multi_point_1.Add(0, 0);
         multi_point_1.Add(1, 1);
         point_2.SetXY(0.000000009, 0.0);
         com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.epl.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.epl.geometry.Point differenced_2 = (com.epl.geometry.Point)(difference.Execute(point_2, multi_point_1, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_2.IsEmpty());
         com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(multi_point_1, point_2, com.epl.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.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint();
         com.epl.geometry.Point      point_2       = new com.epl.geometry.Point();
         multi_point_1.Add(0, 0);
         multi_point_1.Add(0, 0);
         point_2.SetXY(0.000000009, 0.0);
         com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty());
         com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(multi_point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty());
     }
     {
         // multi_point/polygon
         com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint();
         com.epl.geometry.Polygon    polygon_2     = new com.epl.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.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.epl.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.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint();
         com.epl.geometry.Polygon    polygon_2     = new com.epl.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.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty());
     }
     {
         // multi_point/envelope
         com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint();
         com.epl.geometry.Envelope   envelope_2    = new com.epl.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.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, envelope_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty() && differenced_1 == multi_point_1);
     }
     {
         // multi_point/polygon
         com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint();
         com.epl.geometry.Polygon    polygon_2     = new com.epl.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.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty() && differenced_1 == multi_point_1);
     }
     {
         // point/polygon
         com.epl.geometry.Point   point_1   = new com.epl.geometry.Point();
         com.epl.geometry.Polygon polygon_2 = new com.epl.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.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.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.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
     }
     {
         // point/polygon
         com.epl.geometry.Point   point_1   = new com.epl.geometry.Point();
         com.epl.geometry.Polygon polygon_2 = new com.epl.geometry.Polygon();
         point_1.SetXY(0, 0);
         polygon_2.StartPath(1, 0);
         polygon_2.LineTo(0, 1);
         polygon_2.LineTo(1, 1);
         com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.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.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty());
     }
     {
         // point/envelope
         com.epl.geometry.Point    point_1    = new com.epl.geometry.Point();
         com.epl.geometry.Envelope envelope_2 = new com.epl.geometry.Envelope();
         point_1.SetXY(0, 0);
         envelope_2.SetCoords(-1, -1, 1, 1);
         com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, envelope_2, com.epl.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.epl.geometry.Point)(difference.Execute(point_1, envelope_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
     }
     {
         // point/polyline
         com.epl.geometry.Point    point_1    = new com.epl.geometry.Point();
         com.epl.geometry.Polyline polyline_2 = new com.epl.geometry.Polyline();
         point_1.SetXY(0, 0);
         polyline_2.StartPath(-1, 0);
         polyline_2.LineTo(1, 0);
         com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polyline_2, com.epl.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.epl.geometry.Point)(difference.Execute(point_1, polyline_2, com.epl.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.epl.geometry.Point)(difference.Execute(point_1, polyline_2, com.epl.geometry.SpatialReference.Create(4326), null));
         NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
         NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
     }
 }
        private static void ExportMultiPointToJson(com.epl.geometry.MultiPoint mpt, com.epl.geometry.SpatialReference spatialReference, com.epl.geometry.JsonWriter jsonWriter, System.Collections.Generic.IDictionary <string, object> exportProperties)
        {
            bool bExportZs    = mpt.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
            bool bExportMs    = mpt.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M);
            bool bPositionAsF = false;
            int  decimals     = 17;

            if (exportProperties != null)
            {
                object numberOfDecimalsXY = exportProperties["numberOfDecimalsXY"];
                if (numberOfDecimalsXY != null && numberOfDecimalsXY is java.lang.Number)
                {
                    bPositionAsF = true;
                    decimals     = ((java.lang.Number)numberOfDecimalsXY);
                }
            }
            jsonWriter.StartObject();
            if (bExportZs)
            {
                jsonWriter.AddPairBoolean("hasZ", true);
            }
            if (bExportMs)
            {
                jsonWriter.AddPairBoolean("hasM", true);
            }
            jsonWriter.AddPairArray("points");
            if (!mpt.IsEmpty())
            {
                com.epl.geometry.MultiPointImpl mpImpl = (com.epl.geometry.MultiPointImpl)mpt._getImpl();
                // get impl
                // for
                // faster
                // access
                com.epl.geometry.AttributeStreamOfDbl zs = null;
                com.epl.geometry.AttributeStreamOfDbl ms = null;
                if (bExportZs)
                {
                    zs = (com.epl.geometry.AttributeStreamOfDbl)mpImpl.GetAttributeStreamRef(com.epl.geometry.VertexDescription.Semantics.Z);
                }
                if (bExportMs)
                {
                    ms = (com.epl.geometry.AttributeStreamOfDbl)mpImpl.GetAttributeStreamRef(com.epl.geometry.VertexDescription.Semantics.M);
                }
                com.epl.geometry.Point2D pt = new com.epl.geometry.Point2D();
                int n = mpt.GetPointCount();
                for (int i = 0; i < n; i++)
                {
                    mpt.GetXY(i, pt);
                    jsonWriter.AddValueArray();
                    if (bPositionAsF)
                    {
                        jsonWriter.AddValueDouble(pt.x, decimals, true);
                        jsonWriter.AddValueDouble(pt.y, decimals, true);
                    }
                    else
                    {
                        jsonWriter.AddValueDouble(pt.x);
                        jsonWriter.AddValueDouble(pt.y);
                    }
                    if (bExportZs)
                    {
                        double z = zs.Get(i);
                        jsonWriter.AddValueDouble(z);
                    }
                    if (bExportMs)
                    {
                        double m = ms.Get(i);
                        jsonWriter.AddValueDouble(m);
                    }
                    jsonWriter.EndArray();
                }
            }
            jsonWriter.EndArray();
            if (spatialReference != null)
            {
                WriteSR(spatialReference, jsonWriter);
            }
            jsonWriter.EndObject();
        }