void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { this.label1.Text = "Fetching tile at zoom (" + zoom + "): " + ((int)e.UserState).ToString() + " of " + all + ", complete: " + e.ProgressPercentage.ToString() + "%"; this.progressBarDownload.Value = e.ProgressPercentage; if (Overlay != null) { GPoint?l = null; lock (this) { if (CachedTiles.Count > 0) { l = CachedTiles.Dequeue(); } } if (l.HasValue) { var px = Overlay.Control.MapProvider.Projection.FromTileXYToPixel(l.Value); var p = Overlay.Control.MapProvider.Projection.FromPixelToLatLng(px, zoom); var r1 = Overlay.Control.MapProvider.Projection.GetGroundResolution(zoom, p.Lat); var r2 = Overlay.Control.MapProvider.Projection.GetGroundResolution((int)Overlay.Control.Zoom, p.Lat); var sizeDiff = r2 / r1; GMapMarkerTile m = new GMapMarkerTile(p, (int)(Overlay.Control.MapProvider.Projection.TileSize.Width / sizeDiff)); Overlay.Markers.Add(m); } } }
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { this.label1.Text = String.Format(LblFetchingMessageFormat, zoom, (zoomfinal == -1)? zoom: zoomfinal, ((int)e.UserState).ToString(), all, e.ProgressPercentage.ToString()); this.progressBarDownload.Value = e.ProgressPercentage; if (Overlay != null) { GPoint?l = null; lock (this) { if (CachedTiles.Count > 0) { l = CachedTiles.Dequeue(); } } if (l.HasValue) { var px = Overlay.Control.MapProvider.Projection.FromTileXYToPixel(l.Value); var p = Overlay.Control.MapProvider.Projection.FromPixelToLatLng(px, zoom); var r1 = Overlay.Control.MapProvider.Projection.GetGroundResolution(zoom, p.Lat); var r2 = Overlay.Control.MapProvider.Projection.GetGroundResolution((int)Overlay.Control.Zoom, p.Lat); var sizeDiff = r2 / r1; GMapMarkerTile m = new GMapMarkerTile(p, (int)(Overlay.Control.MapProvider.Projection.TileSize.Width / sizeDiff)); Overlay.Markers.Add(m); } } }
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { this.label1.Text = "Fetching tile at zoom (" + zoom + "): " + ((int)e.UserState).ToString() + " of " + all + ", complete: " + e.ProgressPercentage.ToString() + "%"; this.progressBarDownload.Value = e.ProgressPercentage; if (Overlay != null) { GPoint? l = null; lock (this) { if (CachedTiles.Count > 0) { l = CachedTiles.Dequeue(); } } if (l.HasValue) { var px = Overlay.Control.MapProvider.Projection.FromTileXYToPixel(l.Value); var p = Overlay.Control.MapProvider.Projection.FromPixelToLatLng(px, zoom); var r1 = Overlay.Control.MapProvider.Projection.GetGroundResolution(zoom, p.Lat); var r2 = Overlay.Control.MapProvider.Projection.GetGroundResolution((int)Overlay.Control.Zoom, p.Lat); var sizeDiff = r2 / r1; GMapMarkerTile m = new GMapMarkerTile(p, (int)(Overlay.Control.MapProvider.Projection.TileSize.Width / sizeDiff)); Overlay.Markers.Add(m); } } }