コード例 #1
0
		public static void TestCreation()
		{
			{
				// simple create
				com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.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.esri.core.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.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint();
				SimpleTest(mpoint);
			}
			{
				// simple create 2D
				com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint();
				NUnit.Framework.Assert.IsTrue(mpoint != null);
				com.esri.core.geometry.MultiPoint mpoint1 = new com.esri.core.geometry.MultiPoint();
				NUnit.Framework.Assert.IsTrue(mpoint1 != null);
				mpoint.SetEmpty();
				com.esri.core.geometry.Point pt = new com.esri.core.geometry.Point(0, 0);
				mpoint.Add(pt);
				com.esri.core.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.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint();
				NUnit.Framework.Assert.IsTrue(mpoint != null);
				com.esri.core.geometry.Point pt = new com.esri.core.geometry.Point(0, 0);
				mpoint.Add(pt);
				com.esri.core.geometry.Point pt3 = mpoint.GetPoint(0);
				NUnit.Framework.Assert.IsTrue(pt3.GetX() == 0 && pt3.GetY() == 0);
			}
			{
				/* && pt3.getZ() == 0 */
				// test QueryInterval
				com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Point pt1 = new com.esri.core.geometry.Point(0.0, 0.0);
				// pt1.setZ(-1.0);
				com.esri.core.geometry.Point pt2 = new com.esri.core.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.esri.core.geometry.Envelope e = new com.esri.core.geometry.Envelope();
				mpoint.QueryEnvelope(e);
			}
			{
				// assertTrue(e.get == -1.0 && e.vmax == 1.0);
				com.esri.core.geometry.MultiPoint geom = new com.esri.core.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.esri.core.geometry.MultiPoint geom = new com.esri.core.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.esri.core.geometry.MultiPoint geom = new com.esri.core.geometry.MultiPoint();
			}
			{
				// int sz = sizeof(openString) / sizeof(openString[0]);
				// geom.addPoints(openString, sz, 0, -1);
				// CompareGeometryContent((MultiVertexGeometry)geom, openString,
				// sz);
				// Test InsertPoint(Point2D)
				com.esri.core.geometry.MultiPoint mpoint = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Point pt0 = new com.esri.core.geometry.Point(0.0, 0.0);
				// pt0.setZ(-1.0);
				// pt0.setID(7);
				com.esri.core.geometry.Point pt1 = new com.esri.core.geometry.Point(0.0, 0.0);
				// pt1.setZ(1.0);
				// pt1.setID(11);
				com.esri.core.geometry.Point pt2 = new com.esri.core.geometry.Point(0.0, 1.0);
				// pt2.setZ(1.0);
				// pt2.setID(13);
				mpoint.Add(pt0);
				mpoint.Add(pt1);
				mpoint.Add(pt2);
				com.esri.core.geometry.Point pt3 = new com.esri.core.geometry.Point(-11.0, -13.0);
				mpoint.Add(pt3);
				mpoint.InsertPoint(1, pt3);
				NUnit.Framework.Assert.IsTrue(mpoint.GetPointCount() == 5);
				com.esri.core.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.esri.core.geometry.Point point = new com.esri.core.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.esri.core.geometry.MultiPoint mpoint_1 = new com.esri.core.geometry.MultiPoint();
			com.esri.core.geometry.Point pt0_1 = new com.esri.core.geometry.Point(0.0, 0.0, -1.0);
			com.esri.core.geometry.Point pt1_1 = new com.esri.core.geometry.Point(0.0, 0.0, 1.0);
			com.esri.core.geometry.Point pt2_1 = new com.esri.core.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.esri.core.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);
		}
コード例 #2
0
		public virtual void TestMultiPointMultipointRelate()
		{
			com.esri.core.geometry.OperatorRelate op = (com.esri.core.geometry.OperatorRelate)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Relate));
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			bool res;
			string scl;
			com.esri.core.geometry.MultiPoint multipoint1 = new com.esri.core.geometry.MultiPoint();
			com.esri.core.geometry.MultiPoint multipoint2 = new com.esri.core.geometry.MultiPoint();
			multipoint1.Add(0, 0);
			multipoint2.Add(0, 0);
			scl = "TFFFFFFF2";
			res = op.Execute(multipoint1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			multipoint2.Add(5, 5);
			scl = "TFFFFFTF2";
			res = op.Execute(multipoint1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			multipoint1.Add(-5, 0);
			scl = "0FTFFFTF2";
			res = op.Execute(multipoint1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			res = com.esri.core.geometry.GeometryEngine.Relate(multipoint1, multipoint2, sr, scl);
			NUnit.Framework.Assert.IsTrue(res);
			multipoint1.SetEmpty();
			multipoint2.SetEmpty();
			multipoint1.Add(0, 0);
			multipoint2.Add(1, 1);
			scl = "FFTFFF0FT";
			res = op.Execute(multipoint1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
		}
コード例 #3
0
		public virtual void TestPolygonMultiPointRelate()
		{
			com.esri.core.geometry.OperatorRelate op = (com.esri.core.geometry.OperatorRelate)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Relate));
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			bool res;
			string scl;
			com.esri.core.geometry.Polygon polygon1 = new com.esri.core.geometry.Polygon();
			com.esri.core.geometry.MultiPoint multipoint2 = new com.esri.core.geometry.MultiPoint();
			polygon1.StartPath(0, 0);
			polygon1.LineTo(0, 10);
			polygon1.LineTo(10, 10);
			polygon1.LineTo(10, 0);
			multipoint2.Add(0, 0);
			multipoint2.Add(5, 5);
			scl = "TFT0F1FFT";
			res = op.Execute(polygon1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			scl = "T0FFFFT1T";
			// transpose of above
			res = op.Execute(multipoint2, polygon1, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			multipoint2.Add(11, 11);
			scl = "TFT0F10FT";
			res = op.Execute(polygon1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			multipoint2.Add(0, 5);
			scl = "TFT0F10FT";
			res = op.Execute(polygon1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			scl = "TFF0F10FT";
			res = op.Execute(polygon1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(!res);
			polygon1.SetEmpty();
			multipoint2.SetEmpty();
			polygon1.StartPath(0, 0);
			polygon1.LineTo(0, 20);
			polygon1.LineTo(20, 20);
			polygon1.LineTo(20, 0);
			multipoint2.Add(3, 3);
			multipoint2.Add(5, 5);
			op.AccelerateGeometry(polygon1, sr, com.esri.core.geometry.Geometry.GeometryAccelerationDegree.enumHot);
			scl = "TF2FF****";
			res = op.Execute(polygon1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			polygon1.SetEmpty();
			multipoint2.SetEmpty();
			polygon1.StartPath(4, 0);
			polygon1.LineTo(0, 4);
			polygon1.LineTo(4, 8);
			polygon1.LineTo(8, 4);
			multipoint2.Add(8, 1);
			multipoint2.Add(8, 2);
			op.AccelerateGeometry(polygon1, sr, com.esri.core.geometry.Geometry.GeometryAccelerationDegree.enumHot);
			scl = "FF2FF10F2";
			res = op.Execute(polygon1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
		}
コード例 #4
0
		public virtual void TestPolylineMultiPointRelate()
		{
			com.esri.core.geometry.OperatorRelate op = com.esri.core.geometry.OperatorRelate.Local();
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			bool res;
			string scl;
			com.esri.core.geometry.Polyline polyline1 = new com.esri.core.geometry.Polyline();
			com.esri.core.geometry.MultiPoint multipoint2 = new com.esri.core.geometry.MultiPoint();
			polyline1.StartPath(0, 0);
			polyline1.LineTo(10, 0);
			multipoint2.Add(0, 0);
			multipoint2.Add(5, 5);
			scl = "FF10F00F2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			multipoint2.Add(5, 0);
			scl = "0F10F00F2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			scl = "0F11F00F2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(!res);
			polyline1.SetEmpty();
			multipoint2.SetEmpty();
			polyline1.StartPath(4, 0);
			polyline1.LineTo(0, 4);
			polyline1.LineTo(4, 8);
			polyline1.LineTo(8, 4);
			polyline1.LineTo(4, 0);
			// has no boundary
			multipoint2.Add(8, 1);
			multipoint2.Add(8, 2);
			op.AccelerateGeometry(polyline1, sr, com.esri.core.geometry.Geometry.GeometryAccelerationDegree.enumHot);
			scl = "FF1FFF0F2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			polyline1.SetEmpty();
			multipoint2.SetEmpty();
			polyline1.StartPath(4, 0);
			polyline1.LineTo(4, 0);
			multipoint2.Add(8, 1);
			multipoint2.Add(8, 2);
			scl = "FF0FFF0F2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			multipoint2.Add(-2, 0);
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			op.AccelerateGeometry(polyline1, sr, com.esri.core.geometry.Geometry.GeometryAccelerationDegree.enumHot);
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			polyline1.SetEmpty();
			multipoint2.SetEmpty();
			polyline1.StartPath(10, 10);
			polyline1.LineTo(10, 10);
			multipoint2.Add(10, 10);
			scl = "0FFFFFFF2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			polyline1.StartPath(12, 12);
			polyline1.LineTo(12, 12);
			scl = "0F0FFFFF2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			polyline1.SetEmpty();
			multipoint2.SetEmpty();
			polyline1.StartPath(10, 10);
			polyline1.LineTo(10, 10);
			multipoint2.Add(0, 0);
			scl = "FF0FFF0F2";
			res = op.Execute(polyline1, multipoint2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
		}
コード例 #5
0
		public virtual void TestMultiPointPointRelate()
		{
			com.esri.core.geometry.OperatorRelate op = (com.esri.core.geometry.OperatorRelate)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Relate));
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			bool res;
			string scl;
			com.esri.core.geometry.MultiPoint m1 = new com.esri.core.geometry.MultiPoint();
			com.esri.core.geometry.Point p2 = new com.esri.core.geometry.Point();
			m1.Add(0, 0);
			p2.SetXY(0, 0);
			scl = "T*F***F**";
			res = op.Execute(m1, p2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			scl = "T*T***F**";
			res = op.Execute(m1, p2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(!res);
			m1.Add(1, 1);
			res = op.Execute(m1, p2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
			m1.SetEmpty();
			m1.Add(1, 1);
			m1.Add(2, 2);
			scl = "FF0FFFTF2";
			res = op.Execute(m1, p2, sr, scl, null);
			NUnit.Framework.Assert.IsTrue(res);
		}