Esempio n. 1
0
 public virtual void testCopy()
 {
     com.esri.core.geometry.Point pt     = new com.esri.core.geometry.Point();
     com.esri.core.geometry.Point copyPt = (com.esri.core.geometry.Point)pt.copy();
     NUnit.Framework.Assert.IsTrue(copyPt.Equals(pt));
     pt.setXY(11, 13);
     copyPt = (com.esri.core.geometry.Point)pt.copy();
     NUnit.Framework.Assert.IsTrue(copyPt.Equals(pt));
     NUnit.Framework.Assert.IsTrue(copyPt.getXY().isEqual(new com.esri.core.geometry.Point2D
                                                              (11, 13)));
     NUnit.Framework.Assert.IsTrue(copyPt.getXY().Equals((object)new com.esri.core.geometry.Point2D
                                                             (11, 13)));
 }
Esempio n. 2
0
 public virtual void testReplaceNaNs()
 {
     com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope();
     com.esri.core.geometry.Point    pt  = new com.esri.core.geometry.Point();
     pt.setXY(1, 2);
     pt.setZ(double.NaN);
     pt.queryEnvelope(env);
     pt.replaceNaNs(com.esri.core.geometry.VertexDescription.Semantics.Z, 5);
     NUnit.Framework.Assert.IsTrue(pt.Equals(new com.esri.core.geometry.Point(1, 2, 5)
                                             ));
     NUnit.Framework.Assert.IsTrue(env.hasZ());
     NUnit.Framework.Assert.IsTrue(env.queryInterval(com.esri.core.geometry.VertexDescription.Semantics
                                                     .Z, 0).isEmpty());
     env.replaceNaNs(com.esri.core.geometry.VertexDescription.Semantics.Z, 5);
     NUnit.Framework.Assert.IsTrue(env.queryInterval(com.esri.core.geometry.VertexDescription.Semantics
                                                     .Z, 0).Equals(new com.esri.core.geometry.Envelope1D(5, 5)));
 }
Esempio n. 3
0
 public virtual void testSerializePoint()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.Point  pt        = new com.esri.core.geometry.Point(10, 40);
         oo.writeObject(pt);
         java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut
                                                                                  .toByteArray());
         java.io.ObjectInputStream    ii    = new java.io.ObjectInputStream(streamIn);
         com.esri.core.geometry.Point ptRes = (com.esri.core.geometry.Point)ii.readObject(
             );
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         fail("Point serialization failure");
     }
     // try
     // {
     // FileOutputStream streamOut = new FileOutputStream(m_thisDirectory +
     // "savedPoint.txt");
     // ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     // Point pt = new Point(10, 40);
     // oo.writeObject(pt);
     // }
     // catch(Exception ex)
     // {
     // fail("Point serialization failure");
     // }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedPoint.txt");
         java.io.ObjectInputStream    ii    = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.Point ptRes = (com.esri.core.geometry.Point)ii.readObject(
             );
         NUnit.Framework.Assert.IsTrue(ptRes.getX() == 10 && ptRes.getY() == 40);
     }
     catch (System.Exception)
     {
         fail("Point serialization failure");
     }
 }
		public virtual void TestReplaceNaNs()
		{
			com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope();
			com.esri.core.geometry.Point pt = new com.esri.core.geometry.Point();
			pt.SetXY(1, 2);
			pt.SetZ(double.NaN);
			pt.QueryEnvelope(env);
			pt.ReplaceNaNs(com.esri.core.geometry.VertexDescription.Semantics.Z, 5);
			NUnit.Framework.Assert.IsTrue(pt.Equals(new com.esri.core.geometry.Point(1, 2, 5)));
			NUnit.Framework.Assert.IsTrue(env.HasZ());
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).IsEmpty());
			env.ReplaceNaNs(com.esri.core.geometry.VertexDescription.Semantics.Z, 5);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).Equals(new com.esri.core.geometry.Envelope1D(5, 5)));
		}