Skip to content

Commit

Permalink
FlightPlanner :
Browse files Browse the repository at this point in the history
When prefetching, do not download tile if file already exist
Add minZoom input in prefetch (like maxZoom)
Use Parallel.For instead of For to get tiles faster !
  • Loading branch information
Godeffroy committed Apr 3, 2024
1 parent c8f8c54 commit 91cdd3d
Show file tree
Hide file tree
Showing 5 changed files with 8,480 additions and 8,375 deletions.
25 changes: 25 additions & 0 deletions ExtLibs/GMap.NET.Core/GMap.NET/GMaps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,31 @@ public PureImage GetImageFrom(GMapProvider provider, GPoint pos, int zoom, out E

readonly Exception noDataException = new Exception("No data in local tile cache...");

public bool CheckImageExist(GMapProvider provider, GPoint pos, int zoom, out Exception result)
{
result = null;
try
{
if (Mode != AccessMode.ServerOnly && !provider.BypassCache)
{
if (PrimaryCache != null)
{
return PrimaryCache.CheckImageFromCache(provider.DbId, pos, zoom);
}

if (SecondaryCache != null)
{
return SecondaryCache.CheckImageFromCache(provider.DbId, pos, zoom);
}
}
}
catch (Exception ex)
{
Debug.WriteLine("CheckImageExist: " + ex.ToString());
}
return false;
}

#if !PocketPC
TileHttpHost host;

Expand Down
9 changes: 9 additions & 0 deletions ExtLibs/GMap.NET.Core/GMap.NET/PureImageCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,14 @@ public interface PureImageCache
/// <param name="type">provider dbid or null to use all providers</param>
/// <returns>The number of deleted tiles.</returns>
int DeleteOlderThan(DateTime date, int ? type);

/// <summary>
/// check if image exist on db
/// </summary>
/// <param name="type"></param>
/// <param name="pos"></param>
/// <param name="zoom"></param>
/// <returns>True if Image Exist, false otherwise</returns>
bool CheckImageFromCache(int type, GPoint pos, int zoom);
}
}
Loading

0 comments on commit 91cdd3d

Please sign in to comment.