#include #include #include #include namespace mbgl { using namespace style; RenderCustomGeometrySource::RenderCustomGeometrySource(Immutable impl_) : RenderTileSource(std::move(impl_)) { tilePyramid.setObserver(this); } const style::CustomGeometrySource::Impl& RenderCustomGeometrySource::impl() const { return static_cast(*baseImpl); } void RenderCustomGeometrySource::update(Immutable baseImpl_, const std::vector>& layers, const bool needsRendering, const bool needsRelayout, const TileParameters& parameters) { if (baseImpl != baseImpl_) { std::swap(baseImpl, baseImpl_); // Clear tile pyramid only if updated source has different tile options, // zoom range or initialization state for a custom tile loader. auto newImpl = staticImmutableCast(baseImpl); auto currentImpl = staticImmutableCast(baseImpl_); if (*newImpl != *currentImpl) { tilePyramid.clearAll(); } } enabled = needsRendering; auto tileLoader = impl().getTileLoader(); if (!tileLoader) { return; } tilePyramid.update( layers, needsRendering, needsRelayout, parameters, SourceType::CustomVector, util::tileSize, impl().getZoomRange(), {}, [&](const OverscaledTileID& tileID) { return std::make_unique( tileID, impl().id, parameters, impl().getTileOptions(), *tileLoader); }, baseImpl->getPrefetchZoomDelta()); } } // namespace mbgl