Skip to content

Commit 6694695

Browse files
committed
Adding prefetch menu :
- select zoom min, zoom max - show how many tiles will be downloaded by zoom - show the total estimated size Fix TilePrefetcher progress at 0 at start
1 parent 8259aa9 commit 6694695

File tree

6 files changed

+516
-32
lines changed

6 files changed

+516
-32
lines changed

ExtLibs/GMap.NET.Core/GMap.NET/PureProjection.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,16 @@ public List<GPoint> GetAreaTileList(RectLatLng rect, int zoom, int padding)
232232
return ret;
233233
}
234234

235+
/// <summary>
236+
/// get number of tiles in rect at specific zoom
237+
/// </summary>
238+
public long GetAreaTileNumber(RectLatLng rect, int zoom, int padding)
239+
{
240+
GPoint topLeft = FromPixelToTileXY(FromLatLngToPixel(rect.LocationTopLeft, zoom));
241+
GPoint rightBottom = FromPixelToTileXY(FromLatLngToPixel(rect.LocationRightBottom, zoom));
242+
return (rightBottom.X - topLeft.X + 1) * (rightBottom.Y - topLeft.Y + 1);
243+
}
244+
235245
/// <summary>
236246
/// The ground resolution indicates the distance (in meters) on the ground that’s represented by a single pixel in the map.
237247
/// For example, at a ground resolution of 10 meters/pixel, each pixel represents a ground distance of 10 meters.

ExtLibs/GMap.NET.WindowsForms/GMap.NET.WindowsForms/TilePrefetcher.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ void worker_DoWork(object sender, DoWorkEventArgs e)
228228
list.Clear();
229229
list = null;
230230
}
231+
worker.ReportProgress(0, 0);
231232
list = provider.Projection.GetAreaTileList(area, zoom, 0);
232233
maxOfTiles = provider.Projection.GetTileMatrixMaxXY(zoom);
233234
all = list.Count;

ExtLibs/GMap.NET.WindowsForms/GMap.NET.WindowsForms/TilePrefetcherMenu.Designer.cs

Lines changed: 220 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)