public HttpTileSource(ITileSchema tileSchema, IRequest request, string name = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> tileFetcher = null) { _provider = new HttpTileProvider(request, persistentCache, tileFetcher); Schema = tileSchema; Name = name ?? string.Empty; }
public WebTileProvider(IRequest request = null, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> fetchTile = null) { Request = request ?? new NullRequest(); _persistentCache = persistentCache ?? new NullCache(); _fetchTile = fetchTile ?? (RequestHelper.FetchImage); }
public WebTileProvider(IRequest request = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> fetchTile = null) { Request = request ?? new NullRequest(); _persistentCache = persistentCache ?? new NullCache(); _fetchTile = fetchTile ?? (RequestHelper.FetchImage); }
public WebTileProvider(IRequest request = null, IPersistentCache<byte[]> persistentCache = null, Func<Uri, HttpWebRequest> webRequestFactory = null) { _request = request ?? new NullRequest(); _persistentCache = persistentCache ?? new NullCache(); _webRequestFactory = webRequestFactory ?? (uri => (HttpWebRequest) WebRequest.Create(uri)); }
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)); } }
public WebTileProvider(IRequest request = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, HttpWebRequest> webRequestFactory = null) { _request = request ?? new NullRequest(); _persistentCache = persistentCache ?? new NullCache(); _webRequestFactory = webRequestFactory ?? (uri => (HttpWebRequest)WebRequest.Create(uri)); }
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++); } }
public HttpTileSource(ITileSchema tileSchema, IRequest request, string name = null, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> tileFetcher = null) { _provider = new HttpTileProvider(request, persistentCache, tileFetcher); _tileSchema = tileSchema; Name = name ?? string.Empty; }
public HttpTileProvider(IRequest request = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> fetchTile = null) { _request = request ?? new NullRequest(); PersistentCache = persistentCache ?? new NullCache(); _fetchTile = fetchTile ?? FetchTile; }
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)); } }
public HttpTileSourceTDT(ITileSchema tileSchema, IRequest request, string name = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> tileFetcher = null, Attribution attibution = null) { _provider = new HttpTileProvider(request, persistentCache, tileFetcher); Schema = tileSchema; Name = name ?? string.Empty; Attribution = attibution ?? new Attribution(); }
public CustomHttpTileProvider(IRequest request = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> fetchTile = null) { _request = request; PersistentCache = persistentCache ?? new NullCache(); _fetchTile = fetchTile ?? FetchTile; _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mapsui"); }
public HttpTileProvider(IRequest request = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> fetchTile = null, string userAgent = null) { _request = request ?? new NullRequest(); PersistentCache = persistentCache ?? new NullCache(); _fetchTile = fetchTile ?? FetchTile; _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(userAgent ?? "BruTile Tile Library"); }
public ArcGisTileSource( string baseUrl, ITileSchema schema, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> fetchTile = null) : base(new HttpTileProvider(CreateArcGISRequest(baseUrl), persistentCache, fetchTile), schema) { BaseUrl = baseUrl; }
public ArcGisTileSource( string baseUrl, ITileSchema schema, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> fetchTile = null) : base(new WebTileProvider(CreateArcGISRequest(baseUrl), persistentCache, fetchTile), schema) { BaseUrl = baseUrl; }
/// <summary> /// Static factory method for known tile services /// </summary> /// <param name="source">The source</param> /// <param name="apiKey">An (optional) API key</param> /// <param name="persistentCache">A place to permanently store tiles (file of database)</param> /// <param name="tileFetcher">Option to override the web request</param> /// <returns>The tile source</returns> public static HttpTileSource Create(KnownTileSource source = KnownTileSource.OpenCycleMap, string apiKey = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> tileFetcher = null) { switch (source) { case KnownTileSource.OpenCycleMap: return(new HttpTileSource(new GlobalSphericalMercator(0, 17), "https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey={k}", new[] { "a", "b", "c" }, apiKey: apiKey, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.ThunderforestTransport: return(new HttpTileSource(new GlobalSphericalMercator(0, 20), "https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey={k}", new[] { "a", "b", "c" }, apiKey: apiKey, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.ThunderforestOutdoors: return(new HttpTileSource(new GlobalSphericalMercator(0, 20), "https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey={k}", new[] { "a", "b", "c" }, apiKey: apiKey, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.ThunderforestLandscape: return(new HttpTileSource(new GlobalSphericalMercator(0, 20), "https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey={k}", new[] { "a", "b", "c" }, apiKey: apiKey, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.BingAerial: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher, new Attribution("© Microsoft"))); case KnownTileSource.BingHybrid: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/h{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher, new Attribution("© Microsoft"))); case KnownTileSource.BingRoads: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher, new Attribution("© Microsoft"))); default: throw new NotSupportedException("KnownTileSource not known"); } }
public ArcGisTileSource( string baseUrl, ITileSchema schema, IPersistentCache<byte[]> persistentCache = null, Func<Uri, HttpWebRequest> webRequestFactory = null) : base( new WebTileProvider(CreateArcGISRequest(baseUrl), persistentCache, webRequestFactory), schema) { BaseUrl = baseUrl; }
public ArcGisTileSource( string baseUrl, ITileSchema schema, IPersistentCache <byte[]> persistentCache = null, Func <Uri, HttpWebRequest> webRequestFactory = null) : base( new WebTileProvider(CreateArcGISRequest(baseUrl), persistentCache, webRequestFactory), schema) { BaseUrl = baseUrl; }
public static HttpTileSource Create( KartverketTileSource source = KartverketTileSource.Topografisk, Func <Uri, byte[]> tileFetcher = null, IPersistentCache <byte[]> persistentCache = null) => new HttpTileSource( new GlobalSphericalMercator(zoomLevels: TileSourceToZoomLevels(source)), "https://{s}.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=" + TileSourceToLayer(source) + "&zoom={z}&x={x}&y={y}", serverNodes: new[] { "opencache", "opencache2", "opencache3" }, persistentCache: persistentCache, name: source.ToString(), attribution: attribution, tileFetcher: tileFetcher);
public HttpTileSource(ITileSchema tileSchema, IRequest request, string name = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> tileFetcher = null, Attribution attribution = null, string userAgent = null) { _request = request ?? new NullRequest(); PersistentCache = persistentCache ?? new NullCache(); _fetchTile = tileFetcher ?? FetchTile; _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(userAgent ?? "BruTile Tile Library"); Schema = tileSchema; Name = name ?? string.Empty; Attribution = attribution ?? new Attribution(); }
public GoogleTileSource(GoogleRequest request, IPersistentCache<byte[]> persistentCache = null) { _tileSchema = new SphericalMercatorInvertedWorldSchema(); _tileProvider = new WebTileProvider(request, persistentCache, // The Google requests needs to fake the UserAgent en Referer. uri => { var httpWebRequest = (HttpWebRequest) WebRequest.Create(uri); httpWebRequest.UserAgent = UserAgent; httpWebRequest.Referer = Referer; return httpWebRequest; }); }
public ElitUaJobs( ILogger <ElitUaJobs> logger, ElitUaClient elitUaClient, EkSearchManagementClient ekSearchManagementClient, IPersistentCache persistentCache, INotificationManager notificationManager) { _logger = logger; _elitUaClient = elitUaClient; _ekSearchManagementClient = ekSearchManagementClient; _persistentCache = persistentCache; _notificationManager = notificationManager; }
public GoogleTileSource(GoogleRequest request, IPersistentCache <byte[]> persistentCache = null) { _tileSchema = new SphericalMercatorInvertedWorldSchema(); _provider = new HttpTileProvider(request, persistentCache, // The Google requests needs to fake the UserAgent en Referer. uri => { var httpWebRequest = (HttpWebRequest)WebRequest.Create(uri); httpWebRequest.UserAgent = UserAgent; httpWebRequest.Referer = Referer; return(RequestHelper.FetchImage(httpWebRequest)); }); }
/// <summary> /// Initializes the configuration based on the given <see cref="ITileSource"/>. /// </summary> /// <param name="newTileSource">The tile source to initialize for.</param> /// <exception cref="CannotCreateTileCacheException">Thrown when a critical error /// occurs when creating the tile cache.</exception> /// <exception cref="ObjectDisposedException">Thrown when calling this method while /// this instance is disposed.</exception> protected void InitializeFromTileSource(ITileSource newTileSource) { ThrowExceptionIfDisposed(); tileSource = newTileSource; IPersistentCache <byte[]> tileCache = CreateTileCache(); TileFetcher = new AsyncTileFetcher(tileSource, BruTileSettings.MemoryCacheMinimum, BruTileSettings.MemoryCacheMaximum, tileCache); Initialized = true; }
public ExchangeRateAutoUpdateManager( KioskBrainsContext dbContext, UaCentralBankApiProxy uaCentralBankApiProxy, INotificationManager notificationManager, IPersistentCache persistentCache, SystemCustomerProvider systemCustomerProvider, ILogger <ExchangeRateAutoUpdateManager> logger) { _dbContext = dbContext; _uaCentralBankApiProxy = uaCentralBankApiProxy; _notificationManager = notificationManager; _persistentCache = persistentCache; _logger = logger; }
public static ITileSource Build(string urlToTileMapXml, bool overrideTmsUrlWithUrlToTileMapXml, IPersistentCache <byte[]>?persistentCache = null) { Exception?error = null; var bytes = (persistentCache as IUrlPersistentCache)?.Find(urlToTileMapXml); if (bytes == null) { var webRequest = (HttpWebRequest)WebRequest.Create(urlToTileMapXml); using var waitHandle = new AutoResetEvent(false); var state = new object[] { new Action <Exception>(ex => { error = ex; waitHandle.Set(); }), new Action <byte[]?>(ts => { bytes = ts; waitHandle.Set(); }), webRequest }; webRequest.BeginGetResponse(LoadTmsLayer, state); waitHandle.WaitOne(); } if (error is not null) { throw error; } if (bytes is null) { throw new HttpRequestException($"Could not retrieve data from {urlToTileMapXml}"); } var stream = new MemoryStream(bytes); var tileSource = overrideTmsUrlWithUrlToTileMapXml ? TileMapParser.CreateTileSource(stream, urlToTileMapXml, persistentCache: persistentCache) : TileMapParser.CreateTileSource(stream, persistentCache: persistentCache); return(tileSource !); }
public static Map CreateMap(IPersistentCache <byte[]>?persistentCache, KnownTileSource source = KnownTileSource.BingAerial) { var map = new Map(); var apiKey = "Enter your api key here"; // Contact Microsoft about how to use this map.Layers.Add(new TileLayer(KnownTileSources.Create(source, apiKey, persistentCache), dataFetchStrategy: new DataFetchStrategy()) // DataFetchStrategy prefetches tiles from higher levels { Name = "Bing Aerial", }); map.Home = n => n.NavigateTo(new MPoint(1059114.80157058, 5179580.75916194), map.Resolutions[14]); map.BackColor = Color.FromString("#000613"); return(map); }
/// <summary> /// Construct a new Rebar target compiler /// </summary> /// <param name="project">project</param> /// <param name="host">The composition host</param> /// <param name="targetIdentity">The qualified name of the target</param> /// <param name="compileCache">The compile cache</param> /// <param name="factories">Factories for compilers for different file types</param> public TargetCompiler( Project project, ICompositionHost host, TargetCompilerIdentity targetIdentity, IPersistentCache compileCache, IEnumerable <ITargetCompileHandlerFactory> factories, ITargetCompilerLookup targetCompilerLookup) : base( host.GetSharedExportedValue <AnyMocCompiler>(), host.GetSharedExportedValue <ScheduledActivityManager>(), compileCache, targetIdentity, factories, targetCompilerLookup) { Project = project; }
private void OnUserLogout() { IPersistentCache c = ServiceProvider.GetService <IPersistentCache>(); if (c != null) { c.Persistent(); } IDataBuffers db = ServiceProvider.GetService <IDataBuffers>(); if (db != null) { db.Clear(); } //UserConfigurationHelper.UploadConfiguration(SystemConfiguration.UserName, SystemDirectory.UserDataDirectory); }
private void OnUserLogin() { DateTime?d = UserConfigurationHelper.DownloadConfiguration(SystemConfiguration.GlobalUserName, SystemDirectory.GlobalDataDirectory); //Feng.Utils.UserConfigurationHelper.DownloadConfiguration(SystemConfiguration.UserName, SystemDirectory.UserDataDirectory); var ass = System.Reflection.Assembly.GetCallingAssembly(); if (ass.Location == null) { return; } var assInfo = new System.IO.FileInfo(ass.Location); IPersistentCache c = ServiceProvider.GetService <IPersistentCache>(); if (c != null && c.CacheTime.HasValue) { //c.Unpersistent(); if ((!d.HasValue || d.Value < c.CacheTime.Value) && assInfo.LastWriteTime < c.CacheTime.Value) { c.Unpersistent(); } else { c.Destroy(); } } // Spring.net 默认是Singleton的 IDataBuffers db = ServiceProvider.GetService <IDataBuffers>(); if (db != null) { db.LoadData(); } if (!m_haveBindCommands) { CommnadBindingHelper.BindingCommands(); m_haveBindCommands = true; } }
public void CreateTileCache_DirectoryNotCreated_CreatesFileCacheDirectoryStructure() { // Setup string rootPath = TestHelper.GetScratchPadPath("CreateTileCache_DirectoryNotCreated_CreatesFileCacheDirectoryStructure"); DoAndCleanupAfter( () => { using (var configuration = new SimplePersistentCacheConfiguration(rootPath)) { // Call IPersistentCache <byte[]> cache = configuration.TestCreateTileCache(); // Assert Assert.IsInstanceOf <FileCache>(cache); Assert.IsTrue(Directory.Exists(rootPath)); } }, rootPath); }
public static TileSource CreateTileSource(Stream tileMapResource, string overrideUrl = null, Dictionary<string, string> customParameters = null, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> fetchTile = null) { var reader = new StreamReader(tileMapResource); var serializer = new XmlSerializer(typeof(TileMap)); var tileMap = (TileMap)serializer.Deserialize(reader); var tileSchema = CreateSchema(tileMap); var tileUrls = new Dictionary<string, Uri>(); foreach (TileMapTileSetsTileSet ts in tileMap.TileSets.TileSet) { tileUrls[ts.order] = new Uri(ts.href); } var tileProvider = new HttpTileProvider(CreateRequest(tileUrls, tileSchema.Format, overrideUrl, customParameters), persistentCache, fetchTile); return new TileSource(tileProvider, tileSchema); }
/// <summary> /// Creates a RasterizingTileLayer which rasterizes a layer for performance /// </summary> /// <param name="layer">The Layer to be rasterized</param> /// <param name="renderResolutionMultiplier"></param> /// <param name="rasterizer">Rasterizer to use. null will use the default</param> /// <param name="pixelDensity"></param> /// <param name="minTiles">Minimum number of tiles to cache</param> /// <param name="maxTiles">Maximum number of tiles to cache</param> /// <param name="dataFetchStrategy">Strategy to get list of tiles for given extent</param> /// <param name="renderFetchStrategy"></param> /// <param name="minExtraTiles">Number of minimum extra tiles for memory cache</param> /// <param name="maxExtraTiles">Number of maximum extra tiles for memory cache</param> /// <param name="persistentCache">Persistent Cache</param> /// <param name="projection">Projection</param> public RasterizingTileLayer( ILayer layer, double renderResolutionMultiplier = 1, IRenderer?rasterizer = null, float pixelDensity = 1, int minTiles = 200, int maxTiles = 300, IDataFetchStrategy?dataFetchStrategy = null, IRenderFetchStrategy?renderFetchStrategy = null, int minExtraTiles = -1, int maxExtraTiles = -1, IPersistentCache <byte[]>?persistentCache = null, IProjection?projection = null) : base( new RasterizingTileProvider(layer, renderResolutionMultiplier, rasterizer, pixelDensity, persistentCache, projection), minTiles, maxTiles, dataFetchStrategy, renderFetchStrategy, minExtraTiles, maxExtraTiles) { SourceLayer = layer; }
public TmsTileSource(Uri serviceUri, ITileSchema tileSchema, IPersistentCache <byte[]> persistentCache = null, Func <Uri, HttpWebRequest> webRequestFactory = null) : base(new WebTileProvider(new TmsRequest(serviceUri, tileSchema.Format), persistentCache, webRequestFactory), tileSchema) { }
public TfsAnalytics(TfsConnector tfs, IPersistentCache<ChangeInfo> changesCache) { this.changesCache = changesCache; this.tfs = tfs; }
public HttpTileSourceTDT(ITileSchema tileSchema, string urlFormatter, IEnumerable <string> serverNodes = null, string apiKey = null, string name = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> tileFetcher = null, Attribution attribution = null) : this(tileSchema, new BasicRequestTDT(urlFormatter, serverNodes, apiKey), name, persistentCache, tileFetcher, attribution) { }
public HttpTileSource(ITileSchema tileSchema, string urlFormatter, IEnumerable<string> serverNodes = null, string apiKey = null, string name = null, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> tileFetcher = null) : this(tileSchema, new BasicRequest(urlFormatter, serverNodes, apiKey), name, persistentCache, tileFetcher) { }
/// <summary> /// Static factory method for known tile services /// </summary> /// <param name="source">The source</param> /// <param name="apiKey">An (optional) API key</param> /// <param name="persistentCache">A place to permanently store tiles (file of database)</param> /// <param name="tileFetcher">Option to override the web request</param> /// <returns>The tile source</returns> public static HttpTileSource Create(KnownTileSource source = KnownTileSource.OpenStreetMap, string apiKey = null, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> tileFetcher = null) { switch (source) { case KnownTileSource.OpenStreetMap: return new HttpTileSource(new GlobalSphericalMercator(0, 18), "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", new[] {"a", "b", "c"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.OpenCycleMap: return new HttpTileSource(new GlobalSphericalMercator(0, 17), "http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png", new[] {"a", "b", "c"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.OpenCycleMapTransport: return new HttpTileSource(new GlobalSphericalMercator(0, 20), "http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png", new[] {"a", "b", "c"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.CloudMadeWebStyle: return new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.cloudmade.com/{k}/1/256/{z}/{x}/{y}.png", new[] {"a", "b", "c"}, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.CloudMadeFineLineStyle: return new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.cloudmade.com/{k}/2/256/{z}/{x}/{y}.png", new[] {"a", "b", "c"}, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.CloudMadeNoNames: return new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.cloudmade.com/{k}/3/256/{z}/{x}/{y}.png", new[] {"a", "b", "c"}, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.MapQuest: return new HttpTileSource(new GlobalSphericalMercator(), "http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png", new[] {"1", "2", "3", "4"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.MapQuestAerial: return new HttpTileSource(new GlobalSphericalMercator(0, 11), "http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png", new[] {"1", "2", "3", "4"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.MapQuestRoadsAndLabels: return new HttpTileSource(new GlobalSphericalMercator(), "http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png", new[] {"1", "2", "3", "4"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.BingAerial: return new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=517&token={k}", new [] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.BingHybrid: return new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/h{quadkey}.jpeg?g=517&token={k}", new [] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.BingRoads: return new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.BingAerialStaging: return new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.staging.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=517&token={k}", new [] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.BingHybridStaging: return new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.staging.tiles.virtualearth.net/tiles/h{quadkey}.jpeg?g=517&token={k}", new [] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.BingRoadsStaging: return new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.staging.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher); case KnownTileSource.StamenToner: return new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png", new[] {"a", "b", "c", "d"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.StamenTonerLite: return new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png", new[] {"a", "b", "c", "d"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.StamenWatercolor: return new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png", new[] {"a", "b", "c", "d"}, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.StamenTerrain: return new HttpTileSource(new GlobalSphericalMercator(4) { Extent = new Extent(-14871588.04,2196494.41775,-5831227.94199995,10033429.95725) }, "http://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.png", new[] { "a", "b", "c", "d" }, name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.EsriWorldTopo: return new HttpTileSource(new GlobalSphericalMercator(), "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.EsriWorldPhysical: return new HttpTileSource(new GlobalSphericalMercator(0, 8), "http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.EsriWorldShadedRelief: return new HttpTileSource(new GlobalSphericalMercator(0, 13), "http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.EsriWorldReferenceOverlay: return new HttpTileSource(new GlobalSphericalMercator(0, 13), "http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.EsriWorldTransportation: return new HttpTileSource(new GlobalSphericalMercator(), "http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.EsriWorldBoundariesAndPlaces: return new HttpTileSource(new GlobalSphericalMercator(), "http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); case KnownTileSource.EsriWorldDarkGrayBase: return new HttpTileSource(new GlobalSphericalMercator(0, 16), "http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache:persistentCache, tileFetcher:tileFetcher); default: throw new NotSupportedException("KnownTileSource not known"); } }
public TmsTileSource(Uri serviceUri, ITileSchema tileSchema, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> fetchTile = null) : base(new WebTileProvider(new TmsRequest(serviceUri, tileSchema.Format), persistentCache, fetchTile), tileSchema) { }
public HttpVectorTileSource(ITileSchema tileSchema, string urlFormatter, IEnumerable<string> serverNodes = null, string apiKey = null, string name = null, IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> tileFetcher = null) : base(tileSchema, urlFormatter, serverNodes, apiKey, name, persistentCache, tileFetcher) { }
public TmsTileSource(Uri serviceUri, ITileSchema tileSchema, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> fetchTile = null) : base(new WebTileProvider(new TmsRequest(serviceUri, tileSchema.Format), persistentCache, fetchTile), tileSchema) { }
public static TileSource CreateTileSource(Stream tileMapResource, string overrideUrl = null, Dictionary <string, string> customParameters = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, HttpWebRequest> webRequestFactory = null) { var reader = new StreamReader(tileMapResource); var serializer = new XmlSerializer(typeof(TileMap)); var tileMap = (TileMap)serializer.Deserialize(reader); var tileSchema = CreateSchema(tileMap); var tileUrls = new Dictionary <string, Uri>(); foreach (TileMapTileSetsTileSet ts in tileMap.TileSets.TileSet) { tileUrls[ts.order] = new Uri(ts.href); } var tileProvider = new WebTileProvider(CreateRequest(tileUrls, tileSchema.Format, overrideUrl, customParameters), persistentCache, webRequestFactory); return(new TileSource(tileProvider, tileSchema)); }
/// <summary> /// Static factory method for known tile services /// </summary> /// <param name="source">The source</param> /// <param name="apiKey">An (optional) API key</param> /// <param name="persistentCache">A place to permanently store tiles (file of database)</param> /// <param name="tileFetcher">Option to override the web request</param> /// <returns>The tile source</returns> public static HttpTileSource Create(KnownTileSource source = KnownTileSource.OpenStreetMap, string apiKey = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> tileFetcher = null) { switch (source) { case KnownTileSource.OpenStreetMap: return(new HttpTileSource(new GlobalSphericalMercator(0, 18), "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", new[] { "a", "b", "c" }, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.OpenCycleMap: return(new HttpTileSource(new GlobalSphericalMercator(0, 17), "http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png", new[] { "a", "b", "c" }, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.OpenCycleMapTransport: return(new HttpTileSource(new GlobalSphericalMercator(0, 20), "http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png", new[] { "a", "b", "c" }, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.BingAerial: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher, new Attribution("© Microsoft"))); case KnownTileSource.BingHybrid: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/h{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher, new Attribution("© Microsoft"))); case KnownTileSource.BingRoads: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher, new Attribution("© Microsoft"))); case KnownTileSource.BingAerialStaging: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.staging.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher)); case KnownTileSource.BingHybridStaging: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.staging.tiles.virtualearth.net/tiles/h{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher)); case KnownTileSource.BingRoadsStaging: return(new HttpTileSource(new GlobalSphericalMercator(1), "http://t{s}.staging.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=517&token={k}", new[] { "0", "1", "2", "3", "4", "5", "6", "7" }, apiKey, source.ToString(), persistentCache, tileFetcher)); case KnownTileSource.StamenToner: return(new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png", new[] { "a", "b", "c", "d" }, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.StamenTonerLite: return(new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png", new[] { "a", "b", "c", "d" }, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.StamenWatercolor: return(new HttpTileSource(new GlobalSphericalMercator(), "http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png", new[] { "a", "b", "c", "d" }, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.StamenTerrain: return (new HttpTileSource( new GlobalSphericalMercator(4) { Extent = new Extent(-14871588.04, 2196494.41775, -5831227.94199995, 10033429.95725) }, "http://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.png", new[] { "a", "b", "c", "d" }, name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher, attribution: OpenStreetMapAttribution)); case KnownTileSource.EsriWorldTopo: return(new HttpTileSource(new GlobalSphericalMercator(), "https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher)); case KnownTileSource.EsriWorldPhysical: return(new HttpTileSource(new GlobalSphericalMercator(0, 8), "https://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher)); case KnownTileSource.EsriWorldShadedRelief: return(new HttpTileSource(new GlobalSphericalMercator(0, 13), "https://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher)); case KnownTileSource.EsriWorldReferenceOverlay: return(new HttpTileSource(new GlobalSphericalMercator(0, 13), "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher)); case KnownTileSource.EsriWorldTransportation: return(new HttpTileSource(new GlobalSphericalMercator(), "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher)); case KnownTileSource.EsriWorldBoundariesAndPlaces: return(new HttpTileSource(new GlobalSphericalMercator(), "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher)); case KnownTileSource.EsriWorldDarkGrayBase: return(new HttpTileSource(new GlobalSphericalMercator(0, 16), "https://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}", name: source.ToString(), persistentCache: persistentCache, tileFetcher: tileFetcher)); default: throw new NotSupportedException("KnownTileSource not known"); } }
public BingTileSource( BingRequest bingRequest, IPersistentCache<byte[]> persistentCache = null) : base(new WebTileProvider(bingRequest, persistentCache), new GlobalSphericalMercator("jpg", YAxis.OSM, 1, 19, "Bing")) { }
public YahooTileSource(YahooRequest request, IPersistentCache<byte[]> persistentCache = null) { _tileSchema = new SphericalMercatorInvertedWorldSchema(); _tileProvider = new WebTileProvider(request, persistentCache); }
public HttpVectorTileSource(ITileSchema tileSchema, string urlFormatter, IEnumerable <string> serverNodes = null, string apiKey = null, string name = null, IPersistentCache <byte[]> persistentCache = null, Func <Uri, byte[]> tileFetcher = null) : base(tileSchema, urlFormatter, serverNodes, apiKey, name, persistentCache, tileFetcher) { }
public TmsTileSource(Uri serviceUri, ITileSchema tileSchema, IPersistentCache<byte[]> persistentCache = null, Func<Uri, HttpWebRequest> webRequestFactory = null) : base(new WebTileProvider(new TmsRequest(serviceUri, tileSchema.Format), persistentCache, webRequestFactory), tileSchema) { }