コード例 #1
0
 public virtual void TestPt()
 {
     com.epl.geometry.Point pt = new com.epl.geometry.Point();
     NUnit.Framework.Assert.IsTrue(pt.IsEmpty());
     pt.SetXY(10, 2);
     NUnit.Framework.Assert.IsFalse(pt.IsEmpty());
     pt.ToString();
 }
コード例 #2
0
        // recalculate coordinates of the vertices by averaging them using weights.
        // return true if the coordinates has changed.
        internal static bool MergeVertices(com.epl.geometry.Point pt_1, com.epl.geometry.Point pt_2, double w_1, int rank_1, double w_2, int rank_2, com.epl.geometry.Point pt_res, double[] w_res, int[] rank_res)
        {
            System.Diagnostics.Debug.Assert((!pt_1.IsEmpty() && !pt_2.IsEmpty()));
            bool res = pt_1.Equals(pt_2);

            if (rank_1 > rank_2)
            {
                pt_res = pt_1;
                if (w_res != null)
                {
                    rank_res[0] = rank_1;
                    w_res[0]    = w_1;
                }
                return(res);
            }
            else
            {
                if (rank_2 > rank_1)
                {
                    pt_res = pt_2;
                    if (w_res != null)
                    {
                        rank_res[0] = rank_1;
                        w_res[0]    = w_1;
                    }
                    return(res);
                }
            }
            pt_res = pt_1;
            com.epl.geometry.Point2D pt2d = new com.epl.geometry.Point2D();
            MergeVertices2D(pt_1.GetXY(), pt_2.GetXY(), w_1, rank_1, w_2, rank_2, pt2d, w_res, rank_res);
            pt_res.SetXY(pt2d);
            return(res);
        }
コード例 #3
0
        internal static void ExportPointToWkt(int export_flags, com.epl.geometry.Point point, System.Text.StringBuilder @string)
        {
            int    precision   = 17 - (7 & (export_flags >> 13));
            bool   b_export_zs = point.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z) && (export_flags & com.epl.geometry.WktExportFlags.wktExportStripZs) == 0;
            bool   b_export_ms = point.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M) && (export_flags & com.epl.geometry.WktExportFlags.wktExportStripMs) == 0;
            double x           = com.epl.geometry.NumberUtils.TheNaN;
            double y           = com.epl.geometry.NumberUtils.TheNaN;
            double z           = com.epl.geometry.NumberUtils.TheNaN;
            double m           = com.epl.geometry.NumberUtils.TheNaN;

            if (!point.IsEmpty())
            {
                x = point.GetX();
                y = point.GetY();
                if (b_export_zs)
                {
                    z = point.GetZ();
                }
                if (b_export_ms)
                {
                    m = point.GetM();
                }
            }
            if ((export_flags & com.epl.geometry.WktExportFlags.wktExportMultiPoint) != 0)
            {
                MultiPointTaggedTextFromPoint_(precision, b_export_zs, b_export_ms, x, y, z, m, @string);
            }
            else
            {
                PointTaggedText_(precision, b_export_zs, b_export_ms, x, y, z, m, @string);
            }
        }
コード例 #4
0
 internal virtual void _interpolateTwoVertices(int vertex1, int vertex2, double f, com.epl.geometry.Point outPoint)
 {
     if (vertex1 < 0 || vertex1 >= m_pointCount)
     {
         throw new com.epl.geometry.GeometryException("index out of bounds.");
     }
     if (vertex2 < 0 || vertex2 >= m_pointCount)
     {
         throw new com.epl.geometry.GeometryException("index out of bounds.");
     }
     // _ASSERT(!IsEmpty());
     // _ASSERT(m_vertexAttributes != NULLPTR);
     _verifyAllStreams();
     outPoint.AssignVertexDescription(m_description);
     if (outPoint.IsEmpty())
     {
         outPoint._setToDefault();
     }
     for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
     {
         int semantics = m_description._getSemanticsImpl(attributeIndex);
         for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++)
         {
             double v1 = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * vertex1 + icomp);
             double v2 = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * vertex2 + icomp);
             outPoint.SetAttribute(semantics, icomp, com.epl.geometry.MathUtils.Lerp(v1, v2, f));
         }
     }
 }
コード例 #5
0
 public override void GetPointByVal(int index, com.epl.geometry.Point dst)
 {
     if (index < 0 || index >= m_pointCount)
     {
         // TODO
         throw new com.epl.geometry.GeometryException("index out of bounds");
     }
     // _ASSERT(!IsEmpty());
     // _ASSERT(m_vertexAttributes != null);
     _verifyAllStreams();
     com.epl.geometry.Point outPoint = dst;
     outPoint.AssignVertexDescription(m_description);
     if (outPoint.IsEmpty())
     {
         outPoint._setToDefault();
     }
     for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
     {
         // fix semantics
         int semantics = m_description._getSemanticsImpl(attributeIndex);
         // VertexDescription.getComponentCount(semantics);
         for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++)
         {
             double v = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * index + icomp);
             outPoint.SetAttribute(semantics, icomp, v);
         }
     }
 }
コード例 #6
0
 public override void SetPointByVal(int index, com.epl.geometry.Point src)
 {
     if (index < 0 || index >= m_pointCount)
     {
         throw new com.epl.geometry.GeometryException("index out of bounds");
     }
     com.epl.geometry.Point point = src;
     if (src.IsEmpty())
     {
         // can not assign an empty point to a multipoint
         // vertex
         throw new System.ArgumentException();
     }
     _verifyAllStreams();
     // verify all allocated streams are of necessary
     // size.
     com.epl.geometry.VertexDescription vdin = point.GetDescription();
     for (int attributeIndex = 0; attributeIndex < vdin.GetAttributeCount(); attributeIndex++)
     {
         int semantics = vdin._getSemanticsImpl(attributeIndex);
         int ncomp     = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
         for (int icomp = 0; icomp < ncomp; icomp++)
         {
             double v = point.GetAttributeAsDbl(semantics, icomp);
             SetAttribute(semantics, index, icomp, v);
         }
     }
 }
コード例 #7
0
 /// <exception cref="java.io.ObjectStreamException"/>
 public virtual void SetGeometryByValue(com.epl.geometry.Point point)
 {
     try
     {
         attribs = null;
         if (point == null)
         {
             descriptionBitMask = 1;
         }
         com.epl.geometry.VertexDescription vd = point.GetDescription();
         descriptionBitMask = vd.m_semanticsBitArray;
         if (point.IsEmpty())
         {
             return;
         }
         attribs    = new double[vd.GetTotalComponentCount()];
         attribs[0] = point.GetX();
         attribs[1] = point.GetY();
         int index = 2;
         for (int i = 1, n = vd.GetAttributeCount(); i < n; i++)
         {
             int semantics = vd.GetSemantics(i);
             int comps     = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
             for (int ord = 0; ord < comps; ord++)
             {
                 attribs[index++] = point.GetAttributeAsDbl(semantics, ord);
             }
         }
     }
     catch (System.Exception)
     {
         throw new System.IO.InvalidDataException("Cannot serialize this geometry");
     }
 }
コード例 #8
0
 public static int IsPointInPolygon(com.epl.geometry.Polygon inputPolygon, com.epl.geometry.Point inputPoint, double tolerance)
 {
     if (inputPoint.IsEmpty())
     {
         return(0);
     }
     return(IsPointInPolygon(inputPolygon, inputPoint.GetXY(), tolerance));
 }
コード例 #9
0
 /// <summary>Checks if this envelope contains (covers) the specified point.</summary>
 /// <param name="p">The Point to be tested for coverage.</param>
 /// <returns>TRUE if this envelope contains (covers) the specified point.</returns>
 public virtual bool Contains(com.epl.geometry.Point p)
 {
     if (p.IsEmpty())
     {
         return(false);
     }
     return(m_envelope.Contains(p.GetX(), p.GetY()));
 }
コード例 #10
0
        private static void ExportPointToJson(com.epl.geometry.Point pt, com.epl.geometry.SpatialReference spatialReference, com.epl.geometry.JsonWriter jsonWriter, System.Collections.Generic.IDictionary <string, object> exportProperties)
        {
            bool bExportZs    = pt.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
            bool bExportMs    = pt.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 (pt.IsEmpty())
            {
                jsonWriter.AddPairNull("x");
                jsonWriter.AddPairNull("y");
                if (bExportZs)
                {
                    jsonWriter.AddPairNull("z");
                }
                if (bExportMs)
                {
                    jsonWriter.AddPairNull("m");
                }
            }
            else
            {
                if (bPositionAsF)
                {
                    jsonWriter.AddPairDouble("x", pt.GetX(), decimals, true);
                    jsonWriter.AddPairDouble("y", pt.GetY(), decimals, true);
                }
                else
                {
                    jsonWriter.AddPairDouble("x", pt.GetX());
                    jsonWriter.AddPairDouble("y", pt.GetY());
                }
                if (bExportZs)
                {
                    jsonWriter.AddPairDouble("z", pt.GetZ());
                }
                if (bExportMs)
                {
                    jsonWriter.AddPairDouble("m", pt.GetM());
                }
            }
            if (spatialReference != null)
            {
                WriteSR(spatialReference, jsonWriter);
            }
            jsonWriter.EndObject();
        }
コード例 #11
0
 /// <summary>
 /// Sets the envelope's corners to be centered around the specified point,
 /// using its center, width, and height.
 /// </summary>
 /// <param name="c">The point around which to center the envelope.</param>
 /// <param name="w">The width to be set for the envelope.</param>
 /// <param name="h">The height to be set for this envelope.</param>
 public virtual void CenterAt(com.epl.geometry.Point c, double w, double h)
 {
     _touch();
     if (c.IsEmpty())
     {
         SetEmpty();
         return;
     }
     _setFromPoint(c, w, h);
 }
コード例 #12
0
 /// <summary>Constructs an envelope that covers the given point.</summary>
 /// <remarks>
 /// Constructs an envelope that covers the given point. The coordinates of
 /// the point are used to set the extent of the envelope.
 /// </remarks>
 /// <param name="point">The point that the envelope covers.</param>
 public Envelope(com.epl.geometry.Point point)
 {
     m_description = com.epl.geometry.VertexDescriptionDesignerImpl.GetDefaultDescriptor2D();
     m_envelope.SetEmpty();
     if (point.IsEmpty())
     {
         return;
     }
     _setFromPoint(point);
 }
コード例 #13
0
 /// <summary>
 /// Centers the envelope around the specified point preserving the envelope's
 /// width and height.
 /// </summary>
 /// <param name="c">The new center point.</param>
 public virtual void CenterAt(com.epl.geometry.Point c)
 {
     _touch();
     if (c.IsEmpty())
     {
         SetEmpty();
         return;
     }
     m_envelope.CenterAt(c.GetX(), c.GetY());
 }
コード例 #14
0
 /// <summary>Creates an envelope by defining its center, width, and height.</summary>
 /// <param name="center">The center point of the envelope.</param>
 /// <param name="width">The width of the envelope.</param>
 /// <param name="height">The height of the envelope.</param>
 public Envelope(com.epl.geometry.Point center, double width, double height)
 {
     //We are using writeReplace instead.
     //private static final long serialVersionUID = 2L;
     // use doubles to store everything
     m_description = com.epl.geometry.VertexDescriptionDesignerImpl.GetDefaultDescriptor2D();
     m_envelope.SetEmpty();
     if (center.IsEmpty())
     {
         return;
     }
     _setFromPoint(center, width, height);
 }
コード例 #15
0
        // Mirrors wkt
        private static void ExportPointToGeoJson_(int export_flags, com.epl.geometry.Point point, com.epl.geometry.JsonWriter json_writer)
        {
            int  precision   = 17 - (31 & (export_flags >> 13));
            bool bFixedPoint = (com.epl.geometry.GeoJsonExportFlags.geoJsonExportPrecisionFixedPoint & export_flags) != 0;
            bool b_export_zs = point.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z) && (export_flags & com.epl.geometry.GeoJsonExportFlags.geoJsonExportStripZs) == 0;
            bool b_export_ms = point.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M) && (export_flags & com.epl.geometry.GeoJsonExportFlags.geoJsonExportStripMs) == 0;

            if (!b_export_zs && b_export_ms)
            {
                throw new System.ArgumentException("invalid argument");
            }
            double x = com.epl.geometry.NumberUtils.NaN();
            double y = com.epl.geometry.NumberUtils.NaN();
            double z = com.epl.geometry.NumberUtils.NaN();
            double m = com.epl.geometry.NumberUtils.NaN();

            if (!point.IsEmpty())
            {
                x = point.GetX();
                y = point.GetY();
                if (b_export_zs)
                {
                    z = point.GetZ();
                }
                if (b_export_ms)
                {
                    m = point.GetM();
                }
            }
            if ((export_flags & com.epl.geometry.GeoJsonExportFlags.geoJsonExportPreferMultiGeometry) == 0)
            {
                PointTaggedText_(precision, bFixedPoint, b_export_zs, b_export_ms, x, y, z, m, json_writer);
            }
            else
            {
                MultiPointTaggedTextFromPoint_(precision, bFixedPoint, b_export_zs, b_export_ms, x, y, z, m, json_writer);
            }
        }
コード例 #16
0
 // ////////////////// METHODS To REMOVE ///////////////////////
 public override com.epl.geometry.Point GetPoint(int index)
 {
     if (index < 0 || index >= m_pointCount)
     {
         throw new System.IndexOutOfRangeException();
     }
     _verifyAllStreams();
     com.epl.geometry.Point outPoint = new com.epl.geometry.Point();
     outPoint.AssignVertexDescription(m_description);
     if (outPoint.IsEmpty())
     {
         outPoint._setToDefault();
     }
     for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
     {
         int semantics = m_description.GetSemantics(attributeIndex);
         for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++)
         {
             double v = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * index + icomp);
             outPoint.SetAttribute(semantics, icomp, v);
         }
     }
     return(outPoint);
 }
コード例 #17
0
        private static int ExportPointToESRIShape(int exportFlags, com.epl.geometry.Point point, System.IO.BinaryWriter shapeBuffer)
        {
            bool bExportZ     = point.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z) && (exportFlags & com.epl.geometry.ShapeExportFlags.ShapeExportStripZs) == 0;
            bool bExportM     = point.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M) && (exportFlags & com.epl.geometry.ShapeExportFlags.ShapeExportStripMs) == 0;
            bool bExportID    = point.HasAttribute(com.epl.geometry.VertexDescription.Semantics.ID) && (exportFlags & com.epl.geometry.ShapeExportFlags.ShapeExportStripIDs) == 0;
            bool bArcViewNaNs = (exportFlags & com.epl.geometry.ShapeExportFlags.ShapeExportTrueNaNs) == 0;
            int  size         = (4) + (2 * 8);

            /* type */
            /* xy coordinate */
            if (bExportZ)
            {
                size += 8;
            }
            if (bExportM)
            {
                size += 8;
            }
            if (bExportID)
            {
                size += 4;
            }
            if (shapeBuffer == null)
            {
                return(size);
            }
            else
            {
                if (((System.IO.MemoryStream)shapeBuffer.BaseStream).Capacity < size)
                {
                    throw new com.epl.geometry.GeometryException("buffer is too small");
                }
            }
            int type;

            // Determine the shape type
            if (!bExportZ && !bExportM)
            {
                if (bExportID)
                {
                    type = com.epl.geometry.ShapeType.ShapeGeneralPoint | com.epl.geometry.ShapeModifiers.ShapeHasIDs;
                }
                else
                {
                    type = com.epl.geometry.ShapeType.ShapePoint;
                }
            }
            else
            {
                if (bExportZ && !bExportM)
                {
                    if (bExportID)
                    {
                        type = com.epl.geometry.ShapeType.ShapeGeneralPoint | com.epl.geometry.ShapeModifiers.ShapeHasZs | com.epl.geometry.ShapeModifiers.ShapeHasIDs;
                    }
                    else
                    {
                        type = com.epl.geometry.ShapeType.ShapePointZ;
                    }
                }
                else
                {
                    if (bExportM && !bExportZ)
                    {
                        if (bExportID)
                        {
                            type = com.epl.geometry.ShapeType.ShapeGeneralPoint | com.epl.geometry.ShapeModifiers.ShapeHasMs | com.epl.geometry.ShapeModifiers.ShapeHasIDs;
                        }
                        else
                        {
                            type = com.epl.geometry.ShapeType.ShapePointM;
                        }
                    }
                    else
                    {
                        if (bExportID)
                        {
                            type = com.epl.geometry.ShapeType.ShapeGeneralPoint | com.epl.geometry.ShapeModifiers.ShapeHasZs | com.epl.geometry.ShapeModifiers.ShapeHasMs | com.epl.geometry.ShapeModifiers.ShapeHasIDs;
                        }
                        else
                        {
                            type = com.epl.geometry.ShapeType.ShapePointZM;
                        }
                    }
                }
            }
            int offset = 0;

            // write type
            shapeBuffer.Write(type);
            offset += 4;
            bool bEmpty = point.IsEmpty();
            // write xy
            double x = !bEmpty?point.GetX() : com.epl.geometry.NumberUtils.NaN();

            double y = !bEmpty?point.GetY() : com.epl.geometry.NumberUtils.NaN();

            shapeBuffer.Write(bArcViewNaNs ? com.epl.geometry.Interop.TranslateToAVNaN(x) : x);
            offset += 8;
            shapeBuffer.Write(bArcViewNaNs ? com.epl.geometry.Interop.TranslateToAVNaN(y) : y);
            offset += 8;
            // write Z
            if (bExportZ)
            {
                double z = !bEmpty?point.GetZ() : com.epl.geometry.NumberUtils.NaN();

                shapeBuffer.Write(bArcViewNaNs ? com.epl.geometry.Interop.TranslateToAVNaN(z) : z);
                offset += 8;
            }
            // WriteM
            if (bExportM)
            {
                double m = !bEmpty?point.GetM() : com.epl.geometry.NumberUtils.NaN();

                shapeBuffer.Write(bArcViewNaNs ? com.epl.geometry.Interop.TranslateToAVNaN(m) : m);
                offset += 8;
            }
            // write ID
            if (bExportID)
            {
                int id = !bEmpty?point.GetID() : 0;

                shapeBuffer.Write(id);
                offset += 4;
            }
            return(offset);
        }
コード例 #18
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);
     }
 }
コード例 #19
0
        public static void TestDifferenceAndSymmetricDifference()
        {
            com.epl.geometry.OperatorFactoryLocal engine       = com.epl.geometry.OperatorFactoryLocal.GetInstance();
            com.epl.geometry.OperatorDifference   differenceOp = (com.epl.geometry.OperatorDifference)engine.GetOperator(com.epl.geometry.Operator.Type.Difference);
            com.epl.geometry.SpatialReference     spatialRef   = com.epl.geometry.SpatialReference.Create(102113);
            com.epl.geometry.Polygon    polygon1      = MakePolygon1();
            com.epl.geometry.Polygon    polygon2      = MakePolygon2();
            com.epl.geometry.Polyline   polyline1     = MakePolyline1();
            com.epl.geometry.MultiPoint multipoint1   = MakeMultiPoint1();
            com.epl.geometry.MultiPoint multipoint2   = MakeMultiPoint2();
            com.epl.geometry.MultiPoint multipoint3   = MakeMultiPoint3();
            com.epl.geometry.Point      point1        = MakePoint1();
            com.epl.geometry.Point      point2        = MakePoint2();
            com.epl.geometry.Envelope   envelope1     = MakeEnvelope1();
            com.epl.geometry.Envelope   envelope2     = MakeEnvelope2();
            com.epl.geometry.Envelope   envelope3     = MakeEnvelope3();
            com.epl.geometry.Polygon    outputPolygon = (com.epl.geometry.Polygon)differenceOp.Execute(polygon1, polygon2, spatialRef, null);
            double area = outputPolygon.CalculateArea2D();

            NUnit.Framework.Assert.IsTrue(System.Math.Abs(area - 75) <= 0.001);
            {
                com.epl.geometry.Point            point_1        = new com.epl.geometry.Point(-130, 10);
                com.epl.geometry.Point            point_2        = new com.epl.geometry.Point(-130, 10);
                com.epl.geometry.Geometry         baseGeom       = new com.epl.geometry.Point(point_1.GetX(), point_1.GetY());
                com.epl.geometry.Geometry         comparisonGeom = new com.epl.geometry.Point(point_2.GetX(), point2.GetY());
                com.epl.geometry.SpatialReference sr             = com.epl.geometry.SpatialReference.Create(4326);
                com.epl.geometry.Geometry         geom           = differenceOp.Execute(baseGeom, comparisonGeom, sr, null);
            }
            com.epl.geometry.OperatorSymmetricDifference symDifferenceOp = (com.epl.geometry.OperatorSymmetricDifference)engine.GetOperator(com.epl.geometry.Operator.Type.SymmetricDifference);
            outputPolygon = (com.epl.geometry.Polygon)symDifferenceOp.Execute(polygon1, polygon2, spatialRef, null);
            area          = outputPolygon.CalculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.Abs(area - 150) <= 0.001);
            com.epl.geometry.Polyline outputPolyline = (com.epl.geometry.Polyline)differenceOp.Execute(polyline1, polygon1, spatialRef, null);
            double length = outputPolyline.CalculateLength2D();

            NUnit.Framework.Assert.IsTrue(System.Math.Abs(length * length - 50) < 0.001);
            com.epl.geometry.MultiPoint outputMultiPoint = (com.epl.geometry.MultiPoint)differenceOp.Execute(multipoint1, polygon1, spatialRef, null);
            int pointCount = outputMultiPoint.GetPointCount();

            NUnit.Framework.Assert.IsTrue(pointCount == 1);
            outputMultiPoint = (com.epl.geometry.MultiPoint)(symDifferenceOp.Execute(multipoint1, point1, spatialRef, null));
            pointCount       = outputMultiPoint.GetPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 2);
            outputMultiPoint = (com.epl.geometry.MultiPoint)(symDifferenceOp.Execute(multipoint1, point2, spatialRef, null));
            pointCount       = outputMultiPoint.GetPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 4);
            outputMultiPoint = (com.epl.geometry.MultiPoint)(differenceOp.Execute(multipoint1, point1, spatialRef, null));
            pointCount       = outputMultiPoint.GetPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 2);
            outputMultiPoint = (com.epl.geometry.MultiPoint)(differenceOp.Execute(multipoint1, point2, spatialRef, null));
            pointCount       = outputMultiPoint.GetPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 3);
            outputPolygon = (com.epl.geometry.Polygon)(differenceOp.Execute(polygon1, envelope1, spatialRef, null));
            area          = outputPolygon.CalculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.Abs(area - 75) <= 0.001);
            outputPolygon = (com.epl.geometry.Polygon)(differenceOp.Execute(polygon2, envelope2, spatialRef, null));
            area          = outputPolygon.CalculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.Abs(area - 75) <= 0.001);
            outputPolyline = (com.epl.geometry.Polyline)(differenceOp.Execute(polyline1, envelope2, spatialRef, null));
            length         = outputPolyline.CalculateLength2D();
            NUnit.Framework.Assert.IsTrue(System.Math.Abs(length * length - 50) <= 0.001);
            outputMultiPoint = (com.epl.geometry.MultiPoint)(differenceOp.Execute(multipoint1, envelope2, spatialRef, null));
            pointCount       = outputMultiPoint.GetPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 1);
            outputMultiPoint = (com.epl.geometry.MultiPoint)(differenceOp.Execute(multipoint2, envelope2, spatialRef, null));
            pointCount       = outputMultiPoint.GetPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 6);
            outputMultiPoint = (com.epl.geometry.MultiPoint)(differenceOp.Execute(multipoint3, envelope2, spatialRef, null));
            pointCount       = outputMultiPoint.GetPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 0);
            com.epl.geometry.Point outputPoint = (com.epl.geometry.Point)(differenceOp.Execute(point1, envelope2, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(!outputPoint.IsEmpty());
            outputPoint = (com.epl.geometry.Point)(differenceOp.Execute(point2, envelope2, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPoint.IsEmpty());
            outputPolygon = (com.epl.geometry.Polygon)(differenceOp.Execute(envelope3, envelope2, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPolygon != null && outputPolygon.IsEmpty());
            outputPolygon = (com.epl.geometry.Polygon)(symDifferenceOp.Execute(envelope3, envelope3, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPolygon != null && outputPolygon.IsEmpty());
            outputPoint = (com.epl.geometry.Point)(differenceOp.Execute(point1, polygon1, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPoint != null);
        }
        /// <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);
        }