public virtual void TestIsSimplePolygon_2RectanglesSideBySide()
		{
			// Two rectangles side by side, simple
			com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(-200, -100, 200, 100), false);
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(220, -50, 300, 50), false);
			bool result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(result);
			poly.ReverseAllPaths();
			result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
		}
		public virtual void TestIsSimplePolygonRectangleOneBelow()
		{
			// Two rectangles one below another, simple
			com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(50, 50, 100, 100), false);
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(50, 200, 100, 250), false);
			bool result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(result);
			poly.ReverseAllPaths();
			result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
		}
		public virtual void TestIsSimplePolygonRectangleHoleWrongDirection()
		{
			// Rectangle and rectangular hole that has wrong direction
			com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(-200, -100, 200, 100), false);
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(-100, -50, 100, 50), false);
			bool result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
			poly.ReverseAllPaths();
			result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
		}
		public virtual void TestIsSimplePolygonTriangle()
		{
			// Triangle
			com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
			poly.StartPath(0, 0);
			poly.LineTo(100, 100);
			poly.LineTo(100, 0);
			bool result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(result);
			poly.ReverseAllPaths();
			result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
		}
		public virtual void TestIsSimplePolygonRectangleHole()
		{
			// Rectangle and rectangular hole that has one segment overlapping
			// with the with the exterior ring. Cracking is needed.
			com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(-200, -100, 200, 100), false);
			poly.AddEnvelope(new com.esri.core.geometry.Envelope(-100, -100, 100, 50), true);
			bool result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
			poly.ReverseAllPaths();
			result = simplifyOp.IsSimpleAsFeature(poly, sr4326, false, null, null);
			NUnit.Framework.Assert.IsTrue(!result);
		}
		public virtual void TestReverseAllPaths()
		{
			com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
			poly.StartPath(10, 1);
			poly.LineTo(15, 20);
			poly.LineTo(30, 14);
			poly.LineTo(60, 144);
			poly.StartPath(10, 1);
			poly.LineTo(15, 20);
			poly.LineTo(300, 14);
			poly.LineTo(60, 144);
			poly.StartPath(10, 1);
			poly.LineTo(125, 20);
			poly.LineTo(30, 14);
			poly.LineTo(600, 144);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 0, 0,
			// 2);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 1, 0,
			// 3);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 2, 0,
			// 5);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 3, 0,
			// 7);
			//
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 4, 0,
			// 11);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 5, 0,
			// 13);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 6, 0,
			// 17);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 7, 0,
			// 19);
			//
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 8, 0,
			// 23);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 9, 0,
			// 29);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 10,
			// 0, 31);
			// poly.setAttribute(enum_value2(VertexDescription, Semantics, Z), 11,
			// 0, 37);
			double area = poly.CalculateArea2D();
			poly.ReverseAllPaths();
			double areaReversed = poly.CalculateArea2D();
			NUnit.Framework.Assert.IsTrue(System.Math.Abs(area + areaReversed) <= 0.001);
		}
		public static void TestPointInAnyOuterRing()
		{
			com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon();
			// outer ring1
			polygon.StartPath(-200, -100);
			polygon.LineTo(200, -100);
			polygon.LineTo(200, 100);
			polygon.LineTo(-190, 100);
			polygon.LineTo(-190, 90);
			polygon.LineTo(-200, 90);
			// hole
			polygon.StartPath(-100, 50);
			polygon.LineTo(100, 50);
			polygon.LineTo(100, -40);
			polygon.LineTo(90, -40);
			polygon.LineTo(90, -50);
			polygon.LineTo(-100, -50);
			// island
			polygon.StartPath(-10, -10);
			polygon.LineTo(10, -10);
			polygon.LineTo(10, 10);
			polygon.LineTo(-10, 10);
			// outer ring2
			polygon.StartPath(300, 300);
			polygon.LineTo(310, 300);
			polygon.LineTo(310, 310);
			polygon.LineTo(300, 310);
			polygon.ReverseAllPaths();
			com.esri.core.geometry.Point2D testPointIn1 = new com.esri.core.geometry.Point2D(1, 2);
			// inside the island
			com.esri.core.geometry.Point2D testPointIn2 = new com.esri.core.geometry.Point2D(190, 90);
			// inside, betwen outer
			// ring1 and the hole
			com.esri.core.geometry.Point2D testPointIn3 = new com.esri.core.geometry.Point2D(305, 305);
			// inside the outer ring2
			com.esri.core.geometry.Point2D testPointOut1 = new com.esri.core.geometry.Point2D(300, 2);
			// outside any
			com.esri.core.geometry.Point2D testPointOut2 = new com.esri.core.geometry.Point2D(-195, 95);
			// outside any (in the
			// concave area of outer
			// ring 2)
			com.esri.core.geometry.Point2D testPointOut3 = new com.esri.core.geometry.Point2D(99, 49);
			// outside (in the hole)
			com.esri.core.geometry.PolygonUtils.PiPResult res;
			// is_point_in_polygon_2D
			res = com.esri.core.geometry.PolygonUtils.IsPointInPolygon2D(polygon, testPointIn1, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInPolygon2D(polygon, testPointIn2, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInPolygon2D(polygon, testPointIn3, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInPolygon2D(polygon, testPointOut1, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInPolygon2D(polygon, testPointOut2, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInPolygon2D(polygon, testPointOut3, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside);
			// Ispoint_in_any_outer_ring
			res = com.esri.core.geometry.PolygonUtils.IsPointInAnyOuterRing(polygon, testPointIn1, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInAnyOuterRing(polygon, testPointIn2, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInAnyOuterRing(polygon, testPointIn3, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInAnyOuterRing(polygon, testPointOut1, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInAnyOuterRing(polygon, testPointOut2, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside);
			res = com.esri.core.geometry.PolygonUtils.IsPointInAnyOuterRing(polygon, testPointOut3, 0);
			NUnit.Framework.Assert.IsTrue(res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside);
		}