Beispiel #1
0
        public void CanExecuteContainerLineNearTileBoundary()
        {
            IFeatureClass featureClass =
                CreatePolylineFeatureClass("CanExecuteContainerLineNearTileBoundary", 0.01);

            // Create error Feature
            const double x    = 2600000;
            const double y    = 1200000;
            IFeature     row1 = featureClass.CreateFeature();

            row1.Shape = GeometryFactory.CreateLine(
                GeometryFactory.CreatePoint(x, y),
                GeometryFactory.CreatePoint(x, y + 800));
            row1.Store();

            IFeature row2 = featureClass.CreateFeature();

            row2.Shape = GeometryFactory.CreateLine(
                GeometryFactory.CreatePoint(x + 1000, y),
                GeometryFactory.CreatePoint(x + 1000, y + 800));
            row2.Store();

            // row3 is within tile[0,0], but within the search tolerance from tile[0,1]
            IFeature row3 = featureClass.CreateFeature();

            row3.Shape = GeometryFactory.CreateLine(
                GeometryFactory.CreatePoint(x + 300, y),
                GeometryFactory.CreatePoint(x + 300, y + 599.000));
            row3.Store();

            var helper = new CanExecuteContainerHelper();

            helper.ExpectedMaximumRowCountPerTile = 2;

            var test = new VerifyingContainerTest((ITable)featureClass)
            {
                OnExecuteCore  = helper.ExecuteRow,
                OnCompleteTile = helper.CompleteTile,
                OnCachedRow    = helper.CachedRow
            };

            test.SetSearchDistance(2);

            var container = new TestContainer.TestContainer {
                TileSize = 600
            };

            container.AddTest(test);
            container.MaxCachedPointCount = 1;             // disable caching
            container.Execute();

            Assert.AreEqual(4 + 1, helper.CompleteTileCount); // + 1 : wegen initialem Tile
            Assert.AreEqual(
                5, helper.ExecuteRowCount);                   // row1,row in 2 Tiles, row3 only executed in first Tile
            Assert.AreEqual(6, helper.CachedRowCount);        // 3 features x 2 intersected tiles
        }
Beispiel #2
0
        public void CanExecuteContainerTwoVerticalLines()
        {
            IFeatureClass featureClass =
                CreatePolylineFeatureClass("CanExecuteContainerTwoVerticalLines", 0.01);

            // Create error Feature
            const double x    = 2600000;
            const double y    = 1200000;
            IFeature     row1 = featureClass.CreateFeature();

            row1.Shape = GeometryFactory.CreateLine(
                GeometryFactory.CreatePoint(x, y),
                GeometryFactory.CreatePoint(x, y + 800));
            row1.Store();

            IFeature row2 = featureClass.CreateFeature();

            row2.Shape = GeometryFactory.CreateLine(
                GeometryFactory.CreatePoint(x + 1000, y),
                GeometryFactory.CreatePoint(x + 1000, y + 800));
            row2.Store();

            var helper = new CanExecuteContainerHelper();

            helper.ExpectedMaximumRowCountPerTile = 1;

            var test = new VerifyingContainerTest((ITable)featureClass)
            {
                OnExecuteCore  = helper.ExecuteRow,
                OnCompleteTile = helper.CompleteTile
            };

            test.SetSearchDistance(10);

            var container = new TestContainer.TestContainer {
                TileSize = 600
            };

            container.AddTest(test);

            container.Execute();

            Assert.AreEqual(4 + 1, helper.CompleteTileCount);       // + 1 : wegen initialem Tile
            Assert.AreEqual(4, helper.ExecuteRowCount);             // 2 features x 2 intersected tiles
        }
Beispiel #3
0
        public void CanExecuteContainePointFeatures()
        {
            IFeatureClass featureClass =
                CreatePointFeatureClass("CanExecuteContainePointFeatures", 0.01);

            // Create error Feature
            const double x = 2600000;
            const double y = 1200000;

            AddPointFeature(featureClass, x, y);
            AddPointFeature(featureClass, x + 1000, y + 1000);

            // create a point 1m south of the upper tile boundary, in the second tile of the first row
            AddPointFeature(featureClass, x + 599, y + 900);

            var helper = new CanExecuteContainerHelper();

            helper.ExpectedMaximumRowCountPerTile = 1;

            var test = new VerifyingContainerTest((ITable)featureClass)
            {
                OnExecuteCore  = helper.ExecuteRow,
                OnCompleteTile = helper.CompleteTile
            };

            test.SetSearchDistance(0.5);

            var container = new TestContainer.TestContainer {
                TileSize = 600
            };

            container.AddTest(test);
            container.Execute();

            Assert.AreEqual(4 + 1, helper.CompleteTileCount);             // + 1 : wegen initialem Tile
            Assert.AreEqual(3, helper.ExecuteRowCount);
        }