public virtual void TestEnvelope()
		{
			com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope();
			env.SetCoords(100, 200, 250, 300);
			NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M));
			env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
			NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M));
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.M, 0).IsEmpty());
			env.SetInterval(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 2);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.M, 0).vmin == 1);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.M, 0).vmax == 2);
			NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z));
			env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z);
			NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z));
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmin == 0);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmax == 0);
			env.SetInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 3, 4);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmin == 3);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmax == 4);
			NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID));
			env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID);
			NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.ID));
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmin == 0);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmax == 0);
			env.SetInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0, 5, 6);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmin == 5);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmax == 6);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmin == 3);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmax == 4);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.M, 0).vmin == 1);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.M, 0).vmax == 2);
			env.DropAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
			NUnit.Framework.Assert.IsFalse(env.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M));
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmin == 5);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmax == 6);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmin == 3);
			NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmax == 4);
			com.esri.core.geometry.Envelope env1 = new com.esri.core.geometry.Envelope();
			env.CopyTo(env1);
			NUnit.Framework.Assert.IsFalse(env1.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M));
			NUnit.Framework.Assert.IsTrue(env1.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmin == 5);
			NUnit.Framework.Assert.IsTrue(env1.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.ID, 0).vmax == 6);
			NUnit.Framework.Assert.IsTrue(env1.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmin == 3);
			NUnit.Framework.Assert.IsTrue(env1.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0).vmax == 4);
		}
		public static void TestPointTypes()
		{
			com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance();
			com.esri.core.geometry.OperatorDifference difference = (com.esri.core.geometry.OperatorDifference)engine.GetOperator(com.esri.core.geometry.Operator.Type.Difference);
			com.esri.core.geometry.OperatorSymmetricDifference sym_difference = (com.esri.core.geometry.OperatorSymmetricDifference)engine.GetOperator(com.esri.core.geometry.Operator.Type.SymmetricDifference);
			{
				// point/point
				com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
				com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
				point_1.SetXY(0, 0);
				point_2.SetXY(0.000000009, 0.000000009);
				com.esri.core.geometry.Point differenced = (com.esri.core.geometry.Point)(difference.Execute(point_1, point_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(differenced.IsEmpty());
				com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty());
			}
			{
				// point/point
				com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
				com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
				point_1.SetXY(0, 0);
				point_2.SetXY(0.000000009, 0.0);
				com.esri.core.geometry.Point differenced = (com.esri.core.geometry.Point)(difference.Execute(point_1, point_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(differenced.IsEmpty());
				com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty());
			}
			{
				// point/point
				com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
				com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
				point_1.SetXY(0, 0);
				point_2.SetXY(0.00000002, 0.00000002);
				com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference.Execute(point_1, point_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
				com.esri.core.geometry.Point differenced_2 = (com.esri.core.geometry.Point)(difference.Execute(point_2, point_1, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(!differenced_2.IsEmpty());
				com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.esri.core.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.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
				multi_point_1.Add(0, 0);
				multi_point_1.Add(1, 1);
				point_2.SetXY(0.000000009, 0.000000009);
				com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.esri.core.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.esri.core.geometry.Point differenced_2 = (com.esri.core.geometry.Point)(difference.Execute(point_2, multi_point_1, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(differenced_2.IsEmpty());
			}
			{
				// multi_point/point
				com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
				multi_point_1.Add(0, 0);
				multi_point_1.Add(1, 1);
				point_2.SetXY(0.000000009, 0.0);
				com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.esri.core.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.esri.core.geometry.Point differenced_2 = (com.esri.core.geometry.Point)(difference.Execute(point_2, multi_point_1, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(differenced_2.IsEmpty());
				com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint)(sym_difference.Execute(multi_point_1, point_2, com.esri.core.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.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Point point_2 = new com.esri.core.geometry.Point();
				multi_point_1.Add(0, 0);
				multi_point_1.Add(0, 0);
				point_2.SetXY(0.000000009, 0.0);
				com.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty());
				com.esri.core.geometry.MultiPoint sym_differenced = (com.esri.core.geometry.MultiPoint)(sym_difference.Execute(multi_point_1, point_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty());
			}
			{
				// multi_point/polygon
				com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.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.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.esri.core.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.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.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.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty());
			}
			{
				// multi_point/envelope
				com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Envelope envelope_2 = new com.esri.core.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.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint)(difference.Execute(multi_point_1, envelope_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty() && differenced_1 == multi_point_1);
			}
			{
				// multi_point/polygon
				com.esri.core.geometry.MultiPoint multi_point_1 = new com.esri.core.geometry.MultiPoint();
				com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.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.esri.core.geometry.MultiPoint differenced_1 = (com.esri.core.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty() && differenced_1 == multi_point_1);
			}
			{
				// point/polygon
				com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
				com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.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.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference.Execute(point_1, polygon_2, com.esri.core.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.esri.core.geometry.Point)(difference.Execute(point_1, polygon_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
				NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
			}
			{
				// point/polygon
				com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
				com.esri.core.geometry.Polygon polygon_2 = new com.esri.core.geometry.Polygon();
				point_1.SetXY(0, 0);
				polygon_2.StartPath(1, 0);
				polygon_2.LineTo(0, 1);
				polygon_2.LineTo(1, 1);
				com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference.Execute(point_1, polygon_2, com.esri.core.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.esri.core.geometry.Point)(difference.Execute(point_1, polygon_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty());
			}
			{
				// point/envelope
				com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
				com.esri.core.geometry.Envelope envelope_2 = new com.esri.core.geometry.Envelope();
				point_1.SetXY(0, 0);
				envelope_2.SetCoords(-1, -1, 1, 1);
				com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference.Execute(point_1, envelope_2, com.esri.core.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.esri.core.geometry.Point)(difference.Execute(point_1, envelope_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
				NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
			}
			{
				// point/polyline
				com.esri.core.geometry.Point point_1 = new com.esri.core.geometry.Point();
				com.esri.core.geometry.Polyline polyline_2 = new com.esri.core.geometry.Polyline();
				point_1.SetXY(0, 0);
				polyline_2.StartPath(-1, 0);
				polyline_2.LineTo(1, 0);
				com.esri.core.geometry.Point differenced_1 = (com.esri.core.geometry.Point)(difference.Execute(point_1, polyline_2, com.esri.core.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.esri.core.geometry.Point)(difference.Execute(point_1, polyline_2, com.esri.core.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.esri.core.geometry.Point)(difference.Execute(point_1, polyline_2, com.esri.core.geometry.SpatialReference.Create(4326), null));
				NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty());
				NUnit.Framework.Assert.IsTrue(differenced_1 == point_1);
			}
		}
		public virtual void TestProximity2D_2()
		{
			com.esri.core.geometry.Point point1 = new com.esri.core.geometry.Point(3, 2);
			com.esri.core.geometry.Point point2 = new com.esri.core.geometry.Point(2, 4);
			com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope();
			envelope.SetCoords(4, 3, 7, 6);
			com.esri.core.geometry.Polygon polygonToTest = new com.esri.core.geometry.Polygon();
			polygonToTest.AddEnvelope(envelope, false);
			com.esri.core.geometry.Proximity2DResult prxResult1 = com.esri.core.geometry.GeometryEngine.GetNearestVertex(envelope, point1);
			com.esri.core.geometry.Proximity2DResult prxResult2 = com.esri.core.geometry.GeometryEngine.GetNearestVertex(polygonToTest, point1);
			com.esri.core.geometry.Proximity2DResult prxResult3 = com.esri.core.geometry.GeometryEngine.GetNearestCoordinate(envelope, point2, false);
			com.esri.core.geometry.Proximity2DResult prxResult4 = com.esri.core.geometry.GeometryEngine.GetNearestCoordinate(polygonToTest, point2, false);
			com.esri.core.geometry.Point result1 = prxResult1.GetCoordinate();
			com.esri.core.geometry.Point result2 = prxResult2.GetCoordinate();
			NUnit.Framework.Assert.IsTrue(result1.GetX() == result2.GetX());
			com.esri.core.geometry.Point result3 = prxResult3.GetCoordinate();
			com.esri.core.geometry.Point result4 = prxResult4.GetCoordinate();
			NUnit.Framework.Assert.IsTrue(result3.GetX() == result4.GetX());
		}
		public virtual void TestIsSimpleBasicsEnvelope()
		{
			// Envelope is simple, when it's width and height are not degenerate
			com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope();
			bool result = simplifyOp.IsSimpleAsFeature(env, sr4326, false, null, null);
			// Empty is simple
			NUnit.Framework.Assert.IsTrue(result);
			env.SetCoords(0, 0, 10, 10);
			result = simplifyOp.IsSimpleAsFeature(env, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(result);
			// sliver but still simple
			env.SetCoords(0, 0, 0 + sr4326.GetTolerance() * 2, 10);
			result = simplifyOp.IsSimpleAsFeature(env, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(result);
			// sliver and not simple
			env.SetCoords(0, 0, 0 + sr4326.GetTolerance() * 0.5, 10);
			result = simplifyOp.IsSimpleAsFeature(env, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
		}
		public static void TestIntervalTreeRandomConstruction()
		{
			int pointcount = 0;
			int passcount = 1000;
			int figureSize = 50;
			com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope();
			env.SetCoords(-10000, -10000, 10000, 10000);
			com.esri.core.geometry.RandomCoordinateGenerator generator = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), env, 0.001);
			System.Random random = new System.Random(2013);
			int rand_max = 98765;
			System.Collections.Generic.List<com.esri.core.geometry.Envelope1D> intervals = new System.Collections.Generic.List<com.esri.core.geometry.Envelope1D>();
			com.esri.core.geometry.AttributeStreamOfInt8 intervalsFound = new com.esri.core.geometry.AttributeStreamOfInt8(0);
			for (int i = 0; i < passcount; i++)
			{
				int r = figureSize;
				if (r < 3)
				{
					continue;
				}
				com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
				com.esri.core.geometry.Point pt;
				for (int j = 0; j < r; j++)
				{
					int rand = random.Next(rand_max);
					bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95);
					pt = generator.GetRandomCoord();
					if (j == 0 || bRandomNew)
					{
						poly.StartPath(pt);
					}
					else
					{
						poly.LineTo(pt);
					}
				}
				{
					intervals.Clear();
					com.esri.core.geometry.SegmentIterator seg_iter = poly.QuerySegmentIterator();
					com.esri.core.geometry.Envelope1D interval;
					com.esri.core.geometry.Envelope1D range = poly.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.POSITION, 0);
					range.vmin -= 0.01;
					range.vmax += 0.01;
					while (seg_iter.NextPath())
					{
						while (seg_iter.HasNextSegment())
						{
							com.esri.core.geometry.Segment segment = seg_iter.NextSegment();
							interval = segment.QueryInterval(com.esri.core.geometry.VertexDescription.Semantics.POSITION, 0);
							intervals.Add(interval);
						}
					}
					intervalsFound.Resize(intervals.Count, 0);
					// Just test construction for assertions
					com.esri.core.geometry.IntervalTreeImpl intervalTree = new com.esri.core.geometry.IntervalTreeImpl(true);
					Construct(intervalTree, intervals);
					for (int j_1 = 0; j_1 < intervals.Count; j_1++)
					{
						intervalTree.Insert(j_1);
					}
					com.esri.core.geometry.IntervalTreeImpl.IntervalTreeIteratorImpl iterator = intervalTree.GetIterator(range, 0.0);
					int count = 0;
					int handle;
					while ((handle = iterator.Next()) != -1)
					{
						count++;
						intervalsFound.Write(handle, unchecked((byte)1));
					}
					NUnit.Framework.Assert.IsTrue(count == intervals.Count);
					for (int j_2 = 0; j_2 < intervalsFound.Size(); j_2++)
					{
						interval = intervals[j_2];
						NUnit.Framework.Assert.IsTrue(intervalsFound.Read(j_2) == 1);
					}
					for (int j_3 = 0; j_3 < intervals.Count >> 1; j_3++)
					{
						intervalTree.Remove(j_3);
					}
					iterator.ResetIterator(range, 0.0);
					count = 0;
					while ((handle = iterator.Next()) != -1)
					{
						count++;
						intervalsFound.Write(handle, unchecked((byte)1));
					}
					NUnit.Framework.Assert.IsTrue(count == intervals.Count - (intervals.Count >> 1));
					for (int j_4 = (intervals.Count >> 1); j_4 < intervals.Count; j_4++)
					{
						intervalTree.Remove(j_4);
					}
				}
			}
		}
		public static void TestRandom()
		{
			int passcount = 10;
			int figureSize = 100;
			int figureSize2 = 100;
			com.esri.core.geometry.Envelope extent1 = new com.esri.core.geometry.Envelope();
			com.esri.core.geometry.Envelope extent2 = new com.esri.core.geometry.Envelope();
			com.esri.core.geometry.Envelope extent3 = new com.esri.core.geometry.Envelope();
			com.esri.core.geometry.Envelope extent4 = new com.esri.core.geometry.Envelope();
			extent1.SetCoords(-10000, 5000, 10000, 25000);
			// red
			extent2.SetCoords(-10000, 2000, 10000, 8000);
			// blue
			extent3.SetCoords(-10000, -8000, 10000, -2000);
			// blue
			extent4.SetCoords(-10000, -25000, 10000, -5000);
			// red
			com.esri.core.geometry.RandomCoordinateGenerator generator1 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent1, 0.001);
			com.esri.core.geometry.RandomCoordinateGenerator generator2 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent2, 0.001);
			com.esri.core.geometry.RandomCoordinateGenerator generator3 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent3, 0.001);
			com.esri.core.geometry.RandomCoordinateGenerator generator4 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent4, 0.001);
			System.Random random = new System.Random(1982);
			int rand_max = 511;
			int qCount = 0;
			int eCount = 0;
			int bCount = 0;
			for (int c = 0; c < passcount; c++)
			{
				com.esri.core.geometry.Polygon polyRed = new com.esri.core.geometry.Polygon();
				com.esri.core.geometry.Polygon polyBlue = new com.esri.core.geometry.Polygon();
				int r = figureSize;
				if (r < 3)
				{
					continue;
				}
				com.esri.core.geometry.Point pt;
				for (int j = 0; j < r; j++)
				{
					int rand = random.Next(rand_max);
					bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95);
					pt = generator1.GetRandomCoord();
					if (j == 0 || bRandomNew)
					{
						polyRed.StartPath(pt);
					}
					else
					{
						polyRed.LineTo(pt);
					}
				}
				for (int j_1 = 0; j_1 < r; j_1++)
				{
					int rand = random.Next(rand_max);
					bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95);
					pt = generator4.GetRandomCoord();
					if (j_1 == 0 || bRandomNew)
					{
						polyRed.StartPath(pt);
					}
					else
					{
						polyRed.LineTo(pt);
					}
				}
				r = figureSize2;
				if (r < 3)
				{
					continue;
				}
				for (int j_2 = 0; j_2 < r; j_2++)
				{
					int rand = random.Next(rand_max);
					bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95);
					pt = generator2.GetRandomCoord();
					if (j_2 == 0 || bRandomNew)
					{
						polyBlue.StartPath(pt);
					}
					else
					{
						polyBlue.LineTo(pt);
					}
				}
				for (int j_3 = 0; j_3 < r; j_3++)
				{
					int rand = random.Next(rand_max);
					bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95);
					pt = generator3.GetRandomCoord();
					if (j_3 == 0 || bRandomNew)
					{
						polyBlue.StartPath(pt);
					}
					else
					{
						polyBlue.LineTo(pt);
					}
				}
				com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D();
				// Quad_tree
				com.esri.core.geometry.QuadTree quadTree = BuildQuadTree(polyBlue);
				com.esri.core.geometry.QuadTree.QuadTreeIterator iterator = quadTree.GetIterator();
				com.esri.core.geometry.SegmentIteratorImpl _segIterRed = ((com.esri.core.geometry.MultiPathImpl)polyRed._getImpl()).QuerySegmentIterator();
				while (_segIterRed.NextPath())
				{
					while (_segIterRed.HasNextSegment())
					{
						com.esri.core.geometry.Segment segmentRed = _segIterRed.NextSegment();
						segmentRed.QueryEnvelope2D(env);
						iterator.ResetIterator(env, 0.001);
						while (iterator.Next() != -1)
						{
							qCount++;
						}
					}
				}
				// Envelope_2D_intersector
				System.Collections.Generic.List<com.esri.core.geometry.Envelope2D> envelopes_red = new System.Collections.Generic.List<com.esri.core.geometry.Envelope2D>();
				System.Collections.Generic.List<com.esri.core.geometry.Envelope2D> envelopes_blue = new System.Collections.Generic.List<com.esri.core.geometry.Envelope2D>();
				com.esri.core.geometry.SegmentIterator segIterRed = polyRed.QuerySegmentIterator();
				while (segIterRed.NextPath())
				{
					while (segIterRed.HasNextSegment())
					{
						com.esri.core.geometry.Segment segment = segIterRed.NextSegment();
						env = new com.esri.core.geometry.Envelope2D();
						segment.QueryEnvelope2D(env);
						envelopes_red.Add(env);
					}
				}
				com.esri.core.geometry.SegmentIterator segIterBlue = polyBlue.QuerySegmentIterator();
				while (segIterBlue.NextPath())
				{
					while (segIterBlue.HasNextSegment())
					{
						com.esri.core.geometry.Segment segment = segIterBlue.NextSegment();
						env = new com.esri.core.geometry.Envelope2D();
						segment.QueryEnvelope2D(env);
						envelopes_blue.Add(env);
					}
				}
				com.esri.core.geometry.Envelope2DIntersectorImpl intersector = new com.esri.core.geometry.Envelope2DIntersectorImpl();
				intersector.SetTolerance(0.001);
				intersector.StartRedConstruction();
				for (int i = 0; i < envelopes_red.Count; i++)
				{
					intersector.AddRedEnvelope(i, envelopes_red[i]);
				}
				intersector.EndRedConstruction();
				intersector.StartBlueConstruction();
				for (int i_1 = 0; i_1 < envelopes_blue.Count; i_1++)
				{
					intersector.AddBlueEnvelope(i_1, envelopes_blue[i_1]);
				}
				intersector.EndBlueConstruction();
				while (intersector.Next())
				{
					eCount++;
				}
				NUnit.Framework.Assert.IsTrue(qCount == eCount);
			}
		}
		public virtual void TestHullTickTock()
		{
			com.esri.core.geometry.Polygon geom1 = new com.esri.core.geometry.Polygon();
			com.esri.core.geometry.Polygon geom2 = new com.esri.core.geometry.Polygon();
			com.esri.core.geometry.Point geom3 = new com.esri.core.geometry.Point();
			com.esri.core.geometry.Line geom4 = new com.esri.core.geometry.Line();
			com.esri.core.geometry.Envelope geom5 = new com.esri.core.geometry.Envelope();
			com.esri.core.geometry.MultiPoint geom6 = new com.esri.core.geometry.MultiPoint();
			// polygon
			geom1.StartPath(0, 0);
			geom1.LineTo(0, 0);
			geom1.LineTo(5, 11);
			geom1.LineTo(5, 11);
			geom1.LineTo(10, 0);
			geom1.LineTo(10, 0);
			// polygon
			geom2.StartPath(0, 5);
			geom2.LineTo(0, 5);
			geom2.LineTo(10, 5);
			geom2.LineTo(10, 5);
			geom2.LineTo(5, -5);
			geom2.LineTo(5, -5);
			// point
			geom3.SetXY(15, 1.25);
			// segment
			geom4.SetEndXY(-5, 1.25);
			geom4.SetStartXY(0, 0);
			// envelope
			geom5.SetCoords(0, 0, 5, 10);
			// multi_point
			geom6.Add(10, 5);
			geom6.Add(10, 10);
			// Create
			com.esri.core.geometry.ListeningGeometryCursor gc = new com.esri.core.geometry.ListeningGeometryCursor();
			com.esri.core.geometry.GeometryCursor ticktock = com.esri.core.geometry.OperatorConvexHull.Local().Execute(gc, true, null);
			// Use tick-tock to push a geometry and do a piece of work.
			gc.Tick(geom1);
			ticktock.Tock();
			gc.Tick(geom2);
			ticktock.Tock();
			gc.Tick(geom3);
			// skiped one tock just for testing.
			ticktock.Tock();
			gc.Tick(geom4);
			ticktock.Tock();
			gc.Tick(geom5);
			ticktock.Tock();
			gc.Tick(geom6);
			ticktock.Tock();
			// Get the result
			com.esri.core.geometry.Geometry result = ticktock.Next();
			com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)result;
			NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.OperatorConvexHull.Local().IsConvex(convex_hull, null));
			com.esri.core.geometry.Point2D p1 = convex_hull.GetXY(0);
			com.esri.core.geometry.Point2D p2 = convex_hull.GetXY(1);
			com.esri.core.geometry.Point2D p3 = convex_hull.GetXY(2);
			com.esri.core.geometry.Point2D p4 = convex_hull.GetXY(3);
			com.esri.core.geometry.Point2D p5 = convex_hull.GetXY(4);
			com.esri.core.geometry.Point2D p6 = convex_hull.GetXY(5);
			NUnit.Framework.Assert.IsTrue(p1.x == 5.0 && p1.y == 11.0);
			NUnit.Framework.Assert.IsTrue(p2.x == 10.0 && p2.y == 10);
			NUnit.Framework.Assert.IsTrue(p3.x == 15.0 && p3.y == 1.25);
			NUnit.Framework.Assert.IsTrue(p4.x == 5.0 && p4.y == -5.0);
			NUnit.Framework.Assert.IsTrue(p5.x == -5.0 && p5.y == 1.25);
			NUnit.Framework.Assert.IsTrue(p6.x == 0.0 && p6.y == 10.0);
		}
		public static void TestMergeCursor()
		{
			com.esri.core.geometry.OperatorConvexHull bounding = (com.esri.core.geometry.OperatorConvexHull)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ConvexHull);
			com.esri.core.geometry.Polygon geom1 = new com.esri.core.geometry.Polygon();
			com.esri.core.geometry.Polygon geom2 = new com.esri.core.geometry.Polygon();
			com.esri.core.geometry.Point geom3 = new com.esri.core.geometry.Point();
			com.esri.core.geometry.Line geom4 = new com.esri.core.geometry.Line();
			com.esri.core.geometry.Envelope geom5 = new com.esri.core.geometry.Envelope();
			com.esri.core.geometry.MultiPoint geom6 = new com.esri.core.geometry.MultiPoint();
			// polygon
			geom1.StartPath(0, 0);
			geom1.LineTo(0, 0);
			geom1.LineTo(5, 11);
			geom1.LineTo(5, 11);
			geom1.LineTo(10, 0);
			geom1.LineTo(10, 0);
			// polygon
			geom2.StartPath(0, 5);
			geom2.LineTo(0, 5);
			geom2.LineTo(10, 5);
			geom2.LineTo(10, 5);
			geom2.LineTo(5, -5);
			geom2.LineTo(5, -5);
			// point
			geom3.SetXY(15, 1.25);
			// segment
			geom4.SetEndXY(-5, 1.25);
			geom4.SetStartXY(0, 0);
			// envelope
			geom5.SetCoords(0, 0, 5, 10);
			// multi_point
			geom6.Add(10, 5);
			geom6.Add(10, 10);
			// create cursor
			com.esri.core.geometry.Geometry[] geoms = new com.esri.core.geometry.Geometry[6];
			geoms[0] = geom1;
			geoms[1] = geom2;
			geoms[2] = geom3;
			geoms[3] = geom4;
			geoms[4] = geom5;
			geoms[5] = geom6;
			com.esri.core.geometry.GeometryCursor cursor = new com.esri.core.geometry.SimpleGeometryCursor(geoms);
			// create convex hull from the cursor with b_merge set to true
			com.esri.core.geometry.GeometryCursor convex_hull_curs = bounding.Execute(cursor, true, null);
			com.esri.core.geometry.Polygon convex_hull = (com.esri.core.geometry.Polygon)(convex_hull_curs.Next());
			NUnit.Framework.Assert.IsTrue(convex_hull_curs.Next() == null);
			NUnit.Framework.Assert.IsTrue(bounding.IsConvex(convex_hull, null));
			com.esri.core.geometry.Point2D p1 = convex_hull.GetXY(0);
			com.esri.core.geometry.Point2D p2 = convex_hull.GetXY(1);
			com.esri.core.geometry.Point2D p3 = convex_hull.GetXY(2);
			com.esri.core.geometry.Point2D p4 = convex_hull.GetXY(3);
			com.esri.core.geometry.Point2D p5 = convex_hull.GetXY(4);
			com.esri.core.geometry.Point2D p6 = convex_hull.GetXY(5);
			NUnit.Framework.Assert.IsTrue(p1.x == 5.0 && p1.y == 11.0);
			NUnit.Framework.Assert.IsTrue(p2.x == 10.0 && p2.y == 10);
			NUnit.Framework.Assert.IsTrue(p3.x == 15.0 && p3.y == 1.25);
			NUnit.Framework.Assert.IsTrue(p4.x == 5.0 && p4.y == -5.0);
			NUnit.Framework.Assert.IsTrue(p5.x == -5.0 && p5.y == 1.25);
			NUnit.Framework.Assert.IsTrue(p6.x == 0.0 && p6.y == 10.0);
			// Test GeometryEngine
			com.esri.core.geometry.Geometry[] merged_hull = com.esri.core.geometry.GeometryEngine.ConvexHull(geoms, true);
			convex_hull = (com.esri.core.geometry.Polygon)merged_hull[0];
			p1 = convex_hull.GetXY(0);
			p2 = convex_hull.GetXY(1);
			p3 = convex_hull.GetXY(2);
			p4 = convex_hull.GetXY(3);
			p5 = convex_hull.GetXY(4);
			p6 = convex_hull.GetXY(5);
			NUnit.Framework.Assert.IsTrue(p1.x == 5.0 && p1.y == 11.0);
			NUnit.Framework.Assert.IsTrue(p2.x == 10.0 && p2.y == 10);
			NUnit.Framework.Assert.IsTrue(p3.x == 15.0 && p3.y == 1.25);
			NUnit.Framework.Assert.IsTrue(p4.x == 5.0 && p4.y == -5.0);
			NUnit.Framework.Assert.IsTrue(p5.x == -5.0 && p5.y == 1.25);
			NUnit.Framework.Assert.IsTrue(p6.x == 0.0 && p6.y == 10.0);
		}