fix: share map tile placeholders and throttle refresh

This commit is contained in:
liu weikai
2026-07-24 17:44:09 +08:00
parent 5d46dc91b0
commit 466be8d6fc
4 changed files with 113 additions and 17 deletions
@@ -2,6 +2,7 @@
#include <cstddef>
#include <cstdint>
#include <cstdio>
namespace ui
{
@@ -62,6 +63,30 @@ struct MapTileLookupResult
std::size_t size = 0;
};
/**
* Format the stable XYZ identity shown while a tile is loading or missing.
*
* This is shared by embedded and Linux renderers so a tile has the same
* diagnostic identity on every target.
*/
inline void formatMapTileCoordinateLabel(std::uint8_t z,
std::uint32_t x,
std::uint32_t y,
char* out,
std::size_t out_size) noexcept
{
if (out == nullptr || out_size == 0U)
{
return;
}
std::snprintf(out,
out_size,
"z=%u\nx=%u\ny=%u",
static_cast<unsigned>(z),
static_cast<unsigned>(x),
static_cast<unsigned>(y));
}
MapTileLayer mapTileLayerFromBaseSource(uint8_t map_source);
MapTileLayer mapTileContourLayerForZoom(int zoom, bool* out_supported = nullptr);
MapTileFormat mapTileFormatForLayer(MapTileLayer layer);