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();
        }
Ejemplo n.º 2
0
        public void CenterAt(com.epl.geometry.Point c)
        {
            double cx = (xmax - xmin) / 2d;
            double cy = (ymax - ymin) / 2d;

            xmin = c.GetX() - cx;
            xmax = c.GetX() + cx;
            ymin = c.GetY() - cy;
            ymax = c.GetY() + cy;
        }
Ejemplo n.º 3
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");
     }
 }
Ejemplo n.º 4
0
        public virtual void TestPointAndPolyline1()
        {
            com.epl.geometry.Point    basePl = new com.epl.geometry.Point(-116, 20);
            com.epl.geometry.Polyline compPl = new com.epl.geometry.Polyline();
            compPl.StartPath(new com.epl.geometry.Point(-116, 20));
            compPl.LineTo(new com.epl.geometry.Point(-131, 10));
            compPl.LineTo(new com.epl.geometry.Point(-121, 50));
            int noException = 1;

            // no exception
            com.epl.geometry.Geometry intersectGeom = null;
            try
            {
                intersectGeom = com.epl.geometry.GeometryEngine.Intersect(basePl, compPl, com.epl.geometry.SpatialReference.Create(4326));
            }
            catch (System.Exception)
            {
                noException = 0;
            }
            NUnit.Framework.Assert.AreEqual(noException, 1);
            NUnit.Framework.Assert.IsNotNull(intersectGeom);
            NUnit.Framework.Assert.IsTrue(intersectGeom.GetType() == com.epl.geometry.Geometry.Type.Point);
            com.epl.geometry.Point ip = (com.epl.geometry.Point)intersectGeom;
            NUnit.Framework.Assert.AreEqual(ip.GetX(), -116, 0.1E7);
            NUnit.Framework.Assert.AreEqual(ip.GetY(), 20, 0.1E7);
        }
        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);
            }
        }
Ejemplo n.º 6
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()));
 }
Ejemplo n.º 7
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());
 }
Ejemplo 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());
     }
 }
 public virtual void TestSerializePoint()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.Point        pt        = new com.epl.geometry.Point(10, 40);
         oo.WriteObject(pt);
         System.IO.BinaryWriter    streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.Point    ptRes    = (com.epl.geometry.Point)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         Fail("Point serialization failure");
     }
     //try
     //{
     //FileOutputStream streamOut = new FileOutputStream("c:/temp/savedPoint1.txt");
     //ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     //Point pt = new Point(10, 40, 2);
     //oo.writeObject(pt);
     //}
     //catch(Exception ex)
     //{
     //fail("Point serialization failure");
     //}
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPoint.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Point    ptRes = (com.epl.geometry.Point)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetX() == 10 && ptRes.GetY() == 40);
     }
     catch (System.Exception)
     {
         Fail("Point serialization failure");
     }
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPoint1.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Point    ptRes = (com.epl.geometry.Point)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetX() == 10 && ptRes.GetY() == 40 && ptRes.GetZ() == 2);
     }
     catch (System.Exception)
     {
         Fail("Point serialization failure");
     }
 }
Ejemplo n.º 10
0
 public static void TestCopy()
 {
     com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint();
     com.epl.geometry.Point      pt0    = new com.epl.geometry.Point(0.0, 0.0, -1.0);
     com.epl.geometry.Point      pt1    = new com.epl.geometry.Point(0.0, 0.0, 1.0);
     com.epl.geometry.Point      pt2    = new com.epl.geometry.Point(0.0, 1.0, 1.0);
     mpoint.Add(pt0);
     mpoint.Add(pt1);
     mpoint.Add(pt2);
     mpoint.RemovePoint(1);
     com.epl.geometry.MultiPoint mpCopy = (com.epl.geometry.MultiPoint)mpoint.Copy();
     NUnit.Framework.Assert.IsTrue(mpCopy.Equals(mpoint));
     com.epl.geometry.Point pt;
     pt = mpCopy.GetPoint(0);
     NUnit.Framework.Assert.IsTrue(pt.GetX() == pt0.GetX() && pt.GetY() == pt0.GetY());
     pt = mpCopy.GetPoint(1);
     NUnit.Framework.Assert.IsTrue(pt.GetX() == pt2.GetX() && pt.GetY() == pt2.GetY());
     NUnit.Framework.Assert.IsTrue(mpCopy.GetPointCount() == 2);
 }
Ejemplo n.º 11
0
        internal virtual com.epl.geometry.Point _RandomizeExisting()
        {
            if (points.Count == 0)
            {
                return(_GenerateNewPoint());
            }
            double f   = random.NextDouble();
            int    num = (int)(f * points.Count);

            com.epl.geometry.Point pt = points[num];
            f = random.NextDouble();
            // if (f > 0.9)
            if (f > 2)
            {
                f = random.NextDouble();
                pt.SetX(pt.GetX() + (1 - 2 * f) * 2 * tolerance);
                f = random.NextDouble();
                pt.SetY(pt.GetY() + (1 - 2 * f) * 2 * tolerance);
                pt = _snapClip(pt, env);
            }
            return(pt);
        }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
0
        internal virtual com.epl.geometry.Point _snapClip(com.epl.geometry.Point pt, com.epl.geometry.Envelope env)
        {
            double x = pt.GetX();

            if (x < env.GetXMin())
            {
                x = env.GetXMin();
            }
            if (x > env.GetXMax())
            {
                x = env.GetXMax();
            }
            double y = pt.GetY();

            if (y < env.GetYMin())
            {
                y = env.GetYMin();
            }
            if (y > env.GetYMax())
            {
                y = env.GetYMax();
            }
            return(new com.epl.geometry.Point(x, y));
        }
Ejemplo n.º 14
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);
     }
 }
        internal static double GeodesicDistanceOnWGS84Impl(com.epl.geometry.Point ptFrom, com.epl.geometry.Point ptTo)
        {
            double a = 6378137.0;
            // radius of spheroid for WGS_1984
            double e2 = 0.0066943799901413165;
            // ellipticity for WGS_1984
            double rpu = System.Math.PI / 180.0;

            com.epl.geometry.PeDouble answer = new com.epl.geometry.PeDouble();
            com.epl.geometry.GeoDist.Geodesic_distance_ngs(a, e2, ptFrom.GetX() * rpu, ptFrom.GetY() * rpu, ptTo.GetX() * rpu, ptTo.GetY() * rpu, answer, null, null);
            return(answer.val);
        }
Ejemplo n.º 16
0
 public bool Contains(com.epl.geometry.Point p)
 {
     return(Contains(p.GetX(), p.GetY()));
 }
Ejemplo n.º 17
0
 private static void ShowProjectedGeometryInfo(com.epl.geometry.MapGeometry mapGeom)
 {
     System.Console.Out.WriteLine("\n");
     com.epl.geometry.MapGeometry geom = mapGeom;
     // while ((geom = geomCursor.next()) != null) {
     if (geom.GetGeometry() is com.epl.geometry.Point)
     {
         com.epl.geometry.Point pnt = (com.epl.geometry.Point)geom.GetGeometry();
         System.Console.Out.WriteLine("Point(" + pnt.GetX() + " , " + pnt.GetY() + ")");
         if (geom.GetSpatialReference() == null)
         {
             System.Console.Out.WriteLine("No spatial reference");
         }
         else
         {
             System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
         }
     }
     else
     {
         if (geom.GetGeometry() is com.epl.geometry.MultiPoint)
         {
             com.epl.geometry.MultiPoint mp = (com.epl.geometry.MultiPoint)geom.GetGeometry();
             System.Console.Out.WriteLine("Multipoint has " + mp.GetPointCount() + " points.");
             System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
         }
         else
         {
             if (geom.GetGeometry() is com.epl.geometry.Polygon)
             {
                 com.epl.geometry.Polygon mp = (com.epl.geometry.Polygon)geom.GetGeometry();
                 System.Console.Out.WriteLine("Polygon has " + mp.GetPointCount() + " points and " + mp.GetPathCount() + " parts.");
                 if (mp.GetPathCount() > 1)
                 {
                     System.Console.Out.WriteLine("Part start of 2nd segment : " + mp.GetPathStart(1));
                     System.Console.Out.WriteLine("Part end of 2nd segment   : " + mp.GetPathEnd(1));
                     System.Console.Out.WriteLine("Part size of 2nd segment  : " + mp.GetPathSize(1));
                     int start = mp.GetPathStart(1);
                     int end   = mp.GetPathEnd(1);
                     for (int i = start; i < end; i++)
                     {
                         com.epl.geometry.Point pp = mp.GetPoint(i);
                         System.Console.Out.WriteLine("Point(" + i + ") = (" + pp.GetX() + ", " + pp.GetY() + ")");
                     }
                 }
                 System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
             }
             else
             {
                 if (geom.GetGeometry() is com.epl.geometry.Polyline)
                 {
                     com.epl.geometry.Polyline mp = (com.epl.geometry.Polyline)geom.GetGeometry();
                     System.Console.Out.WriteLine("Polyline has " + mp.GetPointCount() + " points and " + mp.GetPathCount() + " parts.");
                     System.Console.Out.WriteLine("Part start of 2nd segment : " + mp.GetPathStart(1));
                     System.Console.Out.WriteLine("Part end of 2nd segment   : " + mp.GetPathEnd(1));
                     System.Console.Out.WriteLine("Part size of 2nd segment  : " + mp.GetPathSize(1));
                     int start = mp.GetPathStart(1);
                     int end   = mp.GetPathEnd(1);
                     for (int i = start; i < end; i++)
                     {
                         com.epl.geometry.Point pp = mp.GetPoint(i);
                         System.Console.Out.WriteLine("Point(" + i + ") = (" + pp.GetX() + ", " + pp.GetY() + ")");
                     }
                     System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
                 }
             }
         }
     }
 }
        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);
        }
Ejemplo n.º 19
0
        public virtual void TestProximity_2D_1()
        {
            com.epl.geometry.OperatorFactoryLocal engine      = com.epl.geometry.OperatorFactoryLocal.GetInstance();
            com.epl.geometry.OperatorProximity2D  proximityOp = (com.epl.geometry.OperatorProximity2D)engine.GetOperator(com.epl.geometry.Operator.Type.Proximity2D);
            com.epl.geometry.Point inputPoint = new com.epl.geometry.Point(3, 2);
            com.epl.geometry.Point point0     = new com.epl.geometry.Point(2.75, 2);
            // Point point1 = new Point(3, 2.5);
            // Point point2 = new Point(3.75, 2);
            // Point point3 = new Point(2.25, 2.5);
            // Point point4 = new Point(4, 2.25);
            // GetNearestVertices for Polygon (Native and DotNet)
            com.epl.geometry.Polygon             polygon     = MakePolygon();
            com.epl.geometry.Proximity2DResult[] resultArray = com.epl.geometry.GeometryEngine.GetNearestVertices(polygon, inputPoint, 2.0, 8);
            NUnit.Framework.Assert.IsTrue(resultArray.Length == 8);
            double lastdistance;
            double distance;

            com.epl.geometry.Proximity2DResult result0 = resultArray[0];
            lastdistance = result0.GetDistance();
            NUnit.Framework.Assert.IsTrue(lastdistance <= 2.0);
            com.epl.geometry.Proximity2DResult result1 = resultArray[1];
            distance = result1.GetDistance();
            NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
            lastdistance = distance;
            com.epl.geometry.Proximity2DResult result2 = resultArray[2];
            distance = result2.GetDistance();
            NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
            lastdistance = distance;
            com.epl.geometry.Proximity2DResult result3 = resultArray[3];
            distance = result3.GetDistance();
            NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
            lastdistance = distance;
            com.epl.geometry.Proximity2DResult result4 = resultArray[4];
            distance = result4.GetDistance();
            NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
            lastdistance = distance;
            com.epl.geometry.Proximity2DResult result5 = resultArray[5];
            distance = result5.GetDistance();
            NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
            lastdistance = distance;
            com.epl.geometry.Proximity2DResult result6 = resultArray[6];
            distance = result6.GetDistance();
            NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
            lastdistance = distance;
            com.epl.geometry.Proximity2DResult result7 = resultArray[7];
            distance = result7.GetDistance();
            NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
            // lastdistance = distance;
            // Point[] coordinates = polygon.get.getCoordinates2D();
            // int pointCount = polygon.getPointCount();
            //
            // int hits = 0;
            // for (int i = 0; i < pointCount; i++)
            // {
            // Point ipoint = coordinates[i];
            // distance = Point::Distance(ipoint, inputPoint);
            //
            // if (distance < lastdistance)
            // hits++;
            // }
            // assertTrue(hits < 8);
            // GetNearestVertices for Point
            com.epl.geometry.Point point = MakePoint();
            resultArray = com.epl.geometry.GeometryEngine.GetNearestVertices(point, inputPoint, 1.0, 1);
            NUnit.Framework.Assert.IsTrue(resultArray.Length == 1);
            result0 = resultArray[0];
            com.epl.geometry.Point resultPoint0 = result0.GetCoordinate();
            NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == point.GetX() && resultPoint0.GetY() == point.GetY());
            // GetNearestVertex for Polygon
            result0      = com.epl.geometry.GeometryEngine.GetNearestVertex(polygon, inputPoint);
            resultPoint0 = result0.GetCoordinate();
            NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == point0.GetX() && resultPoint0.GetY() == point0.GetY());
            // GetNearestVertex for Point
            result0      = com.epl.geometry.GeometryEngine.GetNearestVertex(point, inputPoint);
            resultPoint0 = result0.GetCoordinate();
            NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == point.GetX() && resultPoint0.GetY() == point.GetY());
            // GetNearestCoordinate for Polygon
            com.epl.geometry.Polygon polygon2 = MakePolygon2();
            result0      = com.epl.geometry.GeometryEngine.GetNearestCoordinate(polygon2, inputPoint, true);
            resultPoint0 = result0.GetCoordinate();
            NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == inputPoint.GetX() && resultPoint0.GetY() == inputPoint.GetY());
            // GetNearestCoordinate for Polyline
            com.epl.geometry.Polyline polyline = MakePolyline();
            result0      = com.epl.geometry.GeometryEngine.GetNearestCoordinate(polyline, inputPoint, true);
            resultPoint0 = result0.GetCoordinate();
            NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == 0.0 && resultPoint0.GetY() == 2.0);
            com.epl.geometry.Polygon pp = new com.epl.geometry.Polygon();
            pp.StartPath(0, 0);
            pp.LineTo(0, 10);
            pp.LineTo(10, 10);
            pp.LineTo(10, 0);
            inputPoint.SetXY(15, -5);
            result0 = proximityOp.GetNearestCoordinate(pp, inputPoint, true, true);
            bool is_right = result0.IsRightSide();

            NUnit.Framework.Assert.IsTrue(!is_right);
        }
        /// <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);
        }
Ejemplo n.º 21
0
        internal static bool Non_empty_points_need_to_cluster(double tolerance, com.epl.geometry.Point pt1, com.epl.geometry.Point pt2)
        {
            double tolerance_for_clustering = com.epl.geometry.InternalUtils.Adjust_tolerance_for_TE_clustering(tolerance);

            return(com.epl.geometry.Clusterer.IsClusterCandidate_(pt1.GetX(), pt1.GetY(), pt2.GetX(), pt2.GetY(), com.epl.geometry.MathUtils.Sqr(tolerance_for_clustering)));
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
0
        public static void TestCreation()
        {
            {
                // simple create
                com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint();
                NUnit.Framework.Assert.IsTrue(mpoint.GetType() == Geometry.Type.MultiPoint);
                // assertFalse(mpoint.getClass() == Polyline.class);
                NUnit.Framework.Assert.IsTrue(mpoint != null);
                NUnit.Framework.Assert.IsTrue(mpoint.GetType() == com.epl.geometry.Geometry.Type.MultiPoint);
                NUnit.Framework.Assert.IsTrue(mpoint.IsEmpty());
                NUnit.Framework.Assert.IsTrue(mpoint.GetPointCount() == 0);
                mpoint = null;
                NUnit.Framework.Assert.IsFalse(mpoint != null);
            }
            {
                // play with default attributes
                com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint();
                SimpleTest(mpoint);
            }
            {
                // simple create 2D
                com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint();
                NUnit.Framework.Assert.IsTrue(mpoint != null);
                com.epl.geometry.MultiPoint mpoint1 = new com.epl.geometry.MultiPoint();
                NUnit.Framework.Assert.IsTrue(mpoint1 != null);
                mpoint.SetEmpty();
                com.epl.geometry.Point pt = new com.epl.geometry.Point(0, 0);
                mpoint.Add(pt);
                com.epl.geometry.Point pt3 = mpoint.GetPoint(0);
                NUnit.Framework.Assert.IsTrue(pt3.GetX() == 0 && pt3.GetY() == 0);
                // assertFalse(mpoint->HasAttribute(VertexDescription::Semantics::Z));
                // pt3.setZ(115.0);
                mpoint.SetPoint(0, pt3);
                pt3 = mpoint.GetPoint(0);
                NUnit.Framework.Assert.IsTrue(pt3.GetX() == 0 && pt3.GetY() == 0);
            }
            {
                /* && pt3.getZ() == 115 */
                // assertTrue(mpoint->HasAttribute(VertexDescription::Semantics::Z));
                // CompareGeometryContent(mpoint, &pt, 1);
                // move 3d
                com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint();
                NUnit.Framework.Assert.IsTrue(mpoint != null);
                com.epl.geometry.Point pt = new com.epl.geometry.Point(0, 0);
                mpoint.Add(pt);
                com.epl.geometry.Point pt3 = mpoint.GetPoint(0);
                NUnit.Framework.Assert.IsTrue(pt3.GetX() == 0 && pt3.GetY() == 0);
            }
            {
                /* && pt3.getZ() == 0 */
                // test QueryInterval
                com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint();
                com.epl.geometry.Point      pt1    = new com.epl.geometry.Point(0.0, 0.0);
                // pt1.setZ(-1.0);
                com.epl.geometry.Point pt2 = new com.epl.geometry.Point(0.0, 0.0);
                // pt2.setZ(1.0);
                mpoint.Add(pt1);
                mpoint.Add(pt2);
                // Envelope1D e =
                // mpoint->QueryInterval(enum_value2(VertexDescription, Semantics,
                // Z), 0);
                com.epl.geometry.Envelope e = new com.epl.geometry.Envelope();
                mpoint.QueryEnvelope(e);
            }
            {
                // assertTrue(e.get == -1.0 && e.vmax == 1.0);
                com.epl.geometry.MultiPoint geom = new com.epl.geometry.MultiPoint();
            }
            {
                // int sz = sizeof(openString) / sizeof(openString[0]);
                // for (int i = 0; i < sz; i++)
                // geom.add(openString[i]);
                // CompareGeometryContent(geom, openString, sz);
                com.epl.geometry.MultiPoint geom = new com.epl.geometry.MultiPoint();
            }
            {
                // int sz = sizeof(openString) / sizeof(openString[0]);
                // Point point = GCNEW Point;
                // for (int i = 0; i < sz; i++)
                // {
                // point.setXY(openString[i]);
                // geom.add(point);
                // }
                // CompareGeometryContent(geom, openString, sz);
                // Test AddPoints
                com.epl.geometry.MultiPoint geom = new com.epl.geometry.MultiPoint();
            }
            {
                // int sz = sizeof(openString) / sizeof(openString[0]);
                // geom.addPoints(openString, sz, 0, -1);
                // CompareGeometryContent((MultiVertexGeometry)geom, openString,
                // sz);
                // Test InsertPoint(Point2D)
                com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint();
                com.epl.geometry.Point      pt0    = new com.epl.geometry.Point(0.0, 0.0);
                // pt0.setZ(-1.0);
                // pt0.setID(7);
                com.epl.geometry.Point pt1 = new com.epl.geometry.Point(0.0, 0.0);
                // pt1.setZ(1.0);
                // pt1.setID(11);
                com.epl.geometry.Point pt2 = new com.epl.geometry.Point(0.0, 1.0);
                // pt2.setZ(1.0);
                // pt2.setID(13);
                mpoint.Add(pt0);
                mpoint.Add(pt1);
                mpoint.Add(pt2);
                com.epl.geometry.Point pt3 = new com.epl.geometry.Point(-11.0, -13.0);
                mpoint.Add(pt3);
                mpoint.InsertPoint(1, pt3);
                NUnit.Framework.Assert.IsTrue(mpoint.GetPointCount() == 5);
                com.epl.geometry.Point pt;
                pt = mpoint.GetPoint(0);
                NUnit.Framework.Assert.IsTrue(pt.GetX() == pt0.GetX() && pt.GetY() == pt0.GetY());

                /*
                 * &&
                 * pt.
                 * getZ
                 * () ==
                 * pt0
                 * .getZ
                 * ()
                 */
                pt = mpoint.GetPoint(1);
                NUnit.Framework.Assert.IsTrue(pt.GetX() == pt3.GetX() && pt.GetY() == pt3.GetY());
                pt = mpoint.GetPoint(2);
                NUnit.Framework.Assert.IsTrue(pt.GetX() == pt1.GetX() && pt.GetY() == pt1.GetY());

                /*
                 * &&
                 * pt.
                 * getZ
                 * () ==
                 * pt1
                 * .getZ
                 * ()
                 */
                pt = mpoint.GetPoint(3);
                NUnit.Framework.Assert.IsTrue(pt.GetX() == pt2.GetX() && pt.GetY() == pt2.GetY());

                /*
                 * &&
                 * pt.
                 * getZ
                 * () ==
                 * pt2
                 * .getZ
                 * ()
                 */
                com.epl.geometry.Point point = new com.epl.geometry.Point();
                point.SetXY(17.0, 19.0);
                // point.setID(12);
                // point.setM(5);
                mpoint.InsertPoint(2, point);
                mpoint.Add(point);
                NUnit.Framework.Assert.IsTrue(mpoint.GetPointCount() == 7);
            }
            // double m;
            // int id;
            // pt = mpoint.getXYZ(2);
            // assertTrue(pt.x == 17.0 && pt.y == 19.0 && pt.z == defaultZ);
            // m = mpoint.getAttributeAsDbl(enum_value2(VertexDescription,
            // Semantics, M), 2, 0);
            // assertTrue(m == 5);
            // id = mpoint.getAttributeAsInt(enum_value2(VertexDescription,
            // Semantics, ID), 2, 0);
            // assertTrue(id == 23);
            //
            // pt = mpoint.getXYZ(3);
            // assertTrue(pt.x == pt1.x && pt.y == pt1.y && pt.z == pt1.z);
            // m = mpoint.getAttributeAsDbl(enum_value2(VertexDescription,
            // Semantics, M), 3, 0);
            // assertTrue(NumberUtils::IsNaN(m));
            // id = mpoint.getAttributeAsInt(enum_value2(VertexDescription,
            // Semantics, ID), 3, 0);
            // assertTrue(id == 11);
            com.epl.geometry.MultiPoint mpoint_1 = new com.epl.geometry.MultiPoint();
            com.epl.geometry.Point      pt0_1    = new com.epl.geometry.Point(0.0, 0.0, -1.0);
            com.epl.geometry.Point      pt1_1    = new com.epl.geometry.Point(0.0, 0.0, 1.0);
            com.epl.geometry.Point      pt2_1    = new com.epl.geometry.Point(0.0, 1.0, 1.0);
            mpoint_1.Add(pt0_1);
            mpoint_1.Add(pt1_1);
            mpoint_1.Add(pt2_1);
            mpoint_1.RemovePoint(1);
            com.epl.geometry.Point pt_1;
            pt_1 = mpoint_1.GetPoint(0);
            NUnit.Framework.Assert.IsTrue(pt_1.GetX() == pt0_1.GetX() && pt_1.GetY() == pt0_1.GetY());
            pt_1 = mpoint_1.GetPoint(1);
            NUnit.Framework.Assert.IsTrue(pt_1.GetX() == pt2_1.GetX() && pt_1.GetY() == pt2_1.GetY());
            NUnit.Framework.Assert.IsTrue(mpoint_1.GetPointCount() == 2);
        }