public void XYZTileWalker_ZoomLevel20()
        {
            var walker = new XYZTileWalker(145.030539, -37.818251, 145.031800, -37.817484, 20);

            walker.SetSpecificZoomLevels(new[] { 20 });
            var list = walker.GetTileList();

            Assert.Equal(16, list.Length);
        }
Esempio n. 2
0
        static async Task <int> RunXYZAsync(XYZSeederOptions options)
        {
            int ret = 0;

            try
            {
                options.Validate();

                var xyz    = new XYZTileService(options.UrlTemplate);
                var walker = new XYZTileWalker(options.MinX, options.MinY, options.MaxX, options.MaxY, options.MaxZoomLevel ?? XYZTileWalker.DEFAULT_MAX_ZOOM_LEVEL);

                if (options.SpecificZoomLevels != null)
                {
                    walker.SetSpecificZoomLevels(options.SpecificZoomLevels);
                }

                var seederOptions = new TileSeederOptions();
                seederOptions.MaxDegreeOfParallelism = options.MaxDegreeOfParallelism;
                seederOptions.ErrorLogger            = ErrorLogger;
                var seeder = new TileSeeder(xyz, walker, seederOptions);

                var progress = new ConsoleProgress();
                var stats    = await seeder.RunAsync(progress);

                Console.WriteLine($"Rendered {stats.TilesRendered} tiles in {stats.Duration}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                ret = 1;
            }
            finally
            {
                if (options.Wait)
                {
                    Console.WriteLine("Press any key to continue");
                    Console.Read();
                }
            }
            return(ret);
        }