コード例 #1
0
        public static void testPolygon9(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.Polygon cut;
            int    path_count;
            int    point_count;
            double area;

            com.esri.core.geometry.Polygon        polygon9 = makePolygon9();
            com.esri.core.geometry.Polyline       cutter9  = makePolygonCutter9();
            com.esri.core.geometry.GeometryCursor cursor   = opCut.execute(false, polygon9, cutter9
                                                                           , spatialReference, null);
            cut         = (com.esri.core.geometry.Polygon)cursor.next();
            path_count  = cut.getPathCount();
            point_count = cut.getPointCount();
            area        = cut.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(path_count == 3);
            NUnit.Framework.Assert.IsTrue(point_count == 12);
            NUnit.Framework.Assert.IsTrue(area == 150);
            cut         = (com.esri.core.geometry.Polygon)cursor.next();
            path_count  = cut.getPathCount();
            point_count = cut.getPointCount();
            area        = cut.calculateArea2D();
            NUnit.Framework.Assert.IsTrue(path_count == 3);
            NUnit.Framework.Assert.IsTrue(point_count == 12);
            NUnit.Framework.Assert.IsTrue(area == 150);
            cut = (com.esri.core.geometry.Polygon)cursor.next();
            NUnit.Framework.Assert.IsTrue(cut == null);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }