public virtual void TestIntersectBetweenPolylineAndPolygon()
		{
			com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
			basePl.StartPath(new com.esri.core.geometry.Point(-117, 20));
			basePl.LineTo(new com.esri.core.geometry.Point(-117, 10));
			basePl.LineTo(new com.esri.core.geometry.Point(-130, 10));
			basePl.LineTo(new com.esri.core.geometry.Point(-130, 20));
			basePl.LineTo(new com.esri.core.geometry.Point(-117, 20));
			com.esri.core.geometry.Polygon compPl = new com.esri.core.geometry.Polygon();
			compPl.StartPath(-116, 20);
			compPl.LineTo(-131, 10);
			compPl.LineTo(-121, 50);
			com.esri.core.geometry.Geometry intersectGeom = null;
			int noException = 1;
			// no exception
			try
			{
				intersectGeom = com.esri.core.geometry.GeometryEngine.Intersect(basePl, compPl, com.esri.core.geometry.SpatialReference.Create(4326));
			}
			catch (System.Exception)
			{
				noException = 0;
			}
			NUnit.Framework.Assert.IsNotNull(intersectGeom);
		}
		public virtual void TestPointAndPolyline1()
		{
			com.esri.core.geometry.Point basePl = new com.esri.core.geometry.Point(-116, 20);
			com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
			compPl.StartPath(new com.esri.core.geometry.Point(-116, 20));
			compPl.LineTo(new com.esri.core.geometry.Point(-131, 10));
			compPl.LineTo(new com.esri.core.geometry.Point(-121, 50));
			int noException = 1;
			// no exception
			com.esri.core.geometry.Geometry intersectGeom = null;
			try
			{
				intersectGeom = com.esri.core.geometry.GeometryEngine.Intersect(basePl, compPl, com.esri.core.geometry.SpatialReference.Create(4326));
			}
			catch (System.Exception)
			{
				noException = 0;
			}
			NUnit.Framework.Assert.AreEqual(noException, 1);
			NUnit.Framework.Assert.IsNotNull(intersectGeom);
			NUnit.Framework.Assert.IsTrue(intersectGeom.GetType() == com.esri.core.geometry.Geometry.Type.Point);
			com.esri.core.geometry.Point ip = (com.esri.core.geometry.Point)intersectGeom;
			NUnit.Framework.Assert.AreEqual(ip.GetX(), -116, 0.1E7);
			NUnit.Framework.Assert.AreEqual(ip.GetY(), 20, 0.1E7);
		}
		public static com.esri.core.geometry.Polyline MakePolyline()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			// 0
			poly.StartPath(0, 40);
			poly.LineTo(30, 0);
			// 1
			poly.StartPath(20, 70);
			poly.LineTo(45, 100);
			// 2
			poly.StartPath(50, 100);
			poly.LineTo(50, 60);
			// 3
			poly.StartPath(35, 25);
			poly.LineTo(65, 45);
			// 4
			poly.StartPath(60, 10);
			poly.LineTo(65, 35);
			// 5
			poly.StartPath(60, 60);
			poly.LineTo(100, 60);
			// 6
			poly.StartPath(80, 10);
			poly.LineTo(80, 99);
			// 7
			poly.StartPath(60, 60);
			poly.LineTo(65, 35);
			return poly;
		}
		public static void Test2()
		{
			com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance();
			com.esri.core.geometry.OperatorGeneralize op = (com.esri.core.geometry.OperatorGeneralize)engine.GetOperator(com.esri.core.geometry.Operator.Type.Generalize);
			com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline();
			polyline.StartPath(0, 0);
			polyline.LineTo(1, 1);
			polyline.LineTo(2, 0);
			polyline.LineTo(3, 2);
			polyline.LineTo(4, 1);
			polyline.LineTo(5, 0);
			polyline.LineTo(5, 10);
			polyline.LineTo(0, 10);
			com.esri.core.geometry.Geometry geom = op.Execute(polyline, 2, true, null);
			com.esri.core.geometry.Polyline p = (com.esri.core.geometry.Polyline)geom;
			com.esri.core.geometry.Point2D[] points = p.GetCoordinates2D();
			NUnit.Framework.Assert.IsTrue(points.Length == 4);
			NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0);
			NUnit.Framework.Assert.IsTrue(points[1].x == 5 && points[1].y == 0);
			NUnit.Framework.Assert.IsTrue(points[2].x == 5 && points[2].y == 10);
			NUnit.Framework.Assert.IsTrue(points[3].x == 0 && points[3].y == 10);
			com.esri.core.geometry.Geometry geom1 = op.Execute(geom, 5, false, null);
			p = (com.esri.core.geometry.Polyline)geom1;
			points = p.GetCoordinates2D();
			NUnit.Framework.Assert.IsTrue(points.Length == 2);
			NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0);
			NUnit.Framework.Assert.IsTrue(points[1].x == 0 && points[1].y == 10);
			geom1 = op.Execute(geom, 5, true, null);
			p = (com.esri.core.geometry.Polyline)geom1;
			points = p.GetCoordinates2D();
			NUnit.Framework.Assert.IsTrue(points.Length == 2);
			NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0);
			NUnit.Framework.Assert.IsTrue(points[1].x == 0 && points[1].y == 10);
		}
Ejemplo n.º 5
0
		public static void testCR254240()
		{
			com.esri.core.geometry.OperatorProximity2D proximityOp = com.esri.core.geometry.OperatorProximity2D
				.local();
			com.esri.core.geometry.Point inputPoint = new com.esri.core.geometry.Point(-12, 12
				);
			com.esri.core.geometry.Polyline line = new com.esri.core.geometry.Polyline();
			line.startPath(-10, 0);
			line.lineTo(0, 0);
			com.esri.core.geometry.Proximity2DResult result = proximityOp.getNearestCoordinate
				(line, inputPoint, false, true);
			NUnit.Framework.Assert.IsTrue(result.isRightSide() == false);
		}
Ejemplo n.º 6
0
 public virtual void testSerializePolyline()
 {
     try
     {
         java.io.ByteArrayOutputStream   streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream      oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.Polyline pt        = new com.esri.core.geometry.Polyline();
         pt.startPath(10, 10);
         pt.lineTo(100, 100);
         pt.lineTo(200, 100);
         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.Polyline ptRes = (com.esri.core.geometry.Polyline)ii.readObject
                                                     ();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         fail("Polyline serialization failure");
     }
     // try
     // {
     // FileOutputStream streamOut = new FileOutputStream(m_thisDirectory +
     // "savedPolyline.txt");
     // ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     // Polyline pt = new Polyline();
     // pt.startPath(10, 10);
     // pt.lineTo(100, 100);
     // pt.lineTo(200, 100);
     // oo.writeObject(pt);
     // }
     // catch(Exception ex)
     // {
     // fail("Polyline serialization failure");
     // }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedPolyline.txt");
         java.io.ObjectInputStream       ii    = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.Polyline ptRes = (com.esri.core.geometry.Polyline)ii.readObject
                                                     ();
         NUnit.Framework.Assert.IsTrue(ptRes != null);
     }
     catch (System.Exception)
     {
         fail("Polyline serialization failure");
     }
 }
		public static void Test3()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(0, System.Math.Sqrt(0.0));
			poly.LineTo(0, System.Math.Sqrt(5.0));
			poly.StartPath(0, System.Math.Sqrt(8.0));
			poly.LineTo(0, System.Math.Sqrt(10.0));
			poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, System.Math.Sqrt(3.0));
			poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, System.Math.Sqrt(5.0));
			poly.InterpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 1, 0);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == System.Math.Sqrt(3.0));
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == System.Math.Sqrt(5.0));
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == System.Math.Sqrt(5.0));
		}
        public virtual void testLocalExport()
        {
            string s = com.esri.core.geometry.OperatorExportToJson.local().execute(null, new
                                                                                   com.esri.core.geometry.Point(1000000.2, 2000000.3));

            //assertTrue(s.contains("."));
            //assertFalse(s.contains(","));
            com.esri.core.geometry.Polyline line = new com.esri.core.geometry.Polyline();
            line.startPath(1.1, 2.2);
            line.lineTo(2.3, 4.5);
            string s1 = com.esri.core.geometry.OperatorExportToJson.local().execute(null, line
                                                                                    );

            NUnit.Framework.Assert.IsTrue(s.contains("."));
        }
Ejemplo n.º 9
0
        public virtual void testTouchesBetweenPointAndLine()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.Point    p      = new com.esri.core.geometry.Point(2, 4);
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(2, 4);
            compPl.lineTo(9, 4);
            compPl.lineTo(9, 9);
            compPl.lineTo(2, 9);
            compPl.lineTo(2, 4);
            bool isTouched = com.esri.core.geometry.GeometryEngine.touches(p, compPl, sr);

            NUnit.Framework.Assert.IsTrue(!isTouched);
        }
Ejemplo n.º 10
0
 public static com.esri.core.geometry.Polyline makePolyline1()
 {
     com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
     poly.startPath(0, 0);
     poly.lineTo(2, 0);
     poly.lineTo(4, 0);
     poly.lineTo(6, 0);
     poly.lineTo(8, 0);
     poly.lineTo(10, 0);
     poly.lineTo(12, 0);
     poly.lineTo(14, 0);
     poly.lineTo(16, 0);
     poly.lineTo(18, 0);
     poly.lineTo(20, 0);
     return(poly);
 }
Ejemplo n.º 11
0
        public static void testConsiderTouch1(com.esri.core.geometry.SpatialReference spatialReference
                                              )
        {
            com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                                 .getInstance();
            com.esri.core.geometry.OperatorCut opCut = (com.esri.core.geometry.OperatorCut)engine
                                                       .getOperator(com.esri.core.geometry.Operator.Type.Cut);
            com.esri.core.geometry.Polyline       polyline1 = makePolyline1();
            com.esri.core.geometry.Polyline       cutter1   = makePolylineCutter1();
            com.esri.core.geometry.GeometryCursor cursor    = opCut.execute(true, polyline1, cutter1
                                                                            , spatialReference, null);
            com.esri.core.geometry.Polyline cut;
            int    pathCount;
            int    segmentCount;
            double length;

            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 4);
            NUnit.Framework.Assert.IsTrue(segmentCount == 4);
            NUnit.Framework.Assert.IsTrue(length == 6);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 6);
            NUnit.Framework.Assert.IsTrue(segmentCount == 8);
            NUnit.Framework.Assert.IsTrue(length == 12);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            NUnit.Framework.Assert.IsTrue(segmentCount == 1);
            NUnit.Framework.Assert.IsTrue(length == 1);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            NUnit.Framework.Assert.IsTrue(segmentCount == 1);
            NUnit.Framework.Assert.IsTrue(length == 1);
            cut = (com.esri.core.geometry.Polyline)cursor.next();
            NUnit.Framework.Assert.IsTrue(cut == null);
        }
Ejemplo n.º 12
0
        public virtual void testTouchesBetweenPolylines()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.Polyline pl = new com.esri.core.geometry.Polyline();
            pl.startPath(2, 4);
            pl.lineTo(9, 9);
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(2, 4);
            compPl.lineTo(9, 4);
            compPl.lineTo(9, 9);
            compPl.lineTo(2, 9);
            compPl.lineTo(2, 4);
            bool isTouched = com.esri.core.geometry.GeometryEngine.touches(pl, compPl, sr);

            NUnit.Framework.Assert.AreEqual(isTouched, true);
        }
Ejemplo n.º 13
0
 public virtual void OffsetPolyline_(double distance, com.esri.core.geometry.OperatorOffset.JoinType
                                     joins)
 {
     com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline();
     polyline.startPath(0, 0);
     polyline.lineTo(6, 0);
     polyline.lineTo(6, 1);
     polyline.lineTo(4, 1);
     polyline.lineTo(4, 2);
     polyline.lineTo(10, 2);
     com.esri.core.geometry.OperatorOffset offset = (com.esri.core.geometry.OperatorOffset
                                                     )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                            .Offset);
     com.esri.core.geometry.Geometry outputGeom = offset.execute(polyline, null, distance
                                                                 , joins, 2, 0, null);
     NUnit.Framework.Assert.IsNotNull(outputGeom);
 }
Ejemplo n.º 14
0
        public static void testDifferenceOnPolyline()
        {
            // # * * #
            // # * @
            // # @ *
            // # *
            //
            // ///////////////////////////////
            //
            // The polyline drawn in *s represents basePl
            // The polyline drawn in #s represents compPl
            // The @ represents their intersection points, so that
            // the difference polyline will be basePl with two new vertices @ added.
            com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
            basePl.startPath(new com.esri.core.geometry.Point(-117, 20));
            basePl.lineTo(new com.esri.core.geometry.Point(-130, 10));
            basePl.lineTo(new com.esri.core.geometry.Point(-120, 50));
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(new com.esri.core.geometry.Point(-116, 20));
            compPl.lineTo(new com.esri.core.geometry.Point(-131, 10));
            compPl.lineTo(new com.esri.core.geometry.Point(-121, 50));
            com.esri.core.geometry.Geometry diffGeom = com.esri.core.geometry.GeometryEngine.
                                                       difference(basePl, compPl, com.esri.core.geometry.SpatialReference.create(4326));
            NUnit.Framework.Assert.IsTrue(diffGeom is com.esri.core.geometry.Polyline);
            com.esri.core.geometry.Polyline diffPolyline = (com.esri.core.geometry.Polyline)diffGeom;
            int pointCountDiffPolyline = diffPolyline.getPointCount();

            // first line in comp_pl is 3y = 2x + 292
            NUnit.Framework.Assert.AreEqual(3 * 20, 2 * (-116) + 292);
            NUnit.Framework.Assert.AreEqual(3 * 10, 2 * (-131) + 292);
            // new points should also lie on this line
            NUnit.Framework.Assert.IsTrue(3.0 * diffPolyline.getCoordinates2D()[1].y - 2.0 *
                                          diffPolyline.getCoordinates2D()[1].x - 292.0 == 0.0);
            NUnit.Framework.Assert.IsTrue(3.0 * diffPolyline.getCoordinates2D()[3].y - 2.0 *
                                          diffPolyline.getCoordinates2D()[3].x - 292.0 == 0.0);
            for (int i = 0; i < 3; i++)
            {
                NUnit.Framework.Assert.IsTrue(basePl.getCoordinates2D()[i].x == diffPolyline.getCoordinates2D
                                                  ()[2 * i].x);
                NUnit.Framework.Assert.IsTrue(basePl.getCoordinates2D()[i].y == diffPolyline.getCoordinates2D
                                                  ()[2 * i].y);
            }
            NUnit.Framework.Assert.AreEqual(5, pointCountDiffPolyline);
        }
Ejemplo n.º 15
0
        public static void testDistanceBetweenVariousGeometries()
        {
            com.esri.core.geometry.Polygon    polygon    = makePolygon();
            com.esri.core.geometry.Polyline   polyline   = makePolyline();
            com.esri.core.geometry.MultiPoint multipoint = makeMultiPoint();
            com.esri.core.geometry.Point      point      = makePoint();
            // SpatialReference spatialRef =
            // SpatialReference.create(3857);//PCS_WGS_1984_WEB_MERCATOR_AUXSPHERE
            double distance;

            distance = com.esri.core.geometry.GeometryEngine.distance(polygon, polyline, null
                                                                      );
            NUnit.Framework.Assert.IsTrue(System.Math.abs(distance - 5.0) < 0.00001);
            distance = com.esri.core.geometry.GeometryEngine.distance(polygon, multipoint, null
                                                                      );
            NUnit.Framework.Assert.IsTrue(System.Math.abs(distance - 5.0) < 0.00001);
            distance = com.esri.core.geometry.GeometryEngine.distance(polygon, point, null);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(distance - 5.0) < 0.00001);
        }
Ejemplo n.º 16
0
        public virtual void testRelationTouch()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
            basePl.startPath(2, 2);
            basePl.lineTo(2, 10);
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(2, 4);
            compPl.lineTo(9, 4);
            compPl.lineTo(9, 9);
            compPl.lineTo(2, 9);
            compPl.lineTo(2, 4);
            bool isTouched = false;

            // GeometryEngine.relation(basePl, compPl, sr,
            // "G1 TOUCH G2");
            NUnit.Framework.Assert.AreEqual(isTouched, false);
        }
 public static void test3()
 {
     com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
     poly.startPath(0, System.Math.sqrt(0.0));
     poly.lineTo(0, System.Math.sqrt(5.0));
     poly.startPath(0, System.Math.sqrt(8.0));
     poly.lineTo(0, System.Math.sqrt(10.0));
     poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, System.Math
                       .sqrt(3.0));
     poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, System.Math
                       .sqrt(5.0));
     poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M,
                                0, 0, 1, 0);
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 0, 0) == System.Math.sqrt(3.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 1, 0) == System.Math.sqrt(5.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 2, 0) == System.Math.sqrt(5.0));
 }
		public static void Test1()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(0, 0);
			poly.LineTo(0, 1.0 / 3.0);
			poly.LineTo(0, 2.0 / 3.0);
			poly.LineTo(0, 4.0 / 3.0);
			poly.LineTo(0, System.Math.Sqrt(6.0));
			poly.LineTo(0, System.Math.Sqrt(7.0));
			poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 3);
			poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 5);
			poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 7);
			poly.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0, 11);
			poly.InterpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 0, 1);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 3);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 5);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 7);
			NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0)));
			NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0)));
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0) == 11);
			poly.InterpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 1, 0, 2);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 3);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 5);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 7);
			NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0)));
			NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.IsNaN(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0)));
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0) == 11);
			poly.InterpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 2, 0, 5);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 3);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 5);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 7);
			double a3 = poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0);
			NUnit.Framework.Assert.IsTrue(a3 > 7 && a3 < 11);
			double a4 = poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0);
			NUnit.Framework.Assert.IsTrue(a4 > a3 && a4 < 11);
			NUnit.Framework.Assert.IsTrue(poly.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0) == 11);
			poly.StartPath(0, System.Math.Sqrt(8.0));
			poly.LineTo(0, System.Math.Sqrt(10.0));
			poly.LineTo(0, System.Math.Sqrt(11.0));
		}
 public static void test4()
 {
     com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
     poly.startPath(0, System.Math.sqrt(0.0));
     poly.lineTo(0, System.Math.sqrt(1.0));
     poly.startPath(0, System.Math.sqrt(1.0));
     poly.lineTo(0, System.Math.sqrt(2.0));
     poly.startPath(0, System.Math.sqrt(2.0));
     poly.lineTo(0, System.Math.sqrt(3.0));
     poly.startPath(0, System.Math.sqrt(3.0));
     poly.lineTo(0, System.Math.sqrt(4.0));
     poly.startPath(0, System.Math.sqrt(4.0));
     poly.lineTo(0, System.Math.sqrt(5.0));
     poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, System.Math
                       .sqrt(1.0));
     poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 8, 0, System.Math
                       .sqrt(4.0));
     poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M,
                                0, 1, 4, 0);
     NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl
                                                                                (com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0)));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 1, 0) == System.Math.sqrt(1.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 2, 0) == System.Math.sqrt(1.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 3, 0) == System.Math.sqrt(2.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 4, 0) == System.Math.sqrt(2.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 5, 0) == System.Math.sqrt(3.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 6, 0) == System.Math.sqrt(3.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 7, 0) == System.Math.sqrt(4.0));
     NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                          .M, 8, 0) == System.Math.sqrt(4.0));
     NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl
                                                                                (com.esri.core.geometry.VertexDescription.Semantics.M, 9, 0)));
 }
Ejemplo n.º 20
0
		public virtual void TestTouchOnPointAndPolyline()
		{
			com.esri.core.geometry.Geometry baseGeom = new com.esri.core.geometry.Point(-130, 10);
			com.esri.core.geometry.Polyline pl = new com.esri.core.geometry.Polyline();
			pl.StartPath(new com.esri.core.geometry.Point(-130, 10));
			pl.LineTo(-131, 15);
			pl.LineTo(-140, 20);
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			bool isTouched;
			bool isTouched2;
			try
			{
				isTouched = com.esri.core.geometry.GeometryEngine.Touches(baseGeom, pl, sr);
				isTouched2 = com.esri.core.geometry.GeometryEngine.Touches(pl, baseGeom, sr);
			}
			catch (System.ArgumentException)
			{
				isTouched = false;
				isTouched2 = false;
			}
			NUnit.Framework.Assert.AreEqual(isTouched && isTouched2, true);
		}
Ejemplo n.º 21
0
        public virtual void testTouchesBetweenMultipartPolylines()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.Polyline pl = new com.esri.core.geometry.Polyline();
            pl.startPath(2, 4);
            pl.lineTo(1, 10);
            pl.lineTo(6, 12);
            pl.startPath(6, 12);
            pl.lineTo(12, 12);
            pl.lineTo(9, 9);
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(2, 4);
            compPl.lineTo(2, 9);
            compPl.lineTo(9, 9);
            compPl.lineTo(9, 4);
            compPl.startPath(2, 9);
            compPl.lineTo(6, 12);
            compPl.lineTo(9, 10);
            bool isTouched = com.esri.core.geometry.GeometryEngine.touches(pl, compPl, sr);

            NUnit.Framework.Assert.IsTrue(!isTouched);
        }
Ejemplo n.º 22
0
        public virtual void testPointAndPolyline2()
        {
            com.esri.core.geometry.Point    basePl = new com.esri.core.geometry.Point(-115, 20);
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(new com.esri.core.geometry.Point(-116, 20));
            compPl.lineTo(new com.esri.core.geometry.Point(-131, 10));
            compPl.lineTo(new com.esri.core.geometry.Point(-121, 50));
            int noException = 1;

            // no exception
            com.esri.core.geometry.Geometry intersectGeom = null;
            try
            {
                intersectGeom = com.esri.core.geometry.GeometryEngine.intersect(basePl, compPl, com.esri.core.geometry.SpatialReference
                                                                                .create(4326));
            }
            catch (System.Exception)
            {
                noException = 0;
            }
            NUnit.Framework.Assert.AreEqual(noException, 1);
            NUnit.Framework.Assert.IsTrue(intersectGeom.isEmpty());
        }
Ejemplo n.º 23
0
        public virtual void testIntersectBetweenPolylines()
        {
            com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
            basePl.startPath(new com.esri.core.geometry.Point(-117, 20));
            basePl.lineTo(new com.esri.core.geometry.Point(-130, 10));
            basePl.lineTo(new com.esri.core.geometry.Point(-120, 50));
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(new com.esri.core.geometry.Point(-116, 20));
            compPl.lineTo(new com.esri.core.geometry.Point(-131, 10));
            compPl.lineTo(new com.esri.core.geometry.Point(-121, 50));
            int noException = 1;

            // no exception
            try
            {
                com.esri.core.geometry.Geometry intersectGeom = com.esri.core.geometry.GeometryEngine
                                                                .intersect(basePl, compPl, com.esri.core.geometry.SpatialReference.create(4326));
            }
            catch (System.Exception)
            {
                noException = 0;
            }
            NUnit.Framework.Assert.AreEqual(noException, 1);
        }
Ejemplo n.º 24
0
 public static void test2()
 {
     com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                          .getInstance();
     com.esri.core.geometry.OperatorGeneralize op = (com.esri.core.geometry.OperatorGeneralize
                                                     )engine.getOperator(com.esri.core.geometry.Operator.Type.Generalize);
     com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline();
     polyline.startPath(0, 0);
     polyline.lineTo(1, 1);
     polyline.lineTo(2, 0);
     polyline.lineTo(3, 2);
     polyline.lineTo(4, 1);
     polyline.lineTo(5, 0);
     polyline.lineTo(5, 10);
     polyline.lineTo(0, 10);
     com.esri.core.geometry.Geometry  geom   = op.execute(polyline, 2, true, null);
     com.esri.core.geometry.Polyline  p      = (com.esri.core.geometry.Polyline)geom;
     com.esri.core.geometry.Point2D[] points = p.getCoordinates2D();
     NUnit.Framework.Assert.IsTrue(points.Length == 4);
     NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0);
     NUnit.Framework.Assert.IsTrue(points[1].x == 5 && points[1].y == 0);
     NUnit.Framework.Assert.IsTrue(points[2].x == 5 && points[2].y == 10);
     NUnit.Framework.Assert.IsTrue(points[3].x == 0 && points[3].y == 10);
     com.esri.core.geometry.Geometry geom1 = op.execute(geom, 5, false, null);
     p      = (com.esri.core.geometry.Polyline)geom1;
     points = p.getCoordinates2D();
     NUnit.Framework.Assert.IsTrue(points.Length == 2);
     NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0);
     NUnit.Framework.Assert.IsTrue(points[1].x == 0 && points[1].y == 10);
     geom1  = op.execute(geom, 5, true, null);
     p      = (com.esri.core.geometry.Polyline)geom1;
     points = p.getCoordinates2D();
     NUnit.Framework.Assert.IsTrue(points.Length == 2);
     NUnit.Framework.Assert.IsTrue(points[0].x == 0 && points[0].y == 0);
     NUnit.Framework.Assert.IsTrue(points[1].x == 0 && points[1].y == 10);
 }
		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);
			}
		}
Ejemplo n.º 26
0
 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 static void TestCR254240()
		{
			com.esri.core.geometry.OperatorProximity2D proximityOp = com.esri.core.geometry.OperatorProximity2D.Local();
			com.esri.core.geometry.Point inputPoint = new com.esri.core.geometry.Point(-12, 12);
			com.esri.core.geometry.Polyline line = new com.esri.core.geometry.Polyline();
			line.StartPath(-10, 0);
			line.LineTo(0, 0);
			com.esri.core.geometry.Proximity2DResult result = proximityOp.GetNearestCoordinate(line, inputPoint, false, true);
			NUnit.Framework.Assert.IsTrue(result.IsRightSide() == false);
		}
Ejemplo n.º 28
0
		public virtual void TestTouchesOnPolylines()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
			basePl.StartPath(new com.esri.core.geometry.Point(-117, 20));
			basePl.LineTo(new com.esri.core.geometry.Point(-100, 20));
			basePl.LineTo(new com.esri.core.geometry.Point(-100, 10));
			basePl.LineTo(new com.esri.core.geometry.Point(-117, 10));
			basePl.LineTo(new com.esri.core.geometry.Point(-117, 20));
			com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
			compPl.StartPath(new com.esri.core.geometry.Point(-104, 20));
			compPl.LineTo(new com.esri.core.geometry.Point(-108, 25));
			compPl.LineTo(new com.esri.core.geometry.Point(-100, 20));
			// compPl.lineTo(new Point(-100, 30));
			// compPl.lineTo(new Point(-117, 30));
			// compPl.lineTo(new Point(-117, 20));
			bool isTouched;
			try
			{
				isTouched = com.esri.core.geometry.GeometryEngine.Touches(basePl, compPl, sr);
			}
			catch (System.ArgumentException)
			{
				isTouched = false;
			}
			NUnit.Framework.Assert.AreEqual(isTouched, true);
		}
Ejemplo n.º 29
0
		public virtual void TestTouchesBetweenMultipartPolylines()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Polyline pl = new com.esri.core.geometry.Polyline();
			pl.StartPath(2, 4);
			pl.LineTo(1, 10);
			pl.LineTo(6, 12);
			pl.StartPath(6, 12);
			pl.LineTo(12, 12);
			pl.LineTo(9, 9);
			com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
			compPl.StartPath(2, 4);
			compPl.LineTo(2, 9);
			compPl.LineTo(9, 9);
			compPl.LineTo(9, 4);
			compPl.StartPath(2, 9);
			compPl.LineTo(6, 12);
			compPl.LineTo(9, 10);
			bool isTouched = com.esri.core.geometry.GeometryEngine.Touches(pl, compPl, sr);
			NUnit.Framework.Assert.IsTrue(!isTouched);
		}
Ejemplo n.º 30
0
		public static com.esri.core.geometry.Polyline MakePolyline1()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(0, 0);
			poly.LineTo(2, 0);
			poly.LineTo(4, 0);
			poly.LineTo(6, 0);
			poly.LineTo(8, 0);
			poly.LineTo(10, 0);
			poly.LineTo(12, 0);
			poly.LineTo(14, 0);
			poly.LineTo(16, 0);
			poly.LineTo(18, 0);
			poly.LineTo(20, 0);
			return poly;
		}
		public static void TestEditShape_()
		{
			{
				// std::shared_ptr<Esri_runtimecore::Geometry::Polygon> poly_base_6
				// = std::make_shared<Esri_runtimecore::Geometry::Polygon>();
				// Single part polygon
				com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
				poly.StartPath(10, 10);
				poly.LineTo(10, 12);
				poly.LineTo(14, 15);
				poly.LineTo(10, 11);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
			}
			{
				// Two part poly
				com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
				poly.StartPath(10, 10);
				poly.LineTo(10, 12);
				poly.LineTo(14, 15);
				poly.LineTo(10, 11);
				poly.StartPath(100, 10);
				poly.LineTo(100, 12);
				poly.LineTo(14, 150);
				poly.LineTo(10, 101);
				poly.LineTo(100, 11);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
			}
			{
				// Single part polyline
				com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
				poly.StartPath(10, 10);
				poly.LineTo(10, 12);
				poly.LineTo(14, 15);
				poly.LineTo(10, 11);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
			}
			{
				// Two part poly
				com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
				poly.StartPath(10, 10);
				poly.LineTo(10, 12);
				poly.LineTo(14, 15);
				poly.LineTo(10, 11);
				poly.StartPath(100, 10);
				poly.LineTo(100, 12);
				poly.LineTo(14, 150);
				poly.LineTo(10, 101);
				poly.LineTo(100, 11);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
			}
			{
				// Five part poly. Close one of parts to test if it works.
				com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
				poly.StartPath(10, 10);
				poly.LineTo(10, 12);
				poly.LineTo(14, 15);
				poly.LineTo(10, 11);
				poly.StartPath(100, 10);
				poly.LineTo(100, 12);
				poly.LineTo(14, 150);
				poly.LineTo(10, 101);
				poly.LineTo(100, 11);
				poly.StartPath(1100, 101);
				poly.LineTo(1300, 132);
				poly.LineTo(144, 150);
				poly.LineTo(106, 1051);
				poly.LineTo(1600, 161);
				poly.StartPath(100, 190);
				poly.LineTo(1800, 192);
				poly.LineTo(184, 8150);
				poly.LineTo(1080, 181);
				poly.StartPath(1030, 10);
				poly.LineTo(1300, 132);
				poly.LineTo(314, 3150);
				poly.LineTo(310, 1301);
				poly.LineTo(3100, 311);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				editShape.SetClosedPath(editShape.GetNextPath(editShape.GetFirstPath(geom)), true);
				((com.esri.core.geometry.MultiPathImpl)poly._getImpl()).ClosePathWithLine(1);
				com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
			}
			{
				// Test erase
				com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
				poly.StartPath(10, 10);
				poly.LineTo(10, 12);
				poly.LineTo(314, 3150);
				poly.LineTo(310, 1301);
				poly.LineTo(3100, 311);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				int vertex = editShape.GetFirstVertex(editShape.GetFirstPath(geom));
				vertex = editShape.RemoveVertex(vertex, true);
				vertex = editShape.GetNextVertex(vertex);
				editShape.RemoveVertex(vertex, true);
				com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape.GetGeometry(geom);
				poly.SetEmpty();
				poly.StartPath(10, 12);
				poly.LineTo(310, 1301);
				poly.LineTo(3100, 311);
				NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
			}
			{
				// Test erase
				com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
				poly.StartPath(10, 10);
				poly.LineTo(10, 12);
				poly.LineTo(314, 3150);
				poly.LineTo(310, 1301);
				poly.LineTo(3100, 311);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				int vertex = editShape.GetFirstVertex(editShape.GetFirstPath(geom));
				vertex = editShape.RemoveVertex(vertex, true);
				vertex = editShape.GetNextVertex(vertex);
				editShape.RemoveVertex(vertex, true);
				com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.GetGeometry(geom);
				poly.SetEmpty();
				poly.StartPath(10, 12);
				poly.LineTo(310, 1301);
				poly.LineTo(3100, 311);
				NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
			}
			{
				// Test Filter Close Points
				com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
				poly.StartPath(10, 10);
				poly.LineTo(10, 10.001);
				poly.LineTo(10.001, 10);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				editShape.FilterClosePoints(0.002, true, false);
				com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(poly2.IsEmpty());
			}
			{
				// Test Filter Close Points
				com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
				poly.StartPath(10, 10);
				poly.LineTo(10, 10.0025);
				poly.LineTo(11.0, 10);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				editShape.FilterClosePoints(0.002, true, false);
				com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(!poly2.IsEmpty());
			}
			{
				// Test Filter Close Points
				com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
				poly.StartPath(10, 10);
				poly.LineTo(10, 10.001);
				poly.LineTo(11.0, 10);
				com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape();
				int geom = editShape.AddGeometry(poly);
				editShape.FilterClosePoints(0.002, true, false);
				com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.GetGeometry(geom);
				NUnit.Framework.Assert.IsTrue(poly2.IsEmpty());
			}
			{
				// Test attribute splitting 1
				com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline();
				polyline.StartPath(0, 0);
				polyline.LineTo(1, 1);
				polyline.LineTo(2, 2);
				polyline.LineTo(3, 3);
				polyline.LineTo(4, 4);
				polyline.StartPath(5, 5);
				polyline.LineTo(6, 6);
				polyline.LineTo(7, 7);
				polyline.LineTo(8, 8);
				polyline.LineTo(9, 9);
				polyline.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0, 4);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0, 8);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0, 12);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 3, 0, 16);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 4, 0, 20);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 5, 0, 22);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 6, 0, 26);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 7, 0, 30);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 8, 0, 34);
				polyline.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 9, 0, 38);
				com.esri.core.geometry.EditShape shape = new com.esri.core.geometry.EditShape();
				int geometry = shape.AddGeometry(polyline);
				com.esri.core.geometry.AttributeStreamOfInt32 vertex_handles = new com.esri.core.geometry.AttributeStreamOfInt32(0);
				for (int path = shape.GetFirstPath(geometry); path != -1; path = shape.GetNextPath(path))
				{
					for (int vertex = shape.GetFirstVertex(path); vertex != -1; vertex = shape.GetNextVertex(vertex))
					{
						if (vertex != shape.GetLastVertex(path))
						{
							vertex_handles.Add(vertex);
						}
					}
				}
				double[] t = new double[1];
				for (int i = 0; i < vertex_handles.Size(); i++)
				{
					int vertex = vertex_handles.Read(i);
					t[0] = 0.5;
					shape.SplitSegment(vertex, t, 1);
				}
				com.esri.core.geometry.Polyline chopped_polyline = (com.esri.core.geometry.Polyline)shape.GetGeometry(geometry);
				NUnit.Framework.Assert.IsTrue(chopped_polyline.GetPointCount() == 18);
				double att_ = 4;
				for (int i_1 = 0; i_1 < 18; i_1++)
				{
					double att = chopped_polyline.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, i_1, 0);
					NUnit.Framework.Assert.IsTrue(att == att_);
					att_ += 2;
				}
			}
			{
				// Test attribute splitting 2
				com.esri.core.geometry.Polyline line1 = new com.esri.core.geometry.Polyline();
				com.esri.core.geometry.Polyline line2 = new com.esri.core.geometry.Polyline();
				line1.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
				line2.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
				line1.StartPath(0, 0);
				line1.LineTo(10, 10);
				line2.StartPath(10, 0);
				line2.LineTo(0, 10);
				line1.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 7);
				line1.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 17);
				line2.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 5);
				line2.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 15);
				com.esri.core.geometry.EditShape shape = new com.esri.core.geometry.EditShape();
				int g1 = shape.AddGeometry(line1);
				int g2 = shape.AddGeometry(line2);
				com.esri.core.geometry.CrackAndCluster.Execute(shape, 0.001, null, true);
				com.esri.core.geometry.Polyline chopped_line1 = (com.esri.core.geometry.Polyline)shape.GetGeometry(g1);
				com.esri.core.geometry.Polyline chopped_line2 = (com.esri.core.geometry.Polyline)shape.GetGeometry(g2);
				double att1 = chopped_line1.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0);
				double att2 = chopped_line2.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0);
				NUnit.Framework.Assert.IsTrue(att1 == 12);
				NUnit.Framework.Assert.IsTrue(att2 == 10);
			}
			{
				// Test attribute splitting 3
				com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon();
				polygon.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
				polygon.StartPath(0, 0);
				polygon.LineTo(0, 10);
				polygon.LineTo(10, 10);
				polygon.LineTo(10, 0);
				polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 7);
				polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 17);
				polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 23);
				polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0, 43);
				com.esri.core.geometry.EditShape shape = new com.esri.core.geometry.EditShape();
				int geometry = shape.AddGeometry(polygon);
				com.esri.core.geometry.AttributeStreamOfInt32 vertex_handles = new com.esri.core.geometry.AttributeStreamOfInt32(0);
				int start_v = shape.GetFirstVertex(shape.GetFirstPath(geometry));
				int v = start_v;
				do
				{
					vertex_handles.Add(v);
					v = shape.GetNextVertex(v);
				}
				while (v != start_v);
				double[] t = new double[1];
				for (int i = 0; i < vertex_handles.Size(); i++)
				{
					int v1 = vertex_handles.Read(i);
					t[0] = 0.5;
					shape.SplitSegment(v1, t, 1);
				}
				com.esri.core.geometry.Polygon cut_polygon = (com.esri.core.geometry.Polygon)shape.GetGeometry(geometry);
				NUnit.Framework.Assert.IsTrue(cut_polygon.GetPointCount() == 8);
				com.esri.core.geometry.Point2D pt0 = cut_polygon.GetXY(0);
				double a0 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0);
				NUnit.Framework.Assert.IsTrue(a0 == 25);
				com.esri.core.geometry.Point2D pt1 = cut_polygon.GetXY(1);
				double a1 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0);
				NUnit.Framework.Assert.IsTrue(a1 == 7);
				com.esri.core.geometry.Point2D pt2 = cut_polygon.GetXY(2);
				double a2 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0);
				NUnit.Framework.Assert.IsTrue(a2 == 12);
				com.esri.core.geometry.Point2D pt3 = cut_polygon.GetXY(3);
				double a3 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0);
				NUnit.Framework.Assert.IsTrue(a3 == 17);
				com.esri.core.geometry.Point2D pt4 = cut_polygon.GetXY(4);
				double a4 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0);
				NUnit.Framework.Assert.IsTrue(a4 == 20);
				com.esri.core.geometry.Point2D pt5 = cut_polygon.GetXY(5);
				double a5 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0);
				NUnit.Framework.Assert.IsTrue(a5 == 23);
				com.esri.core.geometry.Point2D pt6 = cut_polygon.GetXY(6);
				double a6 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 6, 0);
				NUnit.Framework.Assert.IsTrue(a6 == 33);
				com.esri.core.geometry.Point2D pt7 = cut_polygon.GetXY(7);
				double a7 = cut_polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 7, 0);
				NUnit.Framework.Assert.IsTrue(a7 == 43);
			}
		}
Ejemplo n.º 32
0
		public static com.esri.core.geometry.Polyline MakePolygonCutter8()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(10, 10);
			poly.LineTo(10, 20);
			poly.LineTo(20, 20);
			poly.LineTo(20, 10);
			poly.LineTo(10, 10);
			return poly;
		}
Ejemplo n.º 33
0
		public static com.esri.core.geometry.Polyline MakePolygonCutter5()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(15, 0);
			poly.LineTo(0, 15);
			poly.LineTo(15, 30);
			poly.LineTo(30, 15);
			poly.LineTo(15, 0);
			return poly;
		}
Ejemplo n.º 34
0
		public static com.esri.core.geometry.Polyline MakePolylineCutter2()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(-1.5, 0);
			poly.LineTo(-.75, 0);
			poly.StartPath(-.5, 0);
			poly.LineTo(1, 0);
			poly.LineTo(1, 2);
			poly.LineTo(3, -2);
			poly.LineTo(4, 2);
			poly.LineTo(5, -2);
			poly.LineTo(5, 4);
			poly.LineTo(8, 2);
			poly.LineTo(6, 0);
			poly.LineTo(6, 3);
			poly.StartPath(9, 5);
			poly.LineTo(9, 2);
			poly.LineTo(10, 2);
			poly.LineTo(10, 5);
			poly.LineTo(10.5, 5);
			poly.LineTo(10.5, 3);
			poly.StartPath(11, 4);
			poly.LineTo(11, 5);
			poly.StartPath(12, 5);
			poly.LineTo(12, 4);
			return poly;
		}
Ejemplo n.º 35
0
		public static com.esri.core.geometry.Polyline MakePolyline2()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(-2, 0);
			poly.LineTo(-1, 0);
			poly.LineTo(0, 0);
			poly.LineTo(2, 0);
			poly.LineTo(4, 2);
			poly.LineTo(8, 2);
			poly.LineTo(10, 4);
			poly.LineTo(12, 4);
			return poly;
		}
Ejemplo n.º 36
0
		public static com.esri.core.geometry.Polyline MakePolylineCutter1()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(1, 0);
			poly.LineTo(4, 0);
			poly.StartPath(6, -1);
			poly.LineTo(6, 1);
			poly.StartPath(6, 0);
			poly.LineTo(8, 0);
			poly.StartPath(9, -1);
			poly.LineTo(9, 1);
			poly.StartPath(10, 0);
			poly.LineTo(12, 0);
			poly.StartPath(12, 1);
			poly.LineTo(12, -1);
			poly.StartPath(12, 0);
			poly.LineTo(15, 0);
			poly.StartPath(15, 1);
			poly.LineTo(15, -1);
			poly.StartPath(16, 0);
			poly.LineTo(16, -1);
			poly.LineTo(17, -1);
			poly.LineTo(17, 1);
			poly.LineTo(17, 0);
			poly.LineTo(18, 0);
			poly.StartPath(18, 0);
			poly.LineTo(18, -1);
			return poly;
		}
		public static com.esri.core.geometry.Polyline MakePolyline1()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(0, 0);
			poly.LineTo(15, 15);
			return poly;
		}
        /// <exception cref="org.codehaus.jackson.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool testPolyline()
        {
            bool bAnswer = true;

            com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline();
            polyline.startPath(-97.06138, 32.837);
            polyline.lineTo(-97.06133, 32.836);
            polyline.lineTo(-97.06124, 32.834);
            polyline.lineTo(-97.06127, 32.832);
            polyline.startPath(-97.06326, 32.759);
            polyline.lineTo(-97.06298, 32.755);
            {
                org.codehaus.jackson.JsonParser polylinePathsWgs84Parser = factory.createJsonParser
                                                                               (com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWGS84, polyline
                                                                                                                                     ));
                com.esri.core.geometry.MapGeometry mPolylineWGS84MP = com.esri.core.geometry.GeometryEngine
                                                                      .jsonToGeometry(polylinePathsWgs84Parser);
                NUnit.Framework.Assert.IsTrue(polyline.getPointCount() == ((com.esri.core.geometry.Polyline
                                                                            )mPolylineWGS84MP.getGeometry()).getPointCount());
                NUnit.Framework.Assert.IsTrue(polyline.getPoint(0).getX() == ((com.esri.core.geometry.Polyline
                                                                               )mPolylineWGS84MP.getGeometry()).getPoint(0).getX());
                NUnit.Framework.Assert.IsTrue(polyline.getPoint(0).getY() == ((com.esri.core.geometry.Polyline
                                                                               )mPolylineWGS84MP.getGeometry()).getPoint(0).getY());
                NUnit.Framework.Assert.IsTrue(polyline.getPathCount() == ((com.esri.core.geometry.Polyline
                                                                           )mPolylineWGS84MP.getGeometry()).getPathCount());
                NUnit.Framework.Assert.IsTrue(polyline.getSegmentCount() == ((com.esri.core.geometry.Polyline
                                                                              )mPolylineWGS84MP.getGeometry()).getSegmentCount());
                NUnit.Framework.Assert.IsTrue(polyline.getSegmentCount(0) == ((com.esri.core.geometry.Polyline
                                                                               )mPolylineWGS84MP.getGeometry()).getSegmentCount(0));
                NUnit.Framework.Assert.IsTrue(polyline.getSegmentCount(1) == ((com.esri.core.geometry.Polyline
                                                                               )mPolylineWGS84MP.getGeometry()).getSegmentCount(1));
                int lastIndex = polyline.getPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(polyline.getPoint(lastIndex).getX() == ((com.esri.core.geometry.Polyline
                                                                                       )mPolylineWGS84MP.getGeometry()).getPoint(lastIndex).getX());
                NUnit.Framework.Assert.IsTrue(polyline.getPoint(lastIndex).getY() == ((com.esri.core.geometry.Polyline
                                                                                       )mPolylineWGS84MP.getGeometry()).getPoint(lastIndex).getY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.getID() == mPolylineWGS84MP.getSpatialReference
                                                  ().getID());
                if (!checkResultSpatialRef(mPolylineWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.esri.core.geometry.Polyline p = new com.esri.core.geometry.Polyline();
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z);
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
                string s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                                , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"paths\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
                p.startPath(0, 0);
                p.lineTo(0, 1);
                p.startPath(2, 2);
                p.lineTo(3, 3);
                p.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0, 3);
                p.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 5);
                s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                         , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"paths\":[[[0,0,3,null],[0,1,0,5]],[[2,2,0,null],[3,3,0,null]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
            }
            {
                string paths = "{\"hasZ\" : true, \"paths\" : [ [ [0.0, 0.0,3], [0, 10.0,3], [10.0, 10.0,3, 6666], [10.0, 0.0,3, 6666] ], [ [1.0, 1,3], [1.0, 9.0,3], [9.0, 9.0,3], [1.0, 9.0,3] ] ], \"spatialReference\" : {\"wkid\" : 4326}, \"hasM\" : false}";
                com.esri.core.geometry.MapGeometry mapGeometry = com.esri.core.geometry.GeometryEngine
                                                                 .jsonToGeometry(factory.createJsonParser(paths));
                com.esri.core.geometry.Polyline p = (com.esri.core.geometry.Polyline)mapGeometry.
                                                    getGeometry();
                NUnit.Framework.Assert.IsTrue(p.getPathCount() == 2);
                int count = p.getPathCount();
                NUnit.Framework.Assert.IsTrue(p.getPointCount() == 8);
                NUnit.Framework.Assert.IsTrue(p.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics
                                                             .Z));
                NUnit.Framework.Assert.IsTrue(!p.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics
                                                              .M));
                double z = p.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                               .Z, 0, 0);
                NUnit.Framework.Assert.IsTrue(z == 3);
                double length = p.calculateLength2D();
                NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 54.0) <= 0.001);
                com.esri.core.geometry.SpatialReference spatial_reference = mapGeometry.getSpatialReference
                                                                                ();
                NUnit.Framework.Assert.IsTrue(spatial_reference.getID() == 4326);
            }
            return(bAnswer);
        }
Ejemplo n.º 39
0
		public virtual void testProximity_2D_1()
		{
			com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
				.getInstance();
			com.esri.core.geometry.OperatorProximity2D proximityOp = (com.esri.core.geometry.OperatorProximity2D
				)engine.getOperator(com.esri.core.geometry.Operator.Type.Proximity2D);
			com.esri.core.geometry.Point inputPoint = new com.esri.core.geometry.Point(3, 2);
			com.esri.core.geometry.Point point0 = new com.esri.core.geometry.Point(2.75, 2);
			// Point point1 = new Point(3, 2.5);
			// Point point2 = new Point(3.75, 2);
			// Point point3 = new Point(2.25, 2.5);
			// Point point4 = new Point(4, 2.25);
			// GetNearestVertices for Polygon (Native and DotNet)
			com.esri.core.geometry.Polygon polygon = MakePolygon();
			com.esri.core.geometry.Proximity2DResult[] resultArray = com.esri.core.geometry.GeometryEngine
				.getNearestVertices(polygon, inputPoint, 2.0, 8);
			NUnit.Framework.Assert.IsTrue(resultArray.Length == 8);
			double lastdistance;
			double distance;
			com.esri.core.geometry.Proximity2DResult result0 = resultArray[0];
			lastdistance = result0.getDistance();
			NUnit.Framework.Assert.IsTrue(lastdistance <= 2.0);
			com.esri.core.geometry.Proximity2DResult result1 = resultArray[1];
			distance = result1.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result2 = resultArray[2];
			distance = result2.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result3 = resultArray[3];
			distance = result3.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result4 = resultArray[4];
			distance = result4.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result5 = resultArray[5];
			distance = result5.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result6 = resultArray[6];
			distance = result6.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			lastdistance = distance;
			com.esri.core.geometry.Proximity2DResult result7 = resultArray[7];
			distance = result7.getDistance();
			NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance);
			// lastdistance = distance;
			// Point[] coordinates = polygon.get.getCoordinates2D();
			// int pointCount = polygon.getPointCount();
			//
			// int hits = 0;
			// for (int i = 0; i < pointCount; i++)
			// {
			// Point ipoint = coordinates[i];
			// distance = Point::Distance(ipoint, inputPoint);
			//
			// if (distance < lastdistance)
			// hits++;
			// }
			// assertTrue(hits < 8);
			// GetNearestVertices for Point
			com.esri.core.geometry.Point point = MakePoint();
			resultArray = com.esri.core.geometry.GeometryEngine.getNearestVertices(point, inputPoint
				, 1.0, 1);
			NUnit.Framework.Assert.IsTrue(resultArray.Length == 1);
			result0 = resultArray[0];
			com.esri.core.geometry.Point resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == point.getX() && resultPoint0
				.getY() == point.getY());
			// GetNearestVertex for Polygon
			result0 = com.esri.core.geometry.GeometryEngine.getNearestVertex(polygon, inputPoint
				);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == point0.getX() && resultPoint0
				.getY() == point0.getY());
			// GetNearestVertex for Point
			result0 = com.esri.core.geometry.GeometryEngine.getNearestVertex(point, inputPoint
				);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == point.getX() && resultPoint0
				.getY() == point.getY());
			// GetNearestCoordinate for Polygon
			com.esri.core.geometry.Polygon polygon2 = MakePolygon2();
			result0 = com.esri.core.geometry.GeometryEngine.getNearestCoordinate(polygon2, inputPoint
				, true);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == inputPoint.getX() && resultPoint0
				.getY() == inputPoint.getY());
			// GetNearestCoordinate for Polyline
			com.esri.core.geometry.Polyline polyline = MakePolyline();
			result0 = com.esri.core.geometry.GeometryEngine.getNearestCoordinate(polyline, inputPoint
				, true);
			resultPoint0 = result0.getCoordinate();
			NUnit.Framework.Assert.IsTrue(resultPoint0.getX() == 0.0 && resultPoint0.getY() ==
				 2.0);
			com.esri.core.geometry.Polygon pp = new com.esri.core.geometry.Polygon();
			pp.startPath(0, 0);
			pp.lineTo(0, 10);
			pp.lineTo(10, 10);
			pp.lineTo(10, 0);
			inputPoint.setXY(15, -5);
			result0 = proximityOp.getNearestCoordinate(pp, inputPoint, true, true);
			bool is_right = result0.isRightSide();
			NUnit.Framework.Assert.IsTrue(!is_right);
		}
Ejemplo n.º 40
0
		public virtual void TestTouchesBetweenPolylineAndPolygon()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Polyline pl = new com.esri.core.geometry.Polyline();
			pl.StartPath(2, 4);
			pl.LineTo(1, 10);
			pl.LineTo(6, 12);
			com.esri.core.geometry.Polygon compPg = new com.esri.core.geometry.Polygon();
			compPg.StartPath(2, 4);
			compPg.LineTo(2, 9);
			compPg.LineTo(9, 9);
			compPg.LineTo(9, 4);
			compPg.StartPath(2, 9);
			compPg.LineTo(6, 12);
			compPg.LineTo(9, 10);
			bool isTouched = com.esri.core.geometry.GeometryEngine.Touches(pl, compPg, sr);
			NUnit.Framework.Assert.AreEqual(isTouched, true);
		}
		public virtual void TestPointAndPolyline2()
		{
			com.esri.core.geometry.Point basePl = new com.esri.core.geometry.Point(-115, 20);
			com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
			compPl.StartPath(new com.esri.core.geometry.Point(-116, 20));
			compPl.LineTo(new com.esri.core.geometry.Point(-131, 10));
			compPl.LineTo(new com.esri.core.geometry.Point(-121, 50));
			int noException = 1;
			// no exception
			com.esri.core.geometry.Geometry intersectGeom = null;
			try
			{
				intersectGeom = com.esri.core.geometry.GeometryEngine.Intersect(basePl, compPl, com.esri.core.geometry.SpatialReference.Create(4326));
			}
			catch (System.Exception)
			{
				noException = 0;
			}
			NUnit.Framework.Assert.AreEqual(noException, 1);
			NUnit.Framework.Assert.IsTrue(intersectGeom.IsEmpty());
		}
Ejemplo n.º 42
0
		public virtual void TestTouchPointLineCR183227()
		{
			// Tests CR 183227
			com.esri.core.geometry.Geometry baseGeom = new com.esri.core.geometry.Point(-130, 10);
			com.esri.core.geometry.Polyline pl = new com.esri.core.geometry.Polyline();
			// pl.startPath(new Point(-130, 10));
			pl.StartPath(-130, 10);
			pl.LineTo(-131, 15);
			pl.LineTo(-140, 20);
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			bool isTouched;
			bool isTouched2;
			isTouched = com.esri.core.geometry.GeometryEngine.Touches(baseGeom, pl, sr);
			isTouched2 = com.esri.core.geometry.GeometryEngine.Touches(pl, baseGeom, sr);
			NUnit.Framework.Assert.IsTrue(isTouched && isTouched2);
			{
				com.esri.core.geometry.Geometry baseGeom2 = (com.esri.core.geometry.Geometry)new com.esri.core.geometry.Point(-131, 15);
				bool bIsTouched;
				bool bIsTouched2;
				bIsTouched = com.esri.core.geometry.GeometryEngine.Touches(baseGeom2, pl, sr);
				bIsTouched2 = com.esri.core.geometry.GeometryEngine.Touches(pl, baseGeom2, sr);
				NUnit.Framework.Assert.IsTrue(!bIsTouched && !bIsTouched2);
			}
		}
Ejemplo n.º 43
0
        public static void testClipGeometries()
        {
            // RandomTest();
            com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                                 .getInstance();
            com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip
                                                          )engine.getOperator(com.esri.core.geometry.Operator.Type.Clip);
            com.esri.core.geometry.Polygon polygon = makePolygon();
            com.esri.core.geometry.SimpleGeometryCursor polygonCurs = new com.esri.core.geometry.SimpleGeometryCursor
                                                                          (polygon);
            com.esri.core.geometry.Polyline             polyline     = makePolyline();
            com.esri.core.geometry.SimpleGeometryCursor polylineCurs = new com.esri.core.geometry.SimpleGeometryCursor
                                                                           (polyline);
            com.esri.core.geometry.MultiPoint           multipoint     = makeMultiPoint();
            com.esri.core.geometry.SimpleGeometryCursor multipointCurs = new com.esri.core.geometry.SimpleGeometryCursor
                                                                             (multipoint);
            com.esri.core.geometry.Point point = makePoint();
            com.esri.core.geometry.SimpleGeometryCursor pointCurs = new com.esri.core.geometry.SimpleGeometryCursor
                                                                        (point);
            com.esri.core.geometry.SpatialReference spatialRef = com.esri.core.geometry.SpatialReference
                                                                 .create(3857);
            com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D
                                                             ();
            envelope.xmin = 0;
            envelope.xmax = 20;
            envelope.ymin = 5;
            envelope.ymax = 15;
            // Cursor implementation
            com.esri.core.geometry.GeometryCursor clipPolygonCurs = clipOp.execute(polygonCurs
                                                                                   , envelope, spatialRef, null);
            com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipPolygonCurs
                                                            .next();
            double area = clippedPolygon.calculateArea2D();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 25) < 0.00001);
            // Single Geometry implementation
            clippedPolygon = (com.esri.core.geometry.Polygon)clipOp.execute(polygon, envelope
                                                                            , spatialRef, null);
            area = clippedPolygon.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 25) < 0.00001);
            // Cursor implementation
            com.esri.core.geometry.GeometryCursor clipPolylineCurs = clipOp.execute(polylineCurs
                                                                                    , envelope, spatialRef, null);
            com.esri.core.geometry.Polyline clippedPolyline = (com.esri.core.geometry.Polyline
                                                               )clipPolylineCurs.next();
            double length = clippedPolyline.calculateLength2D();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 10 * System.Math.sqrt(2.0)
                                                          ) < 1e-10);
            // Single Geometry implementation
            clippedPolyline = (com.esri.core.geometry.Polyline)clipOp.execute(polyline, envelope
                                                                              , spatialRef, null);
            length = clippedPolyline.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 10 * System.Math.sqrt(2.0)
                                                          ) < 1e-10);
            // Cursor implementation
            com.esri.core.geometry.GeometryCursor clipMulti_pointCurs = clipOp.execute(multipointCurs
                                                                                       , envelope, spatialRef, null);
            com.esri.core.geometry.MultiPoint clipped_multi_point = (com.esri.core.geometry.MultiPoint
                                                                     )clipMulti_pointCurs.next();
            int pointCount = clipped_multi_point.getPointCount();

            NUnit.Framework.Assert.IsTrue(pointCount == 2);
            // Cursor implementation
            com.esri.core.geometry.GeometryCursor clipPointCurs = clipOp.execute(pointCurs, envelope
                                                                                 , spatialRef, null);
            com.esri.core.geometry.Point clippedPoint = (com.esri.core.geometry.Point)clipPointCurs
                                                        .next();
            NUnit.Framework.Assert.IsTrue(clippedPoint != null);
            // RandomTest();
            com.esri.core.geometry.Polyline _poly = new com.esri.core.geometry.Polyline();
            _poly.startPath(2, 2);
            _poly.lineTo(0, 0);
            com.esri.core.geometry.Envelope2D _env = new com.esri.core.geometry.Envelope2D();
            _env.setCoords(2, 1, 5, 3);
            com.esri.core.geometry.Polyline _clippedPolyline = (com.esri.core.geometry.Polyline
                                                                )clipOp.execute(_poly, _env, spatialRef, null);
            NUnit.Framework.Assert.IsTrue(_clippedPolyline.isEmpty());
            {
                com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
                poly.addEnvelope(new com.esri.core.geometry.Envelope2D(0, 0, 100, 100), false);
                poly.addEnvelope(new com.esri.core.geometry.Envelope2D(5, 5, 95, 95), true);
                com.esri.core.geometry.Polygon clippedPoly = (com.esri.core.geometry.Polygon)clipOp
                                                             .execute(poly, new com.esri.core.geometry.Envelope2D(-10, -10, 110, 50), spatialRef
                                                                      , null);
                NUnit.Framework.Assert.IsTrue(clippedPoly.getPathCount() == 1);
                NUnit.Framework.Assert.IsTrue(clippedPoly.getPointCount() == 8);
            }
        }
        public static void test1()
        {
            com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
            poly.startPath(0, 0);
            poly.lineTo(0, 1.0 / 3.0);
            poly.lineTo(0, 2.0 / 3.0);
            poly.lineTo(0, 4.0 / 3.0);
            poly.lineTo(0, System.Math.sqrt(6.0));
            poly.lineTo(0, System.Math.sqrt(7.0));
            poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 3);
            poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 5);
            poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 7);
            poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0, 11);
            poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M,
                                       0, 1, 0, 1);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 0, 0) == 3);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 1, 0) == 5);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 2, 0) == 7);
            NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl
                                                                                       (com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0)));
            NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl
                                                                                       (com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0)));
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 5, 0) == 11);
            poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M,
                                       0, 1, 0, 2);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 0, 0) == 3);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 1, 0) == 5);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 2, 0) == 7);
            NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl
                                                                                       (com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0)));
            NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl
                                                                                       (com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0)));
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 5, 0) == 11);
            poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M,
                                       0, 2, 0, 5);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 0, 0) == 3);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 1, 0) == 5);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 2, 0) == 7);
            double a3 = poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                               .M, 3, 0);

            NUnit.Framework.Assert.IsTrue(a3 > 7 && a3 < 11);
            double a4 = poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                               .M, 4, 0);

            NUnit.Framework.Assert.IsTrue(a4 > a3 && a4 < 11);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 5, 0) == 11);
            poly.startPath(0, System.Math.sqrt(8.0));
            poly.lineTo(0, System.Math.sqrt(10.0));
            poly.lineTo(0, System.Math.sqrt(11.0));
        }
Ejemplo n.º 45
0
        public static void testDifferenceAndSymmetricDifference()
        {
            com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                                 .getInstance();
            com.esri.core.geometry.OperatorDifference differenceOp = (com.esri.core.geometry.OperatorDifference
                                                                      )engine.getOperator(com.esri.core.geometry.Operator.Type.Difference);
            com.esri.core.geometry.SpatialReference spatialRef = com.esri.core.geometry.SpatialReference
                                                                 .create(102113);
            com.esri.core.geometry.Polygon    polygon1      = makePolygon1();
            com.esri.core.geometry.Polygon    polygon2      = makePolygon2();
            com.esri.core.geometry.Polyline   polyline1     = makePolyline1();
            com.esri.core.geometry.MultiPoint multipoint1   = makeMultiPoint1();
            com.esri.core.geometry.MultiPoint multipoint2   = makeMultiPoint2();
            com.esri.core.geometry.MultiPoint multipoint3   = makeMultiPoint3();
            com.esri.core.geometry.Point      point1        = makePoint1();
            com.esri.core.geometry.Point      point2        = makePoint2();
            com.esri.core.geometry.Envelope   envelope1     = makeEnvelope1();
            com.esri.core.geometry.Envelope   envelope2     = makeEnvelope2();
            com.esri.core.geometry.Envelope   envelope3     = makeEnvelope3();
            com.esri.core.geometry.Polygon    outputPolygon = (com.esri.core.geometry.Polygon)differenceOp
                                                              .execute(polygon1, polygon2, spatialRef, null);
            double area = outputPolygon.calculateArea2D();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 75) <= 0.001);
            {
                com.esri.core.geometry.Point    point_1  = new com.esri.core.geometry.Point(-130, 10);
                com.esri.core.geometry.Point    point_2  = new com.esri.core.geometry.Point(-130, 10);
                com.esri.core.geometry.Geometry baseGeom = new com.esri.core.geometry.Point(point_1
                                                                                            .getX(), point_1.getY());
                com.esri.core.geometry.Geometry comparisonGeom = new com.esri.core.geometry.Point
                                                                     (point_2.getX(), point2.getY());
                com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                             .create(4326);
                com.esri.core.geometry.Geometry geom = differenceOp.execute(baseGeom, comparisonGeom
                                                                            , sr, null);
            }
            com.esri.core.geometry.OperatorSymmetricDifference symDifferenceOp = (com.esri.core.geometry.OperatorSymmetricDifference
                                                                                  )engine.getOperator(com.esri.core.geometry.Operator.Type.SymmetricDifference);
            outputPolygon = (com.esri.core.geometry.Polygon)symDifferenceOp.execute(polygon1,
                                                                                    polygon2, spatialRef, null);
            area = outputPolygon.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 150) <= 0.001);
            com.esri.core.geometry.Polyline outputPolyline = (com.esri.core.geometry.Polyline
                                                              )differenceOp.execute(polyline1, polygon1, spatialRef, null);
            double length = outputPolyline.calculateLength2D();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(length * length - 50) < 0.001);
            com.esri.core.geometry.MultiPoint outputMultiPoint = (com.esri.core.geometry.MultiPoint
                                                                  )differenceOp.execute(multipoint1, polygon1, spatialRef, null);
            int pointCount = outputMultiPoint.getPointCount();

            NUnit.Framework.Assert.IsTrue(pointCount == 1);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(symDifferenceOp.execute(multipoint1
                                                                                           , point1, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 2);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(symDifferenceOp.execute(multipoint1
                                                                                           , point2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 4);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint1
                                                                                        , point1, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 2);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint1
                                                                                        , point2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 3);
            outputPolygon = (com.esri.core.geometry.Polygon)(differenceOp.execute(polygon1, envelope1
                                                                                  , spatialRef, null));
            area = outputPolygon.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 75) <= 0.001);
            outputPolygon = (com.esri.core.geometry.Polygon)(differenceOp.execute(polygon2, envelope2
                                                                                  , spatialRef, null));
            area = outputPolygon.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 75) <= 0.001);
            outputPolyline = (com.esri.core.geometry.Polyline)(differenceOp.execute(polyline1
                                                                                    , envelope2, spatialRef, null));
            length = outputPolyline.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length * length - 50) <= 0.001);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint1
                                                                                        , envelope2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 1);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint2
                                                                                        , envelope2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 6);
            outputMultiPoint = (com.esri.core.geometry.MultiPoint)(differenceOp.execute(multipoint3
                                                                                        , envelope2, spatialRef, null));
            pointCount = outputMultiPoint.getPointCount();
            NUnit.Framework.Assert.IsTrue(pointCount == 0);
            com.esri.core.geometry.Point outputPoint = (com.esri.core.geometry.Point)(differenceOp
                                                                                      .execute(point1, envelope2, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(!outputPoint.isEmpty());
            outputPoint = (com.esri.core.geometry.Point)(differenceOp.execute(point2, envelope2
                                                                              , spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPoint.isEmpty());
            outputPolygon = (com.esri.core.geometry.Polygon)(differenceOp.execute(envelope3,
                                                                                  envelope2, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPolygon != null && outputPolygon.isEmpty());
            outputPolygon = (com.esri.core.geometry.Polygon)(symDifferenceOp.execute(envelope3
                                                                                     , envelope3, spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPolygon != null && outputPolygon.isEmpty());
            outputPoint = (com.esri.core.geometry.Point)(differenceOp.execute(point1, polygon1
                                                                              , spatialRef, null));
            NUnit.Framework.Assert.IsTrue(outputPoint != null);
        }
		internal virtual com.esri.core.geometry.Polyline MakePolyline()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(0, 0);
			poly.LineTo(0, 10);
			poly.LineTo(10, 10);
			poly.LineTo(10, 0);
			return poly;
		}
		public virtual void TestEqualsOnPolylines()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Polyline baseMp = new com.esri.core.geometry.Polyline();
			com.esri.core.geometry.Polyline compMp = new com.esri.core.geometry.Polyline();
			baseMp.StartPath(-116, 40);
			baseMp.LineTo(-120, 39);
			baseMp.LineTo(-121, 10);
			baseMp.LineTo(-130, 12);
			baseMp.LineTo(-108, 25);
			compMp.StartPath(-116, 40);
			compMp.LineTo(-120, 39);
			compMp.LineTo(-121, 10);
			compMp.LineTo(-130, 12);
			compMp.LineTo(-108, 25);
			bool isEqual;
			try
			{
				isEqual = com.esri.core.geometry.GeometryEngine.Equals(baseMp, compMp, sr);
			}
			catch (System.ArgumentException)
			{
				isEqual = false;
			}
			NUnit.Framework.Assert.IsTrue(isEqual);
		}
Ejemplo n.º 48
0
 public virtual void testBufferPolyline()
 {
     com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                  .create(4326);
     com.esri.core.geometry.Polyline       inputGeom = new com.esri.core.geometry.Polyline();
     com.esri.core.geometry.OperatorBuffer buffer    = (com.esri.core.geometry.OperatorBuffer
                                                        )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                               .Buffer);
     com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify
                                                         )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                                .Simplify);
     inputGeom.startPath(0, 0);
     inputGeom.lineTo(50, 50);
     inputGeom.lineTo(50, 0);
     inputGeom.lineTo(0, 50);
     {
         com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 0, null);
         NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                       .Polygon);
         NUnit.Framework.Assert.IsTrue(result.isEmpty());
     }
     {
         com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, -1, null);
         NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                       .Polygon);
         NUnit.Framework.Assert.IsTrue(result.isEmpty());
     }
     {
         com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 40.0, null
                                                                 );
         NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                       .Polygon);
         com.esri.core.geometry.Polygon    poly  = (com.esri.core.geometry.Polygon)(result);
         com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
         result.queryEnvelope2D(env2D);
         NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 80 - 50) < 0.1 &&
                                       System.Math.abs(env2D.getHeight() - 80 - 50) < 0.1);
         NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 25) < 0.1 && System.Math
                                       .abs(env2D.getCenterY() - 25) < 0.1);
         int pathCount = poly.getPathCount();
         NUnit.Framework.Assert.IsTrue(pathCount == 1);
         int pointCount = poly.getPointCount();
         NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 171.0) < 10);
         NUnit.Framework.Assert.IsTrue(simplify.isSimpleAsFeature(result, sr, null));
     }
     {
         com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 4.0, null);
         NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                       .Polygon);
         com.esri.core.geometry.Polygon    poly  = (com.esri.core.geometry.Polygon)(result);
         com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
         result.queryEnvelope2D(env2D);
         NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 8 - 50) < 0.1 &&
                                       System.Math.abs(env2D.getHeight() - 8 - 50) < 0.1);
         NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 25) < 0.1 && System.Math
                                       .abs(env2D.getCenterY() - 25) < 0.1);
         int pathCount = poly.getPathCount();
         NUnit.Framework.Assert.IsTrue(pathCount == 2);
         int pointCount = poly.getPointCount();
         NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 186.0) < 10);
         NUnit.Framework.Assert.IsTrue(simplify.isSimpleAsFeature(result, sr, null));
     }
     {
         inputGeom = new com.esri.core.geometry.Polyline();
         inputGeom.startPath(0, 0);
         inputGeom.lineTo(50, 50);
         inputGeom.startPath(50, 0);
         inputGeom.lineTo(0, 50);
         com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 4.0, null);
         NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                       .Polygon);
         com.esri.core.geometry.Polygon    poly  = (com.esri.core.geometry.Polygon)(result);
         com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
         result.queryEnvelope2D(env2D);
         NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 8 - 50) < 0.1 &&
                                       System.Math.abs(env2D.getHeight() - 8 - 50) < 0.1);
         NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 25) < 0.1 && System.Math
                                       .abs(env2D.getCenterY() - 25) < 0.1);
         int pathCount = poly.getPathCount();
         NUnit.Framework.Assert.IsTrue(pathCount == 1);
         int pointCount = poly.getPointCount();
         NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 208.0) < 10);
         NUnit.Framework.Assert.IsTrue(simplify.isSimpleAsFeature(result, sr, null));
     }
 }
Ejemplo n.º 49
0
		public virtual void TestTouchesOnPolylineAndEnvelope()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
			basePl.StartPath(new com.esri.core.geometry.Point(-117, 20));
			basePl.LineTo(new com.esri.core.geometry.Point(-100, 20));
			basePl.LineTo(new com.esri.core.geometry.Point(-100, 10));
			basePl.LineTo(new com.esri.core.geometry.Point(-117, 10));
			basePl.LineTo(new com.esri.core.geometry.Point(-117, 20));
			// Envelope env = new Envelope(new Point(-117,20), 12, 12);//not touched
			com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(-100, 20, -80, 30);
			// touched
			bool isTouched;
			try
			{
				isTouched = com.esri.core.geometry.GeometryEngine.Touches(basePl, env, sr);
			}
			catch (System.ArgumentException)
			{
				isTouched = false;
			}
			NUnit.Framework.Assert.AreEqual(isTouched, true);
		}
Ejemplo n.º 50
0
        /// <exception cref="java.io.FileNotFoundException"/>
        public static com.esri.core.geometry.Geometry loadFromTextFileDbg(string textFileName
                                                                          )
        {
            string fullPath = textFileName;

            // string fullCSVPathName = System.IO.Path.Combine( directoryPath ,
            // CsvFileName);
            java.io.File      fileInfo           = new java.io.File(fullPath);
            java.util.Scanner scanner            = new java.util.Scanner(fileInfo);
            com.esri.core.geometry.Geometry geom = null;
            // grab first line
            string line           = scanner.nextLine();
            string geomTypeString = Sharpen.Runtime.substring(line, 1);

            if (Sharpen.Runtime.equalsIgnoreCase(geomTypeString, "polygon"))
            {
                geom = new com.esri.core.geometry.Polygon();
            }
            else
            {
                if (Sharpen.Runtime.equalsIgnoreCase(geomTypeString, "polyline"))
                {
                    geom = new com.esri.core.geometry.Polyline();
                }
                else
                {
                    if (Sharpen.Runtime.equalsIgnoreCase(geomTypeString, "multipoint"))
                    {
                        geom = new com.esri.core.geometry.MultiPoint();
                    }
                    else
                    {
                        if (Sharpen.Runtime.equalsIgnoreCase(geomTypeString, "point"))
                        {
                            geom = new com.esri.core.geometry.Point();
                        }
                    }
                }
            }
            while (line.StartsWith("*"))
            {
                if (scanner.hasNextLine())
                {
                    line = scanner.nextLine();
                }
            }
            int j = 0;

            com.esri.core.geometry.Geometry.Type geomType = geom.getType();
            while (scanner.hasNextLine())
            {
                string[] parsedLine = line.split("\\s+");
                double   xVal       = double.parseDouble(parsedLine[0]);
                double   yVal       = double.parseDouble(parsedLine[1]);
                if (j == 0 && (geomType == com.esri.core.geometry.Geometry.Type.Polygon || geomType
                               == com.esri.core.geometry.Geometry.Type.Polyline))
                {
                    ((com.esri.core.geometry.MultiPath)geom).startPath(xVal, yVal);
                }
                else
                {
                    if (geomType == com.esri.core.geometry.Geometry.Type.Polygon || geomType == com.esri.core.geometry.Geometry.Type
                        .Polyline)
                    {
                        ((com.esri.core.geometry.MultiPath)geom).lineTo(xVal, yVal);
                    }
                    else
                    {
                        if (geomType == com.esri.core.geometry.Geometry.Type.MultiPoint)
                        {
                            ((com.esri.core.geometry.MultiPoint)geom).add(xVal, yVal);
                        }
                    }
                }
                // else if(geomType == Geometry.Type.Point)
                // Point geom = null;//new Point(xVal, yVal);
                j++;
                line = scanner.nextLine();
            }
            scanner.close();
            return(geom);
        }
Ejemplo n.º 51
0
        public static void testConsiderTouch2(com.esri.core.geometry.SpatialReference spatialReference
                                              )
        {
            com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal
                                                                 .getInstance();
            com.esri.core.geometry.OperatorCut opCut = (com.esri.core.geometry.OperatorCut)engine
                                                       .getOperator(com.esri.core.geometry.Operator.Type.Cut);
            com.esri.core.geometry.Polyline       polyline2 = makePolyline2();
            com.esri.core.geometry.Polyline       cutter2   = makePolylineCutter2();
            com.esri.core.geometry.GeometryCursor cursor    = opCut.execute(true, polyline2, cutter2
                                                                            , spatialReference, null);
            com.esri.core.geometry.Polyline cut;
            int    pathCount;
            int    segmentCount;
            double length;

            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 4);
            NUnit.Framework.Assert.IsTrue(segmentCount == 4);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 5.74264068) <= 0.001);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 6);
            NUnit.Framework.Assert.IsTrue(segmentCount == 8);
            NUnit.Framework.Assert.IsTrue(length == 6.75);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            NUnit.Framework.Assert.IsTrue(segmentCount == 1);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 0.5) <= 0.001);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            NUnit.Framework.Assert.IsTrue(segmentCount == 1);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 0.25) <= 0.001);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            NUnit.Framework.Assert.IsTrue(segmentCount == 1);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 1) <= 0.001);
            cut          = (com.esri.core.geometry.Polyline)cursor.next();
            pathCount    = cut.getPathCount();
            segmentCount = cut.getSegmentCount();
            length       = cut.calculateLength2D();
            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            NUnit.Framework.Assert.IsTrue(segmentCount == 1);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(length - 1.41421356) <= 0.001);
            cut = (com.esri.core.geometry.Polyline)cursor.next();
            NUnit.Framework.Assert.IsTrue(cut == null);
        }
		public static void TestDifferenceOnPolyline()
		{
			// # * * #
			// # * @
			// # @ *
			// # *
			//
			// ///////////////////////////////
			//
			// The polyline drawn in *s represents basePl
			// The polyline drawn in #s represents compPl
			// The @ represents their intersection points, so that
			// the difference polyline will be basePl with two new vertices @ added.
			com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
			basePl.StartPath(new com.esri.core.geometry.Point(-117, 20));
			basePl.LineTo(new com.esri.core.geometry.Point(-130, 10));
			basePl.LineTo(new com.esri.core.geometry.Point(-120, 50));
			com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
			compPl.StartPath(new com.esri.core.geometry.Point(-116, 20));
			compPl.LineTo(new com.esri.core.geometry.Point(-131, 10));
			compPl.LineTo(new com.esri.core.geometry.Point(-121, 50));
			com.esri.core.geometry.Geometry diffGeom = com.esri.core.geometry.GeometryEngine.Difference(basePl, compPl, com.esri.core.geometry.SpatialReference.Create(4326));
			NUnit.Framework.Assert.IsTrue(diffGeom is com.esri.core.geometry.Polyline);
			com.esri.core.geometry.Polyline diffPolyline = (com.esri.core.geometry.Polyline)diffGeom;
			int pointCountDiffPolyline = diffPolyline.GetPointCount();
			// first line in comp_pl is 3y = 2x + 292
			NUnit.Framework.Assert.AreEqual(3 * 20, 2 * (-116) + 292);
			NUnit.Framework.Assert.AreEqual(3 * 10, 2 * (-131) + 292);
			// new points should also lie on this line
			NUnit.Framework.Assert.IsTrue(3.0 * diffPolyline.GetCoordinates2D()[1].y - 2.0 * diffPolyline.GetCoordinates2D()[1].x - 292.0 == 0.0);
			NUnit.Framework.Assert.IsTrue(3.0 * diffPolyline.GetCoordinates2D()[3].y - 2.0 * diffPolyline.GetCoordinates2D()[3].x - 292.0 == 0.0);
			for (int i = 0; i < 3; i++)
			{
				NUnit.Framework.Assert.IsTrue(basePl.GetCoordinates2D()[i].x == diffPolyline.GetCoordinates2D()[2 * i].x);
				NUnit.Framework.Assert.IsTrue(basePl.GetCoordinates2D()[i].y == diffPolyline.GetCoordinates2D()[2 * i].y);
			}
			NUnit.Framework.Assert.AreEqual(5, pointCountDiffPolyline);
		}
Ejemplo n.º 53
0
		public virtual void TestRelationTouch()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Polyline basePl = new com.esri.core.geometry.Polyline();
			basePl.StartPath(2, 2);
			basePl.LineTo(2, 10);
			com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
			compPl.StartPath(2, 4);
			compPl.LineTo(9, 4);
			compPl.LineTo(9, 9);
			compPl.LineTo(2, 9);
			compPl.LineTo(2, 4);
			bool isTouched = false;
			// GeometryEngine.relation(basePl, compPl, sr,
			// "G1 TOUCH G2");
			NUnit.Framework.Assert.AreEqual(isTouched, false);
		}
		public virtual void TestBufferPolyline()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Polyline inputGeom = new com.esri.core.geometry.Polyline();
			com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Buffer);
			com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Simplify);
			inputGeom.StartPath(0, 0);
			inputGeom.LineTo(50, 50);
			inputGeom.LineTo(50, 0);
			inputGeom.LineTo(0, 50);
			{
				com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 0, null);
				NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
				NUnit.Framework.Assert.IsTrue(result.IsEmpty());
			}
			{
				com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, -1, null);
				NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
				NUnit.Framework.Assert.IsTrue(result.IsEmpty());
			}
			{
				com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 40.0, null);
				NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
				com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result);
				com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
				result.QueryEnvelope2D(env2D);
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() - 80 - 50) < 0.1 && System.Math.Abs(env2D.GetHeight() - 80 - 50) < 0.1);
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 25) < 0.1 && System.Math.Abs(env2D.GetCenterY() - 25) < 0.1);
				int pathCount = poly.GetPathCount();
				NUnit.Framework.Assert.IsTrue(pathCount == 1);
				int pointCount = poly.GetPointCount();
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(pointCount - 171.0) < 10);
				NUnit.Framework.Assert.IsTrue(simplify.IsSimpleAsFeature(result, sr, null));
			}
			{
				com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 4.0, null);
				NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
				com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result);
				com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
				result.QueryEnvelope2D(env2D);
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() - 8 - 50) < 0.1 && System.Math.Abs(env2D.GetHeight() - 8 - 50) < 0.1);
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 25) < 0.1 && System.Math.Abs(env2D.GetCenterY() - 25) < 0.1);
				int pathCount = poly.GetPathCount();
				NUnit.Framework.Assert.IsTrue(pathCount == 2);
				int pointCount = poly.GetPointCount();
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(pointCount - 186.0) < 10);
				NUnit.Framework.Assert.IsTrue(simplify.IsSimpleAsFeature(result, sr, null));
			}
			{
				inputGeom = new com.esri.core.geometry.Polyline();
				inputGeom.StartPath(0, 0);
				inputGeom.LineTo(50, 50);
				inputGeom.StartPath(50, 0);
				inputGeom.LineTo(0, 50);
				com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 4.0, null);
				NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
				com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result);
				com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
				result.QueryEnvelope2D(env2D);
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() - 8 - 50) < 0.1 && System.Math.Abs(env2D.GetHeight() - 8 - 50) < 0.1);
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 25) < 0.1 && System.Math.Abs(env2D.GetCenterY() - 25) < 0.1);
				int pathCount = poly.GetPathCount();
				NUnit.Framework.Assert.IsTrue(pathCount == 1);
				int pointCount = poly.GetPointCount();
				NUnit.Framework.Assert.IsTrue(System.Math.Abs(pointCount - 208.0) < 10);
				NUnit.Framework.Assert.IsTrue(simplify.IsSimpleAsFeature(result, sr, null));
			}
		}
Ejemplo n.º 55
0
		public virtual void TestTouchesBetweenPointAndLine()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Point p = new com.esri.core.geometry.Point(2, 4);
			com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
			compPl.StartPath(2, 4);
			compPl.LineTo(9, 4);
			compPl.LineTo(9, 9);
			compPl.LineTo(2, 9);
			compPl.LineTo(2, 4);
			bool isTouched = com.esri.core.geometry.GeometryEngine.Touches(p, compPl, sr);
			NUnit.Framework.Assert.IsTrue(!isTouched);
		}
Ejemplo n.º 56
0
		public static com.esri.core.geometry.Polyline MakePolygonCutter9()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(5, -1);
			poly.LineTo(5, 51);
			return poly;
		}
Ejemplo n.º 57
0
 public static void testEditShape()
 {
     {
         // std::shared_ptr<Esri_runtimecore::Geometry::Polygon> poly_base_6
         // = std::make_shared<Esri_runtimecore::Geometry::Polygon>();
         // Single part polygon
         com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
         poly.startPath(10, 10);
         poly.lineTo(10, 12);
         poly.lineTo(14, 15);
         poly.lineTo(10, 11);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.
                                                getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
     }
     {
         // Two part poly
         com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
         poly.startPath(10, 10);
         poly.lineTo(10, 12);
         poly.lineTo(14, 15);
         poly.lineTo(10, 11);
         poly.startPath(100, 10);
         poly.lineTo(100, 12);
         poly.lineTo(14, 150);
         poly.lineTo(10, 101);
         poly.lineTo(100, 11);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.
                                                getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
     }
     {
         // Single part polyline
         com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
         poly.startPath(10, 10);
         poly.lineTo(10, 12);
         poly.lineTo(14, 15);
         poly.lineTo(10, 11);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape
                                                 .getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
     }
     {
         // Two part poly
         com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
         poly.startPath(10, 10);
         poly.lineTo(10, 12);
         poly.lineTo(14, 15);
         poly.lineTo(10, 11);
         poly.startPath(100, 10);
         poly.lineTo(100, 12);
         poly.lineTo(14, 150);
         poly.lineTo(10, 101);
         poly.lineTo(100, 11);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape
                                                 .getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
     }
     {
         // Five part poly. Close one of parts to test if it works.
         com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
         poly.startPath(10, 10);
         poly.lineTo(10, 12);
         poly.lineTo(14, 15);
         poly.lineTo(10, 11);
         poly.startPath(100, 10);
         poly.lineTo(100, 12);
         poly.lineTo(14, 150);
         poly.lineTo(10, 101);
         poly.lineTo(100, 11);
         poly.startPath(1100, 101);
         poly.lineTo(1300, 132);
         poly.lineTo(144, 150);
         poly.lineTo(106, 1051);
         poly.lineTo(1600, 161);
         poly.startPath(100, 190);
         poly.lineTo(1800, 192);
         poly.lineTo(184, 8150);
         poly.lineTo(1080, 181);
         poly.startPath(1030, 10);
         poly.lineTo(1300, 132);
         poly.lineTo(314, 3150);
         poly.lineTo(310, 1301);
         poly.lineTo(3100, 311);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         editShape.setClosedPath(editShape.getNextPath(editShape.getFirstPath(geom)), true
                                 );
         ((com.esri.core.geometry.MultiPathImpl)poly._getImpl()).closePathWithLine(1);
         com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape
                                                 .getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
     }
     {
         // Test erase
         com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
         poly.startPath(10, 10);
         poly.lineTo(10, 12);
         poly.lineTo(314, 3150);
         poly.lineTo(310, 1301);
         poly.lineTo(3100, 311);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom   = editShape.addGeometry(poly);
         int vertex = editShape.getFirstVertex(editShape.getFirstPath(geom));
         vertex = editShape.removeVertex(vertex, true);
         vertex = editShape.getNextVertex(vertex);
         editShape.removeVertex(vertex, true);
         com.esri.core.geometry.Polyline poly2 = (com.esri.core.geometry.Polyline)editShape
                                                 .getGeometry(geom);
         poly.setEmpty();
         poly.startPath(10, 12);
         poly.lineTo(310, 1301);
         poly.lineTo(3100, 311);
         NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
     }
     {
         // Test erase
         com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
         poly.startPath(10, 10);
         poly.lineTo(10, 12);
         poly.lineTo(314, 3150);
         poly.lineTo(310, 1301);
         poly.lineTo(3100, 311);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom   = editShape.addGeometry(poly);
         int vertex = editShape.getFirstVertex(editShape.getFirstPath(geom));
         vertex = editShape.removeVertex(vertex, true);
         vertex = editShape.getNextVertex(vertex);
         editShape.removeVertex(vertex, true);
         com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.
                                                getGeometry(geom);
         poly.setEmpty();
         poly.startPath(10, 12);
         poly.lineTo(310, 1301);
         poly.lineTo(3100, 311);
         NUnit.Framework.Assert.IsTrue(poly.Equals(poly2));
     }
     {
         // Test Filter Close Points
         com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
         poly.startPath(10, 10);
         poly.lineTo(10, 10.001);
         poly.lineTo(10.001, 10);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         editShape.filterClosePoints(0.002, true, false);
         com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.
                                                getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(poly2.isEmpty());
     }
     {
         // Test Filter Close Points
         com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
         poly.startPath(10, 10);
         poly.lineTo(10, 10.0025);
         poly.lineTo(11.0, 10);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         editShape.filterClosePoints(0.002, true, false);
         com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.
                                                getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(!poly2.isEmpty());
     }
     {
         // Test Filter Close Points
         com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon();
         poly.startPath(10, 10);
         poly.lineTo(10, 10.001);
         poly.lineTo(11.0, 10);
         com.esri.core.geometry.EditShape editShape = new com.esri.core.geometry.EditShape
                                                          ();
         int geom = editShape.addGeometry(poly);
         editShape.filterClosePoints(0.002, true, false);
         com.esri.core.geometry.Polygon poly2 = (com.esri.core.geometry.Polygon)editShape.
                                                getGeometry(geom);
         NUnit.Framework.Assert.IsTrue(poly2.isEmpty());
     }
     {
         // Test attribute splitting 1
         com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline();
         polyline.startPath(0, 0);
         polyline.lineTo(1, 1);
         polyline.lineTo(2, 2);
         polyline.lineTo(3, 3);
         polyline.lineTo(4, 4);
         polyline.startPath(5, 5);
         polyline.lineTo(6, 6);
         polyline.lineTo(7, 7);
         polyline.lineTo(8, 8);
         polyline.lineTo(9, 9);
         polyline.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0,
                               4);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 1, 0,
                               8);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 2, 0,
                               12);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 3, 0,
                               16);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 4, 0,
                               20);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 5, 0,
                               22);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 6, 0,
                               26);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 7, 0,
                               30);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 8, 0,
                               34);
         polyline.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 9, 0,
                               38);
         com.esri.core.geometry.EditShape shape = new com.esri.core.geometry.EditShape();
         int geometry = shape.addGeometry(polyline);
         com.esri.core.geometry.AttributeStreamOfInt32 vertex_handles = new com.esri.core.geometry.AttributeStreamOfInt32
                                                                            (0);
         for (int path = shape.getFirstPath(geometry); path != -1; path = shape.getNextPath
                                                                              (path))
         {
             for (int vertex = shape.getFirstVertex(path); vertex != -1; vertex = shape.getNextVertex
                                                                                      (vertex))
             {
                 if (vertex != shape.getLastVertex(path))
                 {
                     vertex_handles.add(vertex);
                 }
             }
         }
         double[] t = new double[1];
         for (int i = 0; i < vertex_handles.size(); i++)
         {
             int vertex = vertex_handles.read(i);
             t[0] = 0.5;
             shape.splitSegment(vertex, t, 1);
         }
         com.esri.core.geometry.Polyline chopped_polyline = (com.esri.core.geometry.Polyline
                                                             )shape.getGeometry(geometry);
         NUnit.Framework.Assert.IsTrue(chopped_polyline.getPointCount() == 18);
         double att_ = 4;
         for (int i_1 = 0; i_1 < 18; i_1++)
         {
             double att = chopped_polyline.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                             .Z, i_1, 0);
             NUnit.Framework.Assert.IsTrue(att == att_);
             att_ += 2;
         }
     }
     {
         // Test attribute splitting 2
         com.esri.core.geometry.Polyline line1 = new com.esri.core.geometry.Polyline();
         com.esri.core.geometry.Polyline line2 = new com.esri.core.geometry.Polyline();
         line1.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
         line2.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
         line1.startPath(0, 0);
         line1.lineTo(10, 10);
         line2.startPath(10, 0);
         line2.lineTo(0, 10);
         line1.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 7);
         line1.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 17
                            );
         line2.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 5);
         line2.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 15
                            );
         com.esri.core.geometry.EditShape shape = new com.esri.core.geometry.EditShape();
         int g1 = shape.addGeometry(line1);
         int g2 = shape.addGeometry(line2);
         com.esri.core.geometry.CrackAndCluster.execute(shape, 0.001, null, true);
         com.esri.core.geometry.Polyline chopped_line1 = (com.esri.core.geometry.Polyline)
                                                         shape.getGeometry(g1);
         com.esri.core.geometry.Polyline chopped_line2 = (com.esri.core.geometry.Polyline)
                                                         shape.getGeometry(g2);
         double att1 = chopped_line1.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                       .M, 1, 0);
         double att2 = chopped_line2.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                       .M, 1, 0);
         NUnit.Framework.Assert.IsTrue(att1 == 12);
         NUnit.Framework.Assert.IsTrue(att2 == 10);
     }
     {
         // Test attribute splitting 3
         com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon();
         polygon.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
         polygon.startPath(0, 0);
         polygon.lineTo(0, 10);
         polygon.lineTo(10, 10);
         polygon.lineTo(10, 0);
         polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0,
                              7);
         polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0,
                              17);
         polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0,
                              23);
         polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0,
                              43);
         com.esri.core.geometry.EditShape shape = new com.esri.core.geometry.EditShape();
         int geometry = shape.addGeometry(polygon);
         com.esri.core.geometry.AttributeStreamOfInt32 vertex_handles = new com.esri.core.geometry.AttributeStreamOfInt32
                                                                            (0);
         int start_v = shape.getFirstVertex(shape.getFirstPath(geometry));
         int v       = start_v;
         do
         {
             vertex_handles.add(v);
             v = shape.getNextVertex(v);
         }while (v != start_v);
         double[] t = new double[1];
         for (int i = 0; i < vertex_handles.size(); i++)
         {
             int v1 = vertex_handles.read(i);
             t[0] = 0.5;
             shape.splitSegment(v1, t, 1);
         }
         com.esri.core.geometry.Polygon cut_polygon = (com.esri.core.geometry.Polygon)shape
                                                      .getGeometry(geometry);
         NUnit.Framework.Assert.IsTrue(cut_polygon.getPointCount() == 8);
         com.esri.core.geometry.Point2D pt0 = cut_polygon.getXY(0);
         double a0 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 0, 0);
         NUnit.Framework.Assert.IsTrue(a0 == 25);
         com.esri.core.geometry.Point2D pt1 = cut_polygon.getXY(1);
         double a1 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 1, 0);
         NUnit.Framework.Assert.IsTrue(a1 == 7);
         com.esri.core.geometry.Point2D pt2 = cut_polygon.getXY(2);
         double a2 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 2, 0);
         NUnit.Framework.Assert.IsTrue(a2 == 12);
         com.esri.core.geometry.Point2D pt3 = cut_polygon.getXY(3);
         double a3 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 3, 0);
         NUnit.Framework.Assert.IsTrue(a3 == 17);
         com.esri.core.geometry.Point2D pt4 = cut_polygon.getXY(4);
         double a4 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 4, 0);
         NUnit.Framework.Assert.IsTrue(a4 == 20);
         com.esri.core.geometry.Point2D pt5 = cut_polygon.getXY(5);
         double a5 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 5, 0);
         NUnit.Framework.Assert.IsTrue(a5 == 23);
         com.esri.core.geometry.Point2D pt6 = cut_polygon.getXY(6);
         double a6 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 6, 0);
         NUnit.Framework.Assert.IsTrue(a6 == 33);
         com.esri.core.geometry.Point2D pt7 = cut_polygon.getXY(7);
         double a7 = cut_polygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                   .M, 7, 0);
         NUnit.Framework.Assert.IsTrue(a7 == 43);
     }
 }