-static GdkPixbuf *get_pixbuf( VikMapsLayer *vml, gint mode, MapCoord *mapcoord, gchar *filename_buf, gint buf_len, gdouble xshrinkfactor, gdouble yshrinkfactor )
+static void get_filename ( const gchar *cache_dir,
+ VikMapsCacheLayout cl,
+ guint16 id,
+ const gchar *name,
+ gint scale,
+ gint z,
+ gint x,
+ gint y,
+ gchar *filename_buf,
+ gint buf_len )
+{
+ 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" );
+ 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" );
+ }
+ else
+ g_snprintf ( filename_buf, buf_len, DIRECTDIRACCESS, cache_dir, (17 - scale), x, y, ".png" );
+ break;
+ default:
+ g_snprintf ( filename_buf, buf_len, DIRSTRUCTURE, cache_dir, id, scale, z, x, y );
+ break;
+ }
+}
+
+static GdkPixbuf *get_pixbuf( VikMapsLayer *vml, guint16 id, const gchar* mapname, MapCoord *mapcoord, gchar *filename_buf, gint buf_len, gdouble xshrinkfactor, gdouble yshrinkfactor )