mirror of
https://github.com/openstreetmap/mod_tile.git
synced 2025-08-08 08:24:25 +00:00
Extend the storage backends to support options
This commit is contained in:
@ -149,6 +149,12 @@ int path_to_xyz(const char *tilepath, const char *path, char *xmlconfig, int *px
|
||||
#ifdef METATILE
|
||||
// Returns the path to the meta-tile and the offset within the meta-tile
|
||||
int xyz_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlconfig, int x, int y, int z)
|
||||
{
|
||||
return xyzo_to_meta(path, len, tile_dir, xmlconfig, "", x, y, z);
|
||||
}
|
||||
|
||||
// Returns the path to the meta-tile and the offset within the meta-tile
|
||||
int xyzo_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlconfig, const char *options, int x, int y, int z)
|
||||
{
|
||||
unsigned char i, hash[5], offset, mask;
|
||||
|
||||
@ -165,9 +171,17 @@ int xyz_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlcon
|
||||
y >>= 4;
|
||||
}
|
||||
#ifdef DIRECTORY_HASH
|
||||
snprintf(path, len, "%s/%s/%d/%u/%u/%u/%u/%u.meta", tile_dir, xmlconfig, z, hash[4], hash[3], hash[2], hash[1], hash[0]);
|
||||
if (strlen(options)) {
|
||||
snprintf(path, len, "%s/%s/%d/%u/%u/%u/%u/%u.%s.meta", tile_dir, xmlconfig, z, hash[4], hash[3], hash[2], hash[1], hash[0], options);
|
||||
} else {
|
||||
snprintf(path, len, "%s/%s/%d/%u/%u/%u/%u/%u.meta", tile_dir, xmlconfig, z, hash[4], hash[3], hash[2], hash[1], hash[0]);
|
||||
}
|
||||
#else
|
||||
snprintf(path, len, "%s/%s/%d/%u/%u.meta", tile_dir, xmlconfig, z, x, y);
|
||||
if (strlen(options)) {
|
||||
snprintf(path, len, "%s/%s/%d/%u/%u.%s.meta", tile_dir, xmlconfig, z, x, y, options);
|
||||
} else {
|
||||
snprintf(path, len, "%s/%s/%d/%u/%u.meta", tile_dir, xmlconfig, z, x, y);
|
||||
}
|
||||
#endif
|
||||
return offset;
|
||||
}
|
||||
|
Reference in New Issue
Block a user