gint x,
gint y,
gchar *filename_buf,
- gint buf_len )
+ gint buf_len,
+ const gchar* file_extension )
{
switch ( cl ) {
case VIK_MAPS_CACHE_LAYOUT_OSM:
if ( name ) {
if ( g_strcmp0 ( cache_dir, MAPS_CACHE_DIR ) )
// Cache dir not the default - assume it's been directed somewhere specific
- g_snprintf ( filename_buf, buf_len, DIRECTDIRACCESS, cache_dir, (17 - scale), x, y, ".png" );
+ g_snprintf ( filename_buf, buf_len, DIRECTDIRACCESS, cache_dir, (17 - scale), x, y, file_extension );
else
// Using default cache - so use the map name in the directory path
- g_snprintf ( filename_buf, buf_len, DIRECTDIRACCESS_WITH_NAME, cache_dir, name, (17 - scale), x, y, ".png" );
+ g_snprintf ( filename_buf, buf_len, DIRECTDIRACCESS_WITH_NAME, cache_dir, name, (17 - scale), x, y, file_extension );
}
else
- g_snprintf ( filename_buf, buf_len, DIRECTDIRACCESS, cache_dir, (17 - scale), x, y, ".png" );
+ g_snprintf ( filename_buf, buf_len, DIRECTDIRACCESS, cache_dir, (17 - scale), x, y, file_extension );
break;
default:
g_snprintf ( filename_buf, buf_len, DIRSTRUCTURE, cache_dir, id, scale, z, x, y );
id, mapcoord->scale, vml->alpha, xshrinkfactor, yshrinkfactor, vml->filename );
if ( ! pixbuf ) {
- if ( vik_map_source_is_direct_file_access (MAPS_LAYER_NTH_TYPE(vml->maptype)) ) {
+ VikMapSource *map = MAPS_LAYER_NTH_TYPE(vml->maptype);
+ if ( vik_map_source_is_direct_file_access(map) ) {
// ATM MBTiles must be 'a direct access type'
- if ( vik_map_source_is_mbtiles (MAPS_LAYER_NTH_TYPE(vml->maptype)) ) {
+ if ( vik_map_source_is_mbtiles(map) ) {
pixbuf = get_mbtiles_pixbuf ( vml, mapcoord->x, mapcoord->y, (17 - mapcoord->scale) );
pixbuf = pixbuf_apply_settings ( pixbuf, vml, mapcoord, xshrinkfactor, yshrinkfactor );
// return now to avoid file tests that aren't appropriate for this map type
}
else
get_filename ( vml->cache_dir, VIK_MAPS_CACHE_LAYOUT_OSM, id, NULL,
- mapcoord->scale, mapcoord->z, mapcoord->x, mapcoord->y, filename_buf, buf_len );
+ mapcoord->scale, mapcoord->z, mapcoord->x, mapcoord->y, filename_buf, buf_len,
+ vik_map_source_get_file_extension(map) );
}
else
get_filename ( vml->cache_dir, vml->cache_layout, id, mapname,
- mapcoord->scale, mapcoord->z, mapcoord->x, mapcoord->y, filename_buf, buf_len );
+ mapcoord->scale, mapcoord->z, mapcoord->x, mapcoord->y, filename_buf, buf_len,
+ vik_map_source_get_file_extension(map) );
if ( g_file_test ( filename_buf, G_FILE_TEST_EXISTS ) == TRUE)
{
if ( existence_only ) {
if ( vik_map_source_is_direct_file_access (MAPS_LAYER_NTH_TYPE(vml->maptype)) )
get_filename ( vml->cache_dir, VIK_MAPS_CACHE_LAYOUT_OSM, id, vik_map_source_get_name(map),
- ulm.scale, ulm.z, ulm.x, ulm.y, path_buf, max_path_len );
+ ulm.scale, ulm.z, ulm.x, ulm.y, path_buf, max_path_len, vik_map_source_get_file_extension(map) );
else
get_filename ( vml->cache_dir, vml->cache_layout, id, vik_map_source_get_name(map),
- ulm.scale, ulm.z, ulm.x, ulm.y, path_buf, max_path_len );
+ ulm.scale, ulm.z, ulm.x, ulm.y, path_buf, max_path_len, vik_map_source_get_file_extension(map) );
if ( g_file_test ( path_buf, G_FILE_TEST_EXISTS ) == TRUE ) {
GdkGC *black_gc = gtk_widget_get_style(GTK_WIDGET(vvp))->black_gc;
get_filename ( mdi->cache_dir, mdi->cache_layout,
vik_map_source_get_uniq_id(MAPS_LAYER_NTH_TYPE(mdi->maptype)),
vik_map_source_get_name(MAPS_LAYER_NTH_TYPE(mdi->maptype)),
- mdi->mapcoord.scale, mdi->mapcoord.z, x, y, mdi->filename_buf, mdi->maxlen );
+ mdi->mapcoord.scale, mdi->mapcoord.z, x, y, mdi->filename_buf, mdi->maxlen,
+ vik_map_source_get_file_extension(MAPS_LAYER_NTH_TYPE(mdi->maptype)) );
donemaps++;
int res = a_background_thread_progress ( threaddata, ((gdouble)donemaps) / mdi->mapstoget ); /* this also calls testcancel */
get_filename ( mdi->cache_dir, mdi->cache_layout,
vik_map_source_get_uniq_id(MAPS_LAYER_NTH_TYPE(mdi->maptype)),
vik_map_source_get_name(MAPS_LAYER_NTH_TYPE(mdi->maptype)),
- mdi->mapcoord.scale, mdi->mapcoord.z, mdi->mapcoord.x, mdi->mapcoord.y, mdi->filename_buf, mdi->maxlen );
+ mdi->mapcoord.scale, mdi->mapcoord.z, mdi->mapcoord.x, mdi->mapcoord.y, mdi->filename_buf, mdi->maxlen,
+ vik_map_source_get_file_extension(MAPS_LAYER_NTH_TYPE(mdi->maptype)) );
if ( g_file_test ( mdi->filename_buf, G_FILE_TEST_EXISTS ) == TRUE)
{
g_remove ( mdi->filename_buf );
get_filename ( mdi->cache_dir, mdi->cache_layout,
vik_map_source_get_uniq_id(map),
vik_map_source_get_name(map),
- ulm.scale, ulm.z, a, b, mdi->filename_buf, mdi->maxlen );
+ ulm.scale, ulm.z, a, b, mdi->filename_buf, mdi->maxlen,
+ vik_map_source_get_file_extension(map) );
if ( g_file_test ( mdi->filename_buf, G_FILE_TEST_EXISTS ) == FALSE )
mdi->mapstoget++;
}
get_filename ( mdi->cache_dir, mdi->cache_layout,
vik_map_source_get_uniq_id(map),
vik_map_source_get_name(map),
- ulm.scale, ulm.z, i, j, mdi->filename_buf, mdi->maxlen );
+ ulm.scale, ulm.z, i, j, mdi->filename_buf, mdi->maxlen,
+ vik_map_source_get_file_extension(map) );
if ( g_file_test ( mdi->filename_buf, G_FILE_TEST_EXISTS ) == FALSE )
mdi->mapstoget++;
}
get_filename ( vml->cache_dir, VIK_MAPS_CACHE_LAYOUT_OSM,
vik_map_source_get_uniq_id(map),
NULL,
- ulm.scale, ulm.z, ulm.x, ulm.y, filename, max_path_len );
+ ulm.scale, ulm.z, ulm.x, ulm.y, filename, max_path_len,
+ vik_map_source_get_file_extension(map) );
source = g_strconcat ( "file://", filename, NULL );
}
}
get_filename ( vml->cache_dir, vml->cache_layout,
vik_map_source_get_uniq_id(map),
vik_map_source_get_name(map),
- ulm.scale, ulm.z, ulm.x, ulm.y, filename, max_path_len );
+ ulm.scale, ulm.z, ulm.x, ulm.y, filename, max_path_len,
+ vik_map_source_get_file_extension(map) );
source = g_strdup_printf ( "http://%s%s",
vik_map_source_default_get_hostname ( VIK_MAP_SOURCE_DEFAULT(map) ),
vik_map_source_default_get_uri ( VIK_MAP_SOURCE_DEFAULT(map), &ulm ) );
get_filename ( mdi->cache_dir, mdi->cache_layout,
vik_map_source_get_uniq_id(map),
vik_map_source_get_name(map),
- ulm.scale, ulm.z, i, j, mdi->filename_buf, mdi->maxlen );
+ ulm.scale, ulm.z, i, j, mdi->filename_buf, mdi->maxlen,
+ vik_map_source_get_file_extension(map) );
if ( mdi->redownload == REDOWNLOAD_NEW ) {
// Assume the worst - always a new file
// Absolute value would requires server lookup - but that is too slow