#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { using namespace style; std::unique_ptr RenderSource::create(const Immutable& impl, const TaggedScheduler& threadPool_) { switch (impl->type) { case SourceType::Vector: // the TileSet isn't available yet, so we can't make different sources by format return std::make_unique(staticImmutableCast(impl), std::move(threadPool_)); case SourceType::Raster: return std::make_unique(staticImmutableCast(impl), std::move(threadPool_)); case SourceType::RasterDEM: return std::make_unique(staticImmutableCast(impl), std::move(threadPool_)); case SourceType::GeoJSON: return std::make_unique(staticImmutableCast(impl), std::move(threadPool_)); case SourceType::Video: assert(false); return nullptr; case SourceType::Annotations: if (LayerManager::annotationsEnabled) { return std::make_unique(staticImmutableCast(impl), std::move(threadPool_)); } else { assert(false); return nullptr; } case SourceType::Image: return std::make_unique(staticImmutableCast(impl)); case SourceType::CustomVector: return std::make_unique(staticImmutableCast(impl), std::move(threadPool_)); } // Not reachable, but placate GCC. assert(false); return nullptr; } namespace { RenderSourceObserver nullObserver; } RenderSource::RenderSource(Immutable impl) : baseImpl(std::move(impl)), observer(&nullObserver) {} RenderSource::~RenderSource() = default; void RenderSource::setObserver(RenderSourceObserver* observer_) { observer = observer_; } void RenderSource::onTileChanged(Tile& tile) { observer->onTileChanged(*this, tile.id); } void RenderSource::onTileError(Tile& tile, std::exception_ptr error) { observer->onTileError(*this, tile.id, error); } void RenderSource::onTileAction(OverscaledTileID id, std::string sourceID, TileOperation op) { observer->onTileAction(*this, op, id, sourceID); } bool RenderSource::isEnabled() const { return enabled; } uint8_t RenderSource::getMaxZoom() const { assert(false); return util::TERRAIN_RGB_MAXZOOM; } Immutable> RenderSource::getRawRenderTiles() const { return makeMutable>(); } } // namespace mbgl