#include #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { using namespace style; std::unique_ptr RenderLayer::create(Immutable impl) { switch (impl->type) { case LayerType::Fill: return std::make_unique(staticImmutableCast(impl)); case LayerType::Line: return std::make_unique(staticImmutableCast(impl)); case LayerType::Circle: return std::make_unique(staticImmutableCast(impl)); case LayerType::Symbol: return std::make_unique(staticImmutableCast(impl)); case LayerType::Raster: return std::make_unique(staticImmutableCast(impl)); case LayerType::Background: return std::make_unique(staticImmutableCast(impl)); case LayerType::Custom: return std::make_unique(staticImmutableCast(impl)); case LayerType::FillExtrusion: return std::make_unique(staticImmutableCast(impl)); } // Not reachable, but placate GCC. assert(false); return nullptr; } RenderLayer::RenderLayer(style::LayerType type_, Immutable baseImpl_) : type(type_), baseImpl(baseImpl_) { } void RenderLayer::setImpl(Immutable impl) { baseImpl = impl; } const std::string& RenderLayer::getID() const { return baseImpl->id; } bool RenderLayer::hasRenderPass(RenderPass pass) const { return bool(passes & pass); } bool RenderLayer::needsRendering(float zoom) const { return passes != RenderPass::None && baseImpl->visibility != style::VisibilityType::None && baseImpl->minZoom <= zoom && baseImpl->maxZoom >= zoom; } void RenderLayer::setRenderTiles(std::vector> tiles) { renderTiles = std::move(tiles); } void RenderLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) { for (auto& tileRef : renderTiles) { auto& tile = tileRef.get(); auto bucket = tile.tile.getBucket(*baseImpl); bucket->render(painter, parameters, *this, tile); } } } //namespace mbgl