public virtual void TestEquals() { string wktext1 = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]"; string wktext2 = "PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]"; com.epl.geometry.SpatialReference a1 = com.epl.geometry.SpatialReference.Create(wktext1); com.epl.geometry.SpatialReference b = com.epl.geometry.SpatialReference.Create(wktext2); com.epl.geometry.SpatialReference a2 = com.epl.geometry.SpatialReference.Create(wktext1); NUnit.Framework.Assert.IsTrue(a1.Equals(a1)); NUnit.Framework.Assert.IsTrue(b.Equals(b)); NUnit.Framework.Assert.IsTrue(a1.Equals(a2)); NUnit.Framework.Assert.IsFalse(a1.Equals(b)); NUnit.Framework.Assert.IsFalse(b.Equals(a1)); }
/// <summary>The output of this method can be only used for debugging.</summary> /// <remarks>The output of this method can be only used for debugging. It is subject to change without notice.</remarks> // public override string ToString() // { // string snippet = com.epl.geometry.OperatorExportToJson.Local().Execute(GetSpatialReference(), GetGeometry()); // if (snippet.Length > 200) // { // return snippet.Substring(0, 197 - 0) + "... (" + snippet.Length + " characters)"; // } // else // { // return snippet; // } // } public override bool Equals(object other) { if (other == null) { return(false); } if (other == this) { return(true); } if (other.GetType() != GetType()) { return(false); } com.epl.geometry.MapGeometry omg = (com.epl.geometry.MapGeometry)other; com.epl.geometry.SpatialReference sr = GetSpatialReference(); com.epl.geometry.Geometry g = GetGeometry(); com.epl.geometry.SpatialReference osr = omg.GetSpatialReference(); com.epl.geometry.Geometry og = omg.GetGeometry(); if (sr != osr) { if (sr == null || !sr.Equals(osr)) { return(false); } } if (g != og) { if (g == null || !g.Equals(og)) { return(false); } } return(true); }
public virtual void TestSerializeSR() { try { java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream(); java.io.ObjectOutputStream oo = new java.io.ObjectOutputStream(streamOut); com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(102100); oo.WriteObject(sr); System.IO.BinaryWriter streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray()); java.io.ObjectInputStream ii = new java.io.ObjectInputStream(streamIn); com.epl.geometry.SpatialReference ptRes = (com.epl.geometry.SpatialReference)ii.ReadObject(); NUnit.Framework.Assert.IsTrue(ptRes.Equals(sr)); } catch (System.Exception) { Fail("Spatial Reference serialization failure"); } }
public override bool Equals(object other) { if (other == null) { return(false); } if (other == this) { return(true); } if (other.GetType() != GetType()) { return(false); } com.epl.geometry.ogc.OGCGeometry another = (com.epl.geometry.ogc.OGCGeometry)other; com.epl.geometry.Geometry geom1 = GetEsriGeometry(); com.epl.geometry.Geometry geom2 = another.GetEsriGeometry(); if (geom1 == null) { if (geom2 != null) { return(false); } } else { if (!geom1.Equals(geom2)) { return(false); } } if (esriSR == another.esriSR) { return(true); } if (esriSR != null && another.esriSR != null) { return(esriSR.Equals(another.esriSR)); } return(false); }