Ensure that LiveTileData can be reparsed

Annotation tiles may become partially parsed just like regular tiles,
for example if a point annotation is added to the map before the style's
sprite has been loaded. In such cases, they need to be reparsed or the
annotation will not be rendered. Previously, the code path for reparsing
would be short-circuited by a dynamic_cast<VectorTileData*> followed by
a null check. This commit removes that case and adds (back) a virtual
reparse method to the TileData interface.
This commit is contained in:
John Firebaugh
2015-09-22 16:58:38 -07:00
parent aec145ded3
commit 028abaab00
9 changed files with 46 additions and 23 deletions

View File

@@ -234,15 +234,13 @@ bool Source::handlePartialTile(const TileID& id, Worker&) {
return true;
}
// Note: this uses a raw pointer; we don't want the callback binding to have a
// shared pointer.
VectorTileData* data = dynamic_cast<VectorTileData*>(it->second.lock().get());
auto data = it->second.lock();
if (!data) {
return true;
}
return data->reparse([this, data]() {
emitTileLoaded(false);
return data->reparse([this]() {
emitTileLoaded(false);
});
}