#include #include #include #include #include namespace mbgl { using namespace style; RenderRasterSource::RenderRasterSource(Immutable impl_) : RenderTileSource(std::move(impl_)) { } const style::RasterSource::Impl& RenderRasterSource::impl() const { return static_cast(*baseImpl); } void RenderRasterSource::update(Immutable baseImpl_, const std::vector>& layers, const bool needsRendering, const bool needsRelayout, const TileParameters& parameters) { std::swap(baseImpl, baseImpl_); enabled = needsRendering; const optional& implTileset = impl().tileset; // In Continuous mode, keep the existing tiles if the new tileset is not // yet available, thus providing smart style transitions without flickering. // In other modes, allow clearing the tile pyramid first, before the early // return in order to avoid render tests being flaky. bool canUpdateTileset = implTileset || parameters.mode != MapMode::Continuous; if (canUpdateTileset && tileset != implTileset) { tileset = implTileset; // TODO: this removes existing buckets, and will cause flickering. // Should instead refresh tile data in place. tilePyramid.clearAll(); } if (!implTileset) { return; } tilePyramid.update(layers, needsRendering, needsRelayout, parameters, SourceType::Raster, impl().getTileSize(), tileset->zoomRange, tileset->bounds, [&] (const OverscaledTileID& tileID) { return std::make_unique(tileID, parameters, *tileset); }); algorithm::updateTileMasks(tilePyramid.getRenderedTiles()); } void RenderRasterSource::prepare(const SourcePrepareParameters& parameters) { RenderTileSource::prepare(parameters); } std::unordered_map> RenderRasterSource::queryRenderedFeatures(const ScreenLineString&, const TransformState&, const std::unordered_map&, const RenderedQueryOptions&, const mat4&) const { return std::unordered_map>{}; } std::vector RenderRasterSource::querySourceFeatures(const SourceQueryOptions&) const { return {}; } } // namespace mbgl