Update the tiles via ResourceLoader
This commit is contained in:
@@ -165,11 +165,9 @@ void MapContext::loadStyleJSON(const std::string& json, const std::string& base)
|
||||
|
||||
void MapContext::updateTiles() {
|
||||
assert(Environment::currentlyOn(ThreadType::Map));
|
||||
if (!style) return;
|
||||
for (const auto& source : style->sources) {
|
||||
source->update(data, transformState, *style, *glyphAtlas, *glyphStore, *spriteAtlas,
|
||||
getSprite(), *texturePool);
|
||||
}
|
||||
|
||||
resourceLoader->update(data, transformState, *glyphAtlas, *glyphStore,
|
||||
*spriteAtlas, getSprite(), *texturePool);
|
||||
}
|
||||
|
||||
void MapContext::updateAnnotationTiles(const std::vector<TileID>& ids) {
|
||||
|
||||
@@ -41,6 +41,23 @@ void ResourceLoader::setAccessToken(const std::string& accessToken) {
|
||||
accessToken_ = accessToken;
|
||||
}
|
||||
|
||||
void ResourceLoader::update(MapData& data,
|
||||
const TransformState& transform,
|
||||
GlyphAtlas& glyphAtlas,
|
||||
GlyphStore& glyphStore,
|
||||
SpriteAtlas& spriteAtlas,
|
||||
util::ptr<Sprite> sprite,
|
||||
TexturePool& texturePool) {
|
||||
if (!style_) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& source : style_->sources) {
|
||||
source->update(
|
||||
data, transform, *style_, glyphAtlas, glyphStore, spriteAtlas, sprite, texturePool);
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceLoader::onSourceLoaded() {
|
||||
emitTileDataChanged();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,13 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class GlyphAtlas;
|
||||
class GlyphStore;
|
||||
class MapData;
|
||||
class SpriteAtlas;
|
||||
class Style;
|
||||
class TexturePool;
|
||||
class TransformState;
|
||||
|
||||
// ResourceLoader is responsible for loading and updating the Source(s) owned
|
||||
// by the Style. The Source object currently owns all the tiles, thus this
|
||||
@@ -35,6 +41,11 @@ public:
|
||||
// Set the access token to be used for loading the tile data.
|
||||
void setAccessToken(const std::string& accessToken);
|
||||
|
||||
// Fetch the tiles needed by the current viewport and emit a signal when
|
||||
// a tile is ready so observers can render the tile.
|
||||
void update(MapData&, const TransformState&, GlyphAtlas&, GlyphStore&,
|
||||
SpriteAtlas&, util::ptr<Sprite>, TexturePool&);
|
||||
|
||||
// Source::Observer implementation.
|
||||
void onSourceLoaded() override;
|
||||
void onTileLoaded() override;
|
||||
|
||||
Reference in New Issue
Block a user