Inheritance: ITileProvider
Exemplo n.º 1
0
        public void TileFetcherWithReturningNull()
        {
            // Arrange
            var tileProvider = new NullTileProvider();
            var tileSchema   = new GlobalSphericalMercator();
            var tileSource   = new TileSource(tileProvider, tileSchema);
            var tileFetcher  = new TileFetcher(tileSource, new MemoryCache <Feature>());

            // Act
            for (int i = 0; i < 300; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    tileFetcher.ViewChanged(tileSchema.Extent.ToBoundingBox(), tileSchema.Resolutions[j.ToString()].UnitsPerPixel);
                    System.Threading.Thread.Sleep(10);
                }
            }

            // Assert
            while (tileFetcher.Busy)
            {
            }
            ;

            Assert.Pass("The fetcher did not go into an infinite loop");
        }
Exemplo n.º 2
0
        public void TileRequestThatReturnsNullShouldNotBeRequestedAgain()
        {
            // Arrange
            var tileProvider    = new NullTileProvider();
            var tileSchema      = new GlobalSphericalMercator();
            var tileSource      = new TileSource(tileProvider, tileSchema);
            var cache           = new MemoryCache <Feature>();
            var fetchDispatcher = new TileFetchDispatcher(cache, tileSource.Schema, (tileInfo) => TileToFeature(tileSource, tileInfo));
            var tileMachine     = new FetchMachine(fetchDispatcher);
            var level           = "3";
            var tilesInLevel    = 64;

            // Act
            fetchDispatcher.SetViewport(tileSchema.Extent.ToBoundingBox(), tileSchema.Resolutions[level].UnitsPerPixel);
            tileMachine.Start();
            while (fetchDispatcher.Busy)
            {
            }
            // do it again
            fetchDispatcher.SetViewport(tileSchema.Extent.ToBoundingBox(), tileSchema.Resolutions[level].UnitsPerPixel);
            tileMachine.Start();
            while (fetchDispatcher.Busy)
            {
                Thread.Sleep(1);
            }

            // Assert
            Assert.AreEqual(tilesInLevel, tileProvider.TotalCount);
        }
Exemplo n.º 3
0
        public void TileFetcherWithReturningNull()
        {
            // Arrange
            var tileProvider = new NullTileProvider();
            var tileSchema = new GlobalSphericalMercator();
            var tileSource = new TileSource(tileProvider, tileSchema);
            var tileFetcher = new TileFetcher(tileSource, new MemoryCache<Feature>());

            // Act
            for (int i = 0; i < 300; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    tileFetcher.ViewChanged(tileSchema.Extent.ToBoundingBox(), tileSchema.Resolutions[j.ToString()].UnitsPerPixel);
                    System.Threading.Thread.Sleep(10);
                }
            }

            // Assert
            while (tileFetcher.Busy) { }

            Assert.Pass("The fetcher did not go into an infinite loop");
        }