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 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);
        }
        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(-116, 0.1E7, ip.getX());
            NUnit.Framework.Assert.AreEqual(20, 0.1E7, ip.getY());
        }
        public virtual void testTouchesOnPolylineAndPolygon()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.Polygon basePl = new com.esri.core.geometry.Polygon();
            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));
            com.esri.core.geometry.Polyline compPl = new com.esri.core.geometry.Polyline();
            compPl.startPath(new com.esri.core.geometry.Point(-117, 20));
            compPl.lineTo(new com.esri.core.geometry.Point(-108, 25));
            compPl.lineTo(new com.esri.core.geometry.Point(-100, 20));
            compPl.lineTo(new com.esri.core.geometry.Point(-100, 30));
            bool isTouched;

            try
            {
                isTouched = com.esri.core.geometry.GeometryEngine.touches(basePl, compPl, sr);
            }
            catch (System.ArgumentException)
            {
                isTouched = false;
            }
            NUnit.Framework.Assert.AreEqual(isTouched, true);
        }
        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);
        }
        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);
        }
        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);
            }
        }
        public static void test2()
        {
            com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
            poly.startPath(0, 0);
            poly.lineTo(0, 1.0 / 3.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, 1, 0, System.Math
                              .sqrt(3.0));
            poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M,
                                       0, 1, 1, 0);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 1, 0) == System.Math.sqrt(3.0));
            NUnit.Framework.Assert.IsTrue(com.esri.core.geometry.NumberUtils.isNaN(poly.getAttributeAsDbl
                                                                                       (com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0)));
            poly.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0, System.Math
                              .sqrt(5.0));
            poly.interpolateAttributes(com.esri.core.geometry.VertexDescription.Semantics.M,
                                       0, 1, 1, 1);
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 1, 0) == System.Math.sqrt(3.0));
            double a2 = poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                               .M, 2, 0);

            NUnit.Framework.Assert.IsTrue(a2 == System.Math.sqrt(3.0));
            NUnit.Framework.Assert.IsTrue(poly.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics
                                                                 .M, 3, 0) == System.Math.sqrt(5.0));
        }
Exemple #9
0
 public static com.esri.core.geometry.Polyline makePolyline()
 {
     com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
     poly.startPath(0, 0);
     poly.lineTo(10, 10);
     poly.lineTo(20, 0);
     return(poly);
 }
Exemple #10
0
		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;
		}
Exemple #11
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);
 }
		public virtual void testPolylineWithTwoPaths()
		{
			com.esri.core.geometry.Polyline p = new com.esri.core.geometry.Polyline();
			p.startPath(100.0, 0.0);
			p.lineTo(100.0, 1.0);
			p.startPath(100.2, 0.2);
			p.lineTo(100.8, 0.2);
			string result = com.esri.core.geometry.GeometryEngine.geometryToGeoJson(p);
			NUnit.Framework.Assert.AreEqual("{\"type\":\"MultiLineString\",\"coordinates\":[[[100.0,0.0],[100.0,1.0]],[[100.2,0.2],[100.8,0.2]]]}"
				, result);
		}
		public virtual void testOGCLineString()
		{
			com.esri.core.geometry.Polyline p = new com.esri.core.geometry.Polyline();
			p.startPath(100.0, 0.0);
			p.lineTo(101.0, 0.0);
			p.lineTo(101.0, 1.0);
			p.lineTo(100.0, 1.0);
			com.esri.core.geometry.ogc.OGCLineString ogcLineString = new com.esri.core.geometry.ogc.OGCLineString
				(p, 0, null);
			string result = ogcLineString.asGeoJson();
			NUnit.Framework.Assert.AreEqual("{\"type\":\"LineString\",\"coordinates\":[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0]]}"
				, result);
		}
		public virtual void testPolyline()
		{
			com.esri.core.geometry.Polyline p = new com.esri.core.geometry.Polyline();
			p.startPath(100.0, 0.0);
			p.lineTo(101.0, 0.0);
			p.lineTo(101.0, 1.0);
			p.lineTo(100.0, 1.0);
			com.esri.core.geometry.OperatorExportToGeoJson exporter = (com.esri.core.geometry.OperatorExportToGeoJson
				)factory.getOperator(com.esri.core.geometry.Operator.Type.ExportToGeoJson);
			string result = exporter.execute(p);
			NUnit.Framework.Assert.AreEqual("{\"type\":\"LineString\",\"coordinates\":[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0]]}"
				, result);
		}
Exemple #15
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 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 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);
        }
 private static com.esri.core.geometry.Polyline makePolyline()
 {
     com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
     poly.startPath(0, 15);
     poly.lineTo(15, 15);
     return(poly);
 }
Exemple #19
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);
 }
        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);
        }
 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);
 }
        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);
        }
        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);
        }
Exemple #24
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);
		}
        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());
        }
        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);
        }
Exemple #27
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);
 }
        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("."));
        }
Exemple #29
0
 public static com.esri.core.geometry.Polyline makePolylineCR()
 {
     com.esri.core.geometry.Polyline polyline = new com.esri.core.geometry.Polyline();
     polyline.startPath(-200, -90);
     polyline.lineTo(-180, -85);
     polyline.lineTo(-90, -70);
     polyline.lineTo(0, 0);
     polyline.lineTo(100, 25);
     polyline.lineTo(170, 45);
     polyline.lineTo(225, 65);
     return(polyline);
 }
Exemple #30
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);
 }