Ejemplo n.º 1
0
        public OsmTileSource(OsmRequest osmRequest = null,
            IPersistentCache<byte[]> persistentCache = null,
            Func<Uri, byte[]> fetchTile = null)
            : base(new WebTileProvider(
                        osmRequest ?? new OsmRequest(KnownTileSource.OpenCycleMap), 
                        persistentCache,
                        fetchTile), 
                new SphericalMercatorInvertedWorldSchema())
        {
            if (osmRequest == null) osmRequest = new OsmRequest(KnownTileSource.OpenCycleMap);
            var resolutionsToDelete = new List<int>();
            var resolutions = Schema.Resolutions;
            for (var i = 0; i < resolutions.Count; i++)
            {
                var id = int.Parse(resolutions[i.ToString(CultureInfo.InvariantCulture)].Id);
                if (id < osmRequest.OsmConfig.MinResolution || id > osmRequest.OsmConfig.MaxResolution)
                {
                    //System.Diagnostics.Debug.WriteLine(string.Format("must remove resolution at index {0}", i));
                    resolutionsToDelete.Add(i);
                }
            }

            int numDeleted = 0;
            foreach (var i in resolutionsToDelete)
            {
                resolutions.Remove((i - numDeleted++).ToString(CultureInfo.InvariantCulture));
            }
        }
Ejemplo n.º 2
0
        public OsmTileSource(OsmRequest osmRequest = null,
                             IPersistentCache <byte[]> persistentCache = null,
                             Func <Uri, byte[]> fetchTile = null)
            : base(new WebTileProvider(
                       osmRequest ?? new OsmRequest(KnownTileSource.OpenCycleMap),
                       persistentCache,
                       fetchTile),
                   new SphericalMercatorInvertedWorldSchema())
        {
            if (osmRequest == null)
            {
                osmRequest = new OsmRequest(KnownTileSource.OpenCycleMap);
            }
            var resolutionsToDelete = new List <int>();
            var resolutions         = Schema.Resolutions;

            for (var i = 0; i < resolutions.Count; i++)
            {
                var id = int.Parse(resolutions[i.ToString(CultureInfo.InvariantCulture)].Id);
                if (id < osmRequest.OsmConfig.MinResolution || id > osmRequest.OsmConfig.MaxResolution)
                {
                    //System.Diagnostics.Debug.WriteLine(string.Format("must remove resolution at index {0}", i));
                    resolutionsToDelete.Add(i);
                }
            }

            int numDeleted = 0;

            foreach (var i in resolutionsToDelete)
            {
                resolutions.Remove((i - numDeleted++).ToString(CultureInfo.InvariantCulture));
            }
        }
Ejemplo n.º 3
0
        public OsmTileSource(OsmRequest osmRequest = null,
            IPersistentCache<byte[]> persistentCache = null,
            Func<Uri, HttpWebRequest> webRequestFactory = null)
            : base(new WebTileProvider(
                        osmRequest ?? new OsmRequest(KnownTileServers.Mapnik), 
                        persistentCache,
                        webRequestFactory), 
                new SphericalMercatorInvertedWorldSchema())
        {
            if (osmRequest == null) osmRequest = new OsmRequest(KnownTileServers.Mapnik);
            var resolutionsToDelete = new List<int>();
            var resolutions = Schema.Resolutions;
            for (var i = 0; i < resolutions.Count; i++)
            {
                var id = int.Parse(resolutions[i].Id);
                if (id < osmRequest.OsmConfig.MinResolution || id > osmRequest.OsmConfig.MaxResolution)
                {
                    //System.Diagnostics.Debug.WriteLine(string.Format("must remove resolution at index {0}", i));
                    resolutionsToDelete.Add(i);
                }
            }

            int numDeleted = 0;
            foreach (var i in resolutionsToDelete)
            {
                resolutions.Remove(i - numDeleted++);
            }
        }