protected override string GetTileAddress(TileIndex.Full tileIndex) { var level = this.LOD.MaxLODLevel - tileIndex.LODLevel; return ($"https://a.tile.openstreetmap.org/{level}/{tileIndex.Column}/{tileIndex.Row}.png"); }
public DownloadImageTask(WebImageSource owner, TileIndex.Full index, string url) { this.Owner = owner; this.TileIndex = index; this.Url = url; this.WebClient = new WebClient(); Task.Run(() => { if (!this.TryLoadCache()) { this.StartDownloading(); } }); }
public Task <BitmapSource> LoadTileAsync(TileIndex.Full index, IProgress <double> progress, CancellationToken cancellationToken) { if (!this.DownloadTasks.TryGetValue(index, out var downloadTask) || !downloadTask.Status.IsAlive()) { var url = this.GetTileAddress(index); downloadTask = new DownloadImageTask(this, index, url); lock (this.DownloadTasks) { this.DownloadTasks.Add(index, downloadTask); } } downloadTask.HandleObserver(progress, cancellationToken); return(downloadTask.CompletionSource.Task); }
public UpdateTileRequest(TileIndex.Full tileIndex, Rect worldRect) { this.TileIndex = tileIndex; this.WorldRect = worldRect; }
protected abstract string GetTileAddress(TileIndex.Full tileIndex);