Exemplo n.º 1
0
        public virtual void TestGeometryToJSONOldID()
        {
            // CR
            com.epl.geometry.Polygon geom = new com.epl.geometry.Polygon();
            geom.StartPath(new com.epl.geometry.Point(-113, 34));
            geom.LineTo(new com.epl.geometry.Point(-105, 34));
            geom.LineTo(new com.epl.geometry.Point(-108, 40));
            string outputPolygon = com.epl.geometry.GeometryEngine.GeometryToJson(com.epl.geometry.SpatialReference.Create(3857), geom);
            // Test
            // WKID
            // ==
            // -1
            string correctPolygon = "{\"rings\":[[[-113,34],[-105,34],[-108,40],[-113,34]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}";

            NUnit.Framework.Assert.IsTrue(outputPolygon.Equals(correctPolygon));
            com.fasterxml.jackson.core.JsonFactory jf = new com.fasterxml.jackson.core.JsonFactory();
            com.fasterxml.jackson.core.JsonParser  jp = jf.CreateJsonParser(outputPolygon);
            jp.NextToken();
            com.epl.geometry.MapGeometry mg = com.epl.geometry.GeometryEngine.JsonToGeometry(jp);
            int srId    = mg.GetSpatialReference().GetID();
            int srOldId = mg.GetSpatialReference().GetOldID();

            NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetID() == 3857);
            NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetLatestID() == 3857);
            NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetOldID() == 102100);
        }
Exemplo n.º 2
0
 public virtual void TestMultiPoint()
 {
     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);
     {
         com.fasterxml.jackson.core.JsonParser mPointWgs84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, multiPoint1));
         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());
         com.epl.geometry.MultiPoint mPointEmpty = new com.epl.geometry.MultiPoint();
         string mPointEmptyString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, mPointEmpty);
         mPointWgs84Parser = factory.CreateJsonParser(mPointEmptyString);
         mPointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(mPointWgs84Parser);
         NUnit.Framework.Assert.IsTrue(mPointWgs84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPointWgs84MP.GetSpatialReference().GetID());
     }
 }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public org.camunda.bpm.integrationtest.functional.spin.XmlSerializable deserialize(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
        public override XmlSerializable deserialize(JsonParser p, DeserializationContext ctxt)
        {
            XmlSerializable xmlSerializable = new XmlSerializable();

            xmlSerializable.Property = p.ValueAsString;
            return(xmlSerializable);
        }
Exemplo n.º 4
0
 public virtual void TestPolygon()
 {
     com.epl.geometry.Polygon polygon = new com.epl.geometry.Polygon();
     polygon.StartPath(-97.06138, 32.837);
     polygon.LineTo(-97.06133, 32.836);
     polygon.LineTo(-97.06124, 32.834);
     polygon.LineTo(-97.06127, 32.832);
     polygon.StartPath(-97.06326, 32.759);
     polygon.LineTo(-97.06298, 32.755);
     {
         com.fasterxml.jackson.core.JsonParser polygonPathsWgs84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, polygon));
         com.epl.geometry.MapGeometry          mPolygonWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polygonPathsWgs84Parser);
         NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPointCount());
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetX());
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetY());
         NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPathCount());
         NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount());
         NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(0) == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(0));
         NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(1) + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(1));
         int lastIndex = polygon.GetPointCount() - 1;
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetX());
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetY());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolygonWGS84MP.GetSpatialReference().GetID());
         com.epl.geometry.Polygon emptyPolygon = new com.epl.geometry.Polygon();
         string emptyPolygonString             = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, emptyPolygon);
         polygonPathsWgs84Parser = factory.CreateJsonParser(emptyPolygonString);
         mPolygonWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polygonPathsWgs84Parser);
         NUnit.Framework.Assert.IsTrue(mPolygonWGS84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolygonWGS84MP.GetSpatialReference().GetID());
     }
 }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestCR181369()
        {
            // CR181369
            bool   bAnswer = true;
            string jsonStringPointAndWKT = "{\"x\":10.0,\"y\":20.0,\"spatialReference\":{\"wkt\" : \"PROJCS[\\\"NAD83_UTM_zone_15N\\\",GEOGCS[\\\"GCS_North_American_1983\\\",DATUM[\\\"D_North_American_1983\\\",SPHEROID[\\\"GRS_1980\\\",6378137.0,298.257222101]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Transverse_Mercator\\\"],PARAMETER[\\\"false_easting\\\",500000.0],PARAMETER[\\\"false_northing\\\",0.0],PARAMETER[\\\"central_meridian\\\",-93.0],PARAMETER[\\\"scale_factor\\\",0.9996],PARAMETER[\\\"latitude_of_origin\\\",0.0],UNIT[\\\"Meter\\\",1.0]]\"} }";

            com.fasterxml.jackson.core.JsonParser jsonParserPointAndWKT = factory.CreateParser(jsonStringPointAndWKT);
            com.epl.geometry.MapGeometry          mapGeom2 = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPointAndWKT);
            string jsonStringPointAndWKT2 = com.epl.geometry.GeometryEngine.GeometryToJson(mapGeom2.GetSpatialReference(), mapGeom2.GetGeometry());

            com.fasterxml.jackson.core.JsonParser jsonParserPointAndWKT2 = factory.CreateParser(jsonStringPointAndWKT2);
            com.epl.geometry.MapGeometry          mapGeom3 = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPointAndWKT2);
            NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Point)mapGeom2.GetGeometry()).GetX() == ((com.epl.geometry.Point)mapGeom3.GetGeometry()).GetX());
            NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Point)mapGeom2.GetGeometry()).GetY() == ((com.epl.geometry.Point)mapGeom3.GetGeometry()).GetY());
            string s1 = mapGeom2.GetSpatialReference().GetText();
            string s2 = mapGeom3.GetSpatialReference().GetText();

            NUnit.Framework.Assert.IsTrue(s1.Equals(s2));
            int id2 = mapGeom2.GetSpatialReference().GetID();
            int id3 = mapGeom3.GetSpatialReference().GetID();

            NUnit.Framework.Assert.IsTrue(id2 == id3);
            if (!CheckResultSpatialRef(mapGeom3, mapGeom2.GetSpatialReference().GetID(), 0))
            {
                bAnswer = false;
            }
            return(bAnswer);
        }
        /// <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);
        }
Exemplo n.º 7
0
        public virtual void Test3DPoint()
        {
            string jsonString3DPt = "{\"x\" : -118.15, \"y\" : 33.80, \"z\" : 10.0, \"spatialReference\" : {\"wkid\" : 4326}}";

            com.fasterxml.jackson.core.JsonParser jsonParser3DPt = factory.CreateParser(jsonString3DPt);
            com.epl.geometry.MapGeometry          point3DMP      = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParser3DPt);
            NUnit.Framework.Assert.IsTrue(-118.15 == ((com.epl.geometry.Point)point3DMP.GetGeometry()).GetX());
            NUnit.Framework.Assert.IsTrue(33.80 == ((com.epl.geometry.Point)point3DMP.GetGeometry()).GetY());
            NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == point3DMP.GetSpatialReference().GetID());
        }
Exemplo n.º 8
0
 public virtual void Test3DPoint2()
 {
     {
         com.epl.geometry.Point point1 = new com.epl.geometry.Point(10.0, 20.0);
         com.fasterxml.jackson.core.JsonParser pointWebMerc2Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc2, point1));
         com.epl.geometry.MapGeometry          pointWebMerc2MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc2Parser);
         NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWebMerc2MP.GetGeometry()).GetX());
         NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWebMerc2MP.GetGeometry()).GetY());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWebMerc2.GetLatestID() == pointWebMerc2MP.GetSpatialReference().GetLatestID());
     }
 }
Exemplo n.º 9
0
        public static void TestContainsFailureCR186456()
        {
            string str = "{\"rings\":[[[406944.399999999,287461.450000001],[406947.750000011,287462.299999997],[406946.44999999,287467.450000001],[406943.050000005,287466.550000005],[406927.799999992,287456.849999994],[406926.949999996,287456.599999995],[406924.800000005,287455.999999998],[406924.300000007,287455.849999999],[406924.200000008,287456.099999997],[406923.450000011,287458.449999987],[406922.999999987,287459.800000008],[406922.29999999,287462.099999998],[406921.949999991,287463.449999992],[406921.449999993,287465.050000011],[406920.749999996,287466.700000004],[406919.800000001,287468.599999996],[406919.050000004,287469.99999999],[406917.800000009,287471.800000008],[406916.04999999,287473.550000001],[406915.449999993,287473.999999999],[406913.700000001,287475.449999993],[406913.300000002,287475.899999991],[406912.050000008,287477.250000011],[406913.450000002,287478.150000007],[406915.199999994,287478.650000005],[406915.999999991,287478.800000005],[406918.300000007,287479.200000003],[406920.649999997,287479.450000002],[406923.100000013,287479.550000001],[406925.750000001,287479.450000002],[406928.39999999,287479.150000003],[406929.80000001,287478.950000004],[406932.449999998,287478.350000006],[406935.099999987,287477.60000001],[406938.699999998,287476.349999989],[406939.649999994,287473.949999999],[406939.799999993,287473.949999999],[406941.249999987,287473.75],[406942.700000007,287473.250000002],[406943.100000005,287473.100000003],[406943.950000001,287472.750000004],[406944.799999998,287472.300000006],[406944.999999997,287472.200000007],[406946.099999992,287471.200000011],[406946.299999991,287470.950000012],[406948.00000001,287468.599999996],[406948.10000001,287468.399999997],[406950.100000001,287465.050000011],[406951.949999993,287461.450000001],[406952.049999993,287461.300000001],[406952.69999999,287459.900000007],[406953.249999987,287458.549999987],[406953.349999987,287458.299999988],[406953.650000012,287457.299999992],[406953.900000011,287456.349999996],[406954.00000001,287455.300000001],[406954.00000001,287454.750000003],[406953.850000011,287453.750000008],[406953.550000012,287452.900000011],[406953.299999987,287452.299999988],[406954.500000008,287450.299999996],[406954.00000001,287449.000000002],[406953.399999987,287447.950000006],[406953.199999988,287447.550000008],[406952.69999999,287446.850000011],[406952.149999992,287446.099999988],[406951.499999995,287445.499999991],[406951.149999996,287445.249999992],[406950.449999999,287444.849999994],[406949.600000003,287444.599999995],[406949.350000004,287444.549999995],[406948.250000009,287444.499999995],[406947.149999987,287444.699999994],[406946.849999989,287444.749999994],[406945.899999993,287444.949999993],[406944.999999997,287445.349999991],[406944.499999999,287445.64999999],[406943.650000003,287446.349999987],[406942.900000006,287447.10000001],[406942.500000008,287447.800000007],[406942.00000001,287448.700000003],[406941.600000011,287449.599999999],[406941.350000013,287450.849999994],[406941.350000013,287451.84999999],[406941.450000012,287452.850000012],[406941.750000011,287453.850000007],[406941.800000011,287454.000000007],[406942.150000009,287454.850000003],[406942.650000007,287455.6],[406943.150000005,287456.299999997],[406944.499999999,287457.299999992],[406944.899999997,287457.599999991],[406945.299999995,287457.949999989],[406944.399999999,287461.450000001],[406941.750000011,287461.999999998],[406944.399999999,287461.450000001]],[[406944.399999999,287461.450000001],[406947.750000011,287462.299999997],[406946.44999999,287467.450000001],[406943.050000005,287466.550000005],[406927.799999992,287456.849999994],[406944.399999999,287461.450000001]]]}";

            com.fasterxml.jackson.core.JsonFactory jsonFactory = new com.fasterxml.jackson.core.JsonFactory();
            com.fasterxml.jackson.core.JsonParser  jsonParser  = jsonFactory.CreateParser(str);
            com.epl.geometry.MapGeometry           mg          = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParser);
            bool res = com.epl.geometry.GeometryEngine.Contains(mg.GetGeometry(), mg.GetGeometry(), null);

            NUnit.Framework.Assert.IsTrue(res);
        }
Exemplo n.º 10
0
        public virtual void TestPolygonWithEmptyWKT_NoWKI()
        {
            string jsonStringPg = "{ \"rings\" :[  [ [-97.06138,32.837], [-97.06133,32.836], " + "[-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ],  " + "[ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]], " + "\"spatialReference\" : {\"wkt\" : \"\"}}";

            com.fasterxml.jackson.core.JsonParser jsonParserPg = factory.CreateParser(jsonStringPg);
            jsonParserPg.NextToken();
            com.epl.geometry.MapGeometry mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg);
            com.epl.geometry.Utils.ShowProjectedGeometryInfo(mapGeom);
            com.epl.geometry.SpatialReference sr = mapGeom.GetSpatialReference();
            NUnit.Framework.Assert.IsTrue(sr == null);
        }
Exemplo n.º 11
0
        public virtual void TestOnlyWKI()
        {
            string jsonStringSR = "{\"wkid\" : 4326}";

            com.fasterxml.jackson.core.JsonParser jsonParserSR = factory.CreateJsonParser(jsonStringSR);
            jsonParserSR.NextToken();
            com.epl.geometry.MapGeometry mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserSR);
            com.epl.geometry.Utils.ShowProjectedGeometryInfo(mapGeom);
            com.epl.geometry.SpatialReference sr = mapGeom.GetSpatialReference();
            NUnit.Framework.Assert.IsTrue(sr == null);
        }
Exemplo n.º 12
0
 /// <summary>Creates a JsonReader for the string.</summary>
 /// <remarks>
 /// Creates a JsonReader for the string.
 /// The nextToken is not called by this method.
 /// </remarks>
 public static com.epl.geometry.JsonReader CreateFromStringNNT(string str)
 {
     try
     {
         com.fasterxml.jackson.core.JsonFactory factory    = new com.fasterxml.jackson.core.JsonFactory();
         com.fasterxml.jackson.core.JsonParser  jsonParser = factory.CreateParser(str);
         return(new com.epl.geometry.JsonParserReader(jsonParser));
     }
     catch (System.Exception ex)
     {
         throw new com.epl.geometry.JsonGeometryException(ex.Message);
     }
 }
Exemplo n.º 13
0
        public virtual void TestMultiPolygon()
        {
            com.fasterxml.jackson.core.JsonFactory jsonFactory = new com.fasterxml.jackson.core.JsonFactory();
            //String geoJsonPolygon = "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-100,-100],[-100,100],[100,100],[100,-100],[-100,-100]],[[-90,-90],[90,90],[-90,90],[90,-90],[-90,-90]]],[[[-10.0,-10.0],[-10.0,10.0],[10.0,10.0],[10.0,-10.0],[-10.0,-10.0]]]]}";
            string esriJsonPolygon = "{\"rings\": [[[-100, -100], [-100, 100], [100, 100], [100, -100], [-100, -100]], [[-90, -90], [90, 90], [-90, 90], [90, -90], [-90, -90]], [[-10, -10], [-10, 10], [10, 10], [10, -10], [-10, -10]]]}";

            com.fasterxml.jackson.core.JsonParser parser     = jsonFactory.CreateParser(esriJsonPolygon);
            com.epl.geometry.MapGeometry          parsedPoly = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
            //MapGeometry parsedPoly = GeometryEngine.geometryFromGeoJson(jsonPolygon, 0, Geometry.Type.Polygon);
            com.epl.geometry.Polygon poly = (com.epl.geometry.Polygon)parsedPoly.GetGeometry();
            com.epl.geometry.OperatorExportToGeoJson exporter = (com.epl.geometry.OperatorExportToGeoJson)factory.GetOperator(com.epl.geometry.Operator.Type.ExportToGeoJson);
            //String result = exporter.execute(parsedPoly.getGeometry());
            string result = exporter.Execute(poly);

            NUnit.Framework.Assert.AreEqual("{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-100,-100],[100,-100],[100,100],[-100,100],[-100,-100]],[[-90,-90],[90,-90],[-90,90],[90,90],[-90,-90]]],[[[-10,-10],[10,-10],[10,10],[-10,10],[-10,-10]]]]}", result);
        }
Exemplo n.º 14
0
 internal static com.esri.core.geometry.Geometry getGeometryFromJSon(string jsonStr
                                                                     )
 {
     com.fasterxml.jackson.core.JsonFactory jf = new com.fasterxml.jackson.core.JsonFactory();
     try
     {
         com.fasterxml.jackson.core.JsonParser jp = jf.createJsonParser(jsonStr);
         jp.nextToken();
         com.esri.core.geometry.Geometry geom = com.esri.core.geometry.GeometryEngine.jsonToGeometry
                                                    (jp).getGeometry();
         return(geom);
     }
     catch (System.Exception)
     {
         return(null);
     }
 }
Exemplo n.º 15
0
 public virtual void TestMP2onCR175871()
 {
     com.epl.geometry.Polygon pg = new com.epl.geometry.Polygon();
     pg.StartPath(-50, 10);
     pg.LineTo(-50, 12);
     pg.LineTo(-45, 12);
     pg.LineTo(-45, 10);
     com.epl.geometry.Polygon pg1 = new com.epl.geometry.Polygon();
     pg1.StartPath(-45, 10);
     pg1.LineTo(-40, 10);
     pg1.LineTo(-40, 8);
     pg.Add(pg1, false);
     com.epl.geometry.SpatialReference spatialReference = com.epl.geometry.SpatialReference.Create(4326);
     try
     {
         string jSonStr = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReference, pg);
         com.fasterxml.jackson.core.JsonFactory jf = new com.fasterxml.jackson.core.JsonFactory();
         com.fasterxml.jackson.core.JsonParser  jp = jf.CreateJsonParser(jSonStr);
         jp.NextToken();
         com.epl.geometry.MapGeometry mg = com.epl.geometry.GeometryEngine.JsonToGeometry(jp);
         com.epl.geometry.Geometry    gm = mg.GetGeometry();
         NUnit.Framework.Assert.AreEqual(com.epl.geometry.Geometry.Type.Polygon, gm.GetType());
         NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetID() == 4326);
         com.epl.geometry.Polygon pgNew = (com.epl.geometry.Polygon)gm;
         NUnit.Framework.Assert.AreEqual(pgNew.GetPathCount(), pg.GetPathCount());
         NUnit.Framework.Assert.AreEqual(pgNew.GetPointCount(), pg.GetPointCount());
         NUnit.Framework.Assert.AreEqual(pgNew.GetSegmentCount(), pg.GetSegmentCount());
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(0).GetX(), pg.GetPoint(0).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(1).GetX(), pg.GetPoint(1).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(2).GetX(), pg.GetPoint(2).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(3).GetX(), pg.GetPoint(3).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(0).GetY(), pg.GetPoint(0).GetY(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(1).GetY(), pg.GetPoint(1).GetY(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(2).GetY(), pg.GetPoint(2).GetY(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(3).GetY(), pg.GetPoint(3).GetY(), 0.000000001);
     }
     catch (System.Exception ex)
     {
         string err = ex.Message;
         System.Console.Out.Write(err);
         throw;
     }
 }
Exemplo n.º 16
0
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        public static int FromJsonToWkid(com.fasterxml.jackson.core.JsonParser parser)
        {
            int wkid = 0;

            if (parser.GetCurrentToken() != com.fasterxml.jackson.core.JsonToken.START_OBJECT)
            {
                return(0);
            }
            while (parser.NextToken() != com.fasterxml.jackson.core.JsonToken.END_OBJECT)
            {
                string fieldName = parser.GetCurrentName();
                if ("wkid".Equals(fieldName))
                {
                    parser.NextToken();
                    wkid = parser.GetIntValue();
                }
            }
            return(wkid);
        }
Exemplo n.º 17
0
 public virtual void TestEnvelope()
 {
     com.epl.geometry.Envelope envelope = new com.epl.geometry.Envelope();
     envelope.SetCoords(-109.55, 25.76, -86.39, 49.94);
     {
         com.fasterxml.jackson.core.JsonParser envelopeWGS84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, envelope));
         com.epl.geometry.MapGeometry          envelopeWGS84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(envelopeWGS84Parser);
         NUnit.Framework.Assert.IsTrue(envelope.IsEmpty() == envelopeWGS84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(envelope.GetXMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMax());
         NUnit.Framework.Assert.IsTrue(envelope.GetYMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMax());
         NUnit.Framework.Assert.IsTrue(envelope.GetXMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMin());
         NUnit.Framework.Assert.IsTrue(envelope.GetYMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMin());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == envelopeWGS84MP.GetSpatialReference().GetID());
         com.epl.geometry.Envelope emptyEnvelope = new com.epl.geometry.Envelope();
         string emptyEnvString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, emptyEnvelope);
         envelopeWGS84Parser = factory.CreateJsonParser(emptyEnvString);
         envelopeWGS84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(envelopeWGS84Parser);
         NUnit.Framework.Assert.IsTrue(envelopeWGS84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == envelopeWGS84MP.GetSpatialReference().GetID());
     }
 }
Exemplo n.º 18
0
 public virtual void Test3DPoint1()
 {
     com.epl.geometry.Point point1     = new com.epl.geometry.Point(10.0, 20.0);
     com.epl.geometry.Point pointEmpty = new com.epl.geometry.Point();
     {
         com.fasterxml.jackson.core.JsonParser pointWebMerc1Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, point1));
         com.epl.geometry.MapGeometry          pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
         NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWebMerc1MP.GetGeometry()).GetX());
         NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWebMerc1MP.GetGeometry()).GetY());
         int srIdOri   = spatialReferenceWebMerc1.GetID();
         int srIdAfter = pointWebMerc1MP.GetSpatialReference().GetID();
         NUnit.Framework.Assert.IsTrue(srIdOri == srIdAfter || srIdAfter == 3857);
         pointWebMerc1Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(null, point1));
         pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
         NUnit.Framework.Assert.IsTrue(null == pointWebMerc1MP.GetSpatialReference());
         string pointEmptyString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, pointEmpty);
         pointWebMerc1Parser = factory.CreateJsonParser(pointEmptyString);
         pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
         NUnit.Framework.Assert.IsTrue(pointWebMerc1MP.GetGeometry().IsEmpty());
         int srIdOri2   = spatialReferenceWebMerc1.GetID();
         int srIdAfter2 = pointWebMerc1MP.GetSpatialReference().GetID();
         NUnit.Framework.Assert.IsTrue(srIdOri2 == srIdAfter2 || srIdAfter2 == 3857);
     }
 }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestPolygon()
        {
            bool bAnswer = true;

            com.epl.geometry.Polygon polygon = new com.epl.geometry.Polygon();
            polygon.StartPath(-97.06138, 32.837);
            polygon.LineTo(-97.06133, 32.836);
            polygon.LineTo(-97.06124, 32.834);
            polygon.LineTo(-97.06127, 32.832);
            polygon.StartPath(-97.06326, 32.759);
            polygon.LineTo(-97.06298, 32.755);
            {
                com.fasterxml.jackson.core.JsonParser polygonPathsWgs84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, polygon));
                com.epl.geometry.MapGeometry          mPolygonWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polygonPathsWgs84Parser);
                NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPointCount());
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetX());
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetY());
                NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPathCount());
                NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount());
                NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(0) == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(0));
                NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(1) + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(1));
                int lastIndex = polygon.GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetX());
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolygonWGS84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(mPolygonWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.Polygon p = new com.epl.geometry.Polygon();
                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,\"rings\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                p.StartPath(0, 0);
                p.LineTo(0, 1);
                p.LineTo(4, 4);
                p.StartPath(2, 2);
                p.LineTo(3, 3);
                p.LineTo(7, 8);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0, 3);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 1, 0, 7);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 2, 0, 5);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 5, 0, 5);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"rings\":[[[0,0,3,null],[0,1,0,7],[4,4,0,5],[0,0,3,null]],[[2,2,0,null],[3,3,0,null],[7,8,0,5],[2,2,0,null]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                // Test Import Polygon from Polygon
                string rings = "{\"hasZ\": true, \"rings\" : [ [ [0,0, 5], [0.0, 10.0, 5], [10.0,10.0, 5, 66666], [10.0,0.0, 5] ], [ [12, 12] ],  [ [13 , 17], [13 , 17] ], [ [1.0, 1.0, 5, 66666], [9.0,1.0, 5], [9.0,9.0, 5], [1.0,9.0, 5], [1.0, 1.0, 5] ] ] }";
                com.epl.geometry.MapGeometry mapGeometry = com.epl.geometry.GeometryEngine.JsonToGeometry(factory.CreateParser(rings));
                com.epl.geometry.Polygon     p           = (com.epl.geometry.Polygon)mapGeometry.GetGeometry();
                double area   = p.CalculateArea2D();
                double length = p.CalculateLength2D();
                NUnit.Framework.Assert.IsTrue(p.GetPathCount() == 4);
                int count = p.GetPointCount();
                NUnit.Framework.Assert.IsTrue(count == 15);
                NUnit.Framework.Assert.IsTrue(p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z));
                NUnit.Framework.Assert.IsTrue(!p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
            }
            return(bAnswer);
        }
 public JsonParserDelegate(com.fasterxml.jackson.core.JsonParser d)
 {
     delegate_ = d;
 }
Exemplo n.º 21
0
        public virtual void TestSpatialRef()
        {
            // String jsonStringPt =
            // "{\"x\":-20037508.342787,\"y\":20037508.342787},\"spatialReference\":{\"wkid\":102100}}";
            string jsonStringPt = "{\"x\":10.0,\"y\":20.0,\"spatialReference\":{\"wkid\": 102100}}";
            // 102100
            string jsonStringPt2 = "{\"x\":10.0,\"y\":20.0,\"spatialReference\":{\"wkid\":4326}}";
            string jsonStringMpt = "{ \"points\" : [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ], \"spatialReference\" : {\"wkid\" : 4326}}";
            // 4326
            string jsonStringMpt3D = "{\"hasZs\" : true,\"points\" : [ [-97.06138,32.837,35.0], [-97.06133,32.836,35.1], [-97.06124,32.834,35.2], [-97.06127,32.832,35.3] ],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPl    = "{\"paths\" : [  [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ],  [ [-97.06326,32.759], [-97.06298,32.755] ]],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPl3D  = "{\"hasMs\" : true,\"paths\" : [[ [-97.06138,32.837,5], [-97.06133,32.836,6], [-97.06124,32.834,7], [-97.06127,32.832,8] ],[ [-97.06326,32.759], [-97.06298,32.755] ]],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPg    = "{ \"rings\" :[  [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ],  [ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]], \"spatialReference\" : {\"wkt\" : \"\"}}";
            string jsonStringPg3D  = "{\"hasZs\" : true,\"hasMs\" : true,\"rings\" : [ [ [-97.06138, 32.837, 35.1, 4], [-97.06133, 32.836, 35.2, 4.1], [-97.06124, 32.834, 35.3, 4.2], [-97.06127, 32.832, 35.2, 44.3], [-97.06138, 32.837, 35.1, 4] ],[ [-97.06326, 32.759, 35.4], [-97.06298, 32.755, 35.5], [-97.06153, 32.749, 35.6], [-97.06326, 32.759, 35.4] ]],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPg2   = "{ \"spatialReference\" : {\"wkid\" : 4326}, \"rings\" : [[[-118.35,32.81],[-118.42,32.806],[-118.511,32.892],[-118.35,32.81]]]}";
            string jsonStringPg3   = "{ \"spatialReference\": {\"layerName\":\"GAS_POINTS\",\"name\":null,\"sdesrid\":102100,\"wkid\":102100,\"wkt\":null}}";
            string jsonString2SpatialReferences  = "{ \"spatialReference\": {\"layerName\":\"GAS_POINTS\",\"name\":null,\"sdesrid\":102100,\"wkid\":102100,\"wkt\":\"GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137,298.257223563]],PRIMEM[\\\"Greenwich\\\",0],UNIT[\\\"Degree\\\",0.017453292519943295]]\"}}";
            string jsonString2SpatialReferences2 = "{ \"spatialReference\": {\"layerName\":\"GAS_POINTS\",\"name\":null,\"sdesrid\":10,\"wkid\":10,\"wkt\":\"GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137,298.257223563]],PRIMEM[\\\"Greenwich\\\",0],UNIT[\\\"Degree\\\",0.017453292519943295]]\"}}";
            string jsonStringSR          = "{\"wkid\" : 4326}";
            string jsonStringEnv         = "{\"xmin\" : -109.55, \"ymin\" : 25.76, \"xmax\" : -86.39, \"ymax\" : 49.94,\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringHongKon     = "{\"xmin\" : -122.55, \"ymin\" : 37.65, \"xmax\" : -122.28, \"ymax\" : 37.84,\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringWKT         = " {\"wkt\" : \"GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137,298.257223563]],PRIMEM[\\\"Greenwich\\\",0],UNIT[\\\"Degree\\\",0.017453292519943295]]\"}";
            string jsonStringInvalidWKID = "{\"x\":10.0,\"y\":20.0},\"spatialReference\":{\"wkid\":35253523}}";
            string jsonStringOregon      = "{\"xmin\":7531831.219849482,\"ymin\":585702.9799639136,\"xmax\":7750143.589982405,\"ymax\":733289.6299999952,\"spatialReference\":{\"wkid\":102726}}";

            com.fasterxml.jackson.core.JsonParser jsonParserPt          = factory.CreateJsonParser(jsonStringPt);
            com.fasterxml.jackson.core.JsonParser jsonParserMpt         = factory.CreateJsonParser(jsonStringMpt);
            com.fasterxml.jackson.core.JsonParser jsonParserMpt3D       = factory.CreateJsonParser(jsonStringMpt3D);
            com.fasterxml.jackson.core.JsonParser jsonParserPl          = factory.CreateJsonParser(jsonStringPl);
            com.fasterxml.jackson.core.JsonParser jsonParserPl3D        = factory.CreateJsonParser(jsonStringPl3D);
            com.fasterxml.jackson.core.JsonParser jsonParserPg          = factory.CreateJsonParser(jsonStringPg);
            com.fasterxml.jackson.core.JsonParser jsonParserPg3D        = factory.CreateJsonParser(jsonStringPg3D);
            com.fasterxml.jackson.core.JsonParser jsonParserPg2         = factory.CreateJsonParser(jsonStringPg2);
            com.fasterxml.jackson.core.JsonParser jsonParserSR          = factory.CreateJsonParser(jsonStringSR);
            com.fasterxml.jackson.core.JsonParser jsonParserEnv         = factory.CreateJsonParser(jsonStringEnv);
            com.fasterxml.jackson.core.JsonParser jsonParserPg3         = factory.CreateJsonParser(jsonStringPg3);
            com.fasterxml.jackson.core.JsonParser jsonParserCrazy1      = factory.CreateJsonParser(jsonString2SpatialReferences);
            com.fasterxml.jackson.core.JsonParser jsonParserCrazy2      = factory.CreateJsonParser(jsonString2SpatialReferences2);
            com.fasterxml.jackson.core.JsonParser jsonParserInvalidWKID = factory.CreateJsonParser(jsonStringInvalidWKID);
            com.fasterxml.jackson.core.JsonParser jsonParseHongKon      = factory.CreateJsonParser(jsonStringHongKon);
            com.fasterxml.jackson.core.JsonParser jsonParseOregon       = factory.CreateJsonParser(jsonStringOregon);
            com.epl.geometry.MapGeometry          mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPt);
            // showProjectedGeometryInfo(mapGeom);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 102100);
            com.epl.geometry.MapGeometry mapGeomOregon = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParseOregon);
            NUnit.Framework.Assert.IsTrue(mapGeomOregon.GetSpatialReference().GetID() == 102726);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserMpt);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserMpt3D);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            {
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(0).GetX() == -97.06138);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(0).GetY() == 32.837);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(3).GetX() == -97.06127);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(3).GetY() == 32.832);
            }
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPl);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPl3D);
            {
                // [[ [-97.06138,32.837,5], [-97.06133,32.836,6],
                // [-97.06124,32.834,7], [-97.06127,32.832,8] ],
                // [ [-97.06326,32.759], [-97.06298,32.755] ]]";
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(0).GetX() == -97.06138);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(0).GetY() == 32.837);
                int lastIndex = ((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndex).GetX() == -97.06298);
                // -97.06153,
                // 32.749
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndex).GetY() == 32.755);
                int lastIndexFirstLine = ((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPathEnd(0) - 1;
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndexFirstLine).GetX() == -97.06127);
                // -97.06153,
                // 32.749
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndexFirstLine).GetY() == 32.832);
            }
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference() == null);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg3D);
            {
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(0).GetX() == -97.06138);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(0).GetY() == 32.837);
                int lastIndex = ((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(lastIndex).GetX() == -97.06153);
                // -97.06153,
                // 32.749
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(lastIndex).GetY() == 32.749);
            }
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg2);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg3);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 102100);
            // showProjectedGeometryInfo(mapGeom);
            // mapGeom = GeometryEngine.jsonToGeometry(jsonParserCrazy1);
            // Assert.assertTrue(mapGeom.getSpatialReference().getText().equals(""));
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserEnv);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            // showProjectedGeometryInfo(mapGeom);
            try
            {
                com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserInvalidWKID);
            }
            catch (System.Exception)
            {
                NUnit.Framework.Assert.IsTrue("Should not throw for invalid wkid", false);
            }
        }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestPolyline()
        {
            bool bAnswer = true;

            com.epl.geometry.Polyline polyline = new com.epl.geometry.Polyline();
            polyline.StartPath(-97.06138, 32.837);
            polyline.LineTo(-97.06133, 32.836);
            polyline.LineTo(-97.06124, 32.834);
            polyline.LineTo(-97.06127, 32.832);
            polyline.StartPath(-97.06326, 32.759);
            polyline.LineTo(-97.06298, 32.755);
            {
                com.fasterxml.jackson.core.JsonParser polylinePathsWgs84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, polyline));
                com.epl.geometry.MapGeometry          mPolylineWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polylinePathsWgs84Parser);
                NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPointCount());
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(0).GetX() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(0).GetX());
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(0).GetY() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(0).GetY());
                NUnit.Framework.Assert.IsTrue(polyline.GetPathCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPathCount());
                NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount());
                NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount(0) == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount(0));
                NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount(1) == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount(1));
                int lastIndex = polyline.GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(lastIndex).GetX() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(lastIndex).GetX());
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(lastIndex).GetY() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(lastIndex).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolylineWGS84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(mPolylineWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.Polyline p = new com.epl.geometry.Polyline();
                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,\"paths\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                p.StartPath(0, 0);
                p.LineTo(0, 1);
                p.StartPath(2, 2);
                p.LineTo(3, 3);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0, 3);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 1, 0, 5);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"paths\":[[[0,0,3,null],[0,1,0,5]],[[2,2,0,null],[3,3,0,null]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                string paths = "{\"hasZ\" : true, \"paths\" : [ [ [0.0, 0.0,3], [0, 10.0,3], [10.0, 10.0,3, 6666], [10.0, 0.0,3, 6666] ], [ [1.0, 1,3], [1.0, 9.0,3], [9.0, 9.0,3], [1.0, 9.0,3] ] ], \"spatialReference\" : {\"wkid\" : 4326}, \"hasM\" : false}";
                com.epl.geometry.MapGeometry mapGeometry = com.epl.geometry.GeometryEngine.JsonToGeometry(factory.CreateParser(paths));
                com.epl.geometry.Polyline    p           = (com.epl.geometry.Polyline)mapGeometry.GetGeometry();
                NUnit.Framework.Assert.IsTrue(p.GetPathCount() == 2);
                int count = p.GetPathCount();
                NUnit.Framework.Assert.IsTrue(p.GetPointCount() == 8);
                NUnit.Framework.Assert.IsTrue(p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z));
                NUnit.Framework.Assert.IsTrue(!p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
                double z = p.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0);
                NUnit.Framework.Assert.IsTrue(z == 3);
                double length = p.CalculateLength2D();
                NUnit.Framework.Assert.IsTrue(System.Math.Abs(length - 54.0) <= 0.001);
                com.epl.geometry.SpatialReference spatial_reference = mapGeometry.GetSpatialReference();
                NUnit.Framework.Assert.IsTrue(spatial_reference.GetID() == 4326);
            }
            return(bAnswer);
        }
Exemplo n.º 23
0
 public JsonParserReader(com.fasterxml.jackson.core.JsonParser jsonParser)
 {
     m_jsonParser = jsonParser;
 }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestPoint()
        {
            bool bAnswer = true;

            com.epl.geometry.Point point1     = new com.epl.geometry.Point(10.0, 20.0);
            com.epl.geometry.Point pointEmpty = new com.epl.geometry.Point();
            {
                com.fasterxml.jackson.core.JsonParser pointWebMerc1Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, point1));
                com.epl.geometry.MapGeometry          pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
                NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWebMerc1MP.GetGeometry()).GetX());
                NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.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.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(null, point1));
                pointWebMerc1MP     = com.epl.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.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, pointEmpty);
                pointWebMerc1Parser = factory.CreateParser(pointEmptyString);
            }
            com.fasterxml.jackson.core.JsonParser pointWebMerc2Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc2, point1));
            com.epl.geometry.MapGeometry          pointWebMerc2MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc2Parser);
            NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWebMerc2MP.GetGeometry()).GetX());
            NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWebMerc2MP.GetGeometry()).GetY());
            NUnit.Framework.Assert.IsTrue(spatialReferenceWebMerc2.GetLatestID() == pointWebMerc2MP.GetSpatialReference().GetLatestID());
            if (!CheckResultSpatialRef(pointWebMerc2MP, spatialReferenceWebMerc2.GetLatestID(), 0))
            {
                bAnswer = false;
            }
            {
                com.fasterxml.jackson.core.JsonParser pointWgs84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, point1));
                com.epl.geometry.MapGeometry          pointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWgs84Parser);
                NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWgs84MP.GetGeometry()).GetX());
                NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWgs84MP.GetGeometry()).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == pointWgs84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(pointWgs84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.Point p = new com.epl.geometry.Point();
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"x\":null,\"y\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                s = com.epl.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.epl.geometry.Point p = new com.epl.geometry.Point(10.0, 20.0, 30.0);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.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}}";
                com.fasterxml.jackson.core.JsonParser parser = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_pt = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Point pt = (com.epl.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}} ";
                com.fasterxml.jackson.core.JsonParser parser = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_pt = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Point pt = (com.epl.geometry.Point)map_pt.GetGeometry();
                NUnit.Framework.Assert.IsTrue(pt.IsEmpty());
                com.epl.geometry.SpatialReference spatial_reference = map_pt.GetSpatialReference();
                NUnit.Framework.Assert.IsTrue(spatial_reference.GetID() == 4326);
            }
            return(bAnswer);
        }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestEnvelope()
        {
            bool bAnswer = true;

            com.epl.geometry.Envelope envelope = new com.epl.geometry.Envelope();
            envelope.SetCoords(-109.55, 25.76, -86.39, 49.94);
            {
                com.fasterxml.jackson.core.JsonParser envelopeWGS84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, envelope));
                com.epl.geometry.MapGeometry          envelopeWGS84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(envelopeWGS84Parser);
                NUnit.Framework.Assert.IsTrue(envelope.IsEmpty() == envelopeWGS84MP.GetGeometry().IsEmpty());
                NUnit.Framework.Assert.IsTrue(envelope.GetXMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMax());
                NUnit.Framework.Assert.IsTrue(envelope.GetYMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMax());
                NUnit.Framework.Assert.IsTrue(envelope.GetXMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMin());
                NUnit.Framework.Assert.IsTrue(envelope.GetYMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMin());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == envelopeWGS84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(envelopeWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                // export
                com.epl.geometry.Envelope e = new com.epl.geometry.Envelope();
                e.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                e.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, e);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"xmin\":null,\"ymin\":null,\"xmax\":null,\"ymax\":null,\"zmin\":null,\"zmax\":null,\"mmin\":null,\"mmax\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                e.SetCoords(0, 1, 2, 3);
                com.epl.geometry.Envelope1D z = new com.epl.geometry.Envelope1D();
                com.epl.geometry.Envelope1D m = new com.epl.geometry.Envelope1D();
                z.SetCoords(5, 7);
                m.SetCoords(11, 13);
                e.SetInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0, z);
                e.SetInterval(com.epl.geometry.VertexDescription.Semantics.M, 0, m);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, e);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"xmin\":0,\"ymin\":1,\"xmax\":2,\"ymax\":3,\"zmin\":5,\"zmax\":7,\"mmin\":11,\"mmax\":13,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                // import
                string s = "{\"xmin\":0.0,\"ymin\":1.0,\"xmax\":2.0,\"ymax\":3.0,\"zmin\":5.0,\"zmax\":7.0,\"mmin\":11.0,\"mmax\":13.0,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}";
                com.fasterxml.jackson.core.JsonParser parser  = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_env = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Envelope             env     = (com.epl.geometry.Envelope)map_env.GetGeometry();
                com.epl.geometry.Envelope1D           z       = env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0);
                com.epl.geometry.Envelope1D           m       = env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.M, 0);
                NUnit.Framework.Assert.IsTrue(z.vmin == 5.0);
                NUnit.Framework.Assert.IsTrue(z.vmax == 7.0);
                NUnit.Framework.Assert.IsTrue(m.vmin == 11.0);
                NUnit.Framework.Assert.IsTrue(m.vmax == 13.0);
            }
            {
                string s = "{ \"zmin\" : 33, \"xmin\" : -109.55, \"zmax\" : 53, \"ymin\" : 25.76, \"xmax\" : -86.39, \"ymax\" : 49.94, \"mmax\" : 13}";
                com.fasterxml.jackson.core.JsonParser parser  = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_env = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Envelope             env     = (com.epl.geometry.Envelope)map_env.GetGeometry();
                com.epl.geometry.Envelope2D           e       = new com.epl.geometry.Envelope2D();
                env.QueryEnvelope2D(e);
                NUnit.Framework.Assert.IsTrue(e.xmin == -109.55 && e.ymin == 25.76 && e.xmax == -86.39 && e.ymax == 49.94);
                com.epl.geometry.Envelope1D e1D;
                NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z));
                e1D = env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0);
                NUnit.Framework.Assert.IsTrue(e1D.vmin == 33 && e1D.vmax == 53);
                NUnit.Framework.Assert.IsTrue(!env.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
            }
            return(bAnswer);
        }