#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { class RendererObserver; class RenderSource; class UpdateParameters; class RenderStaticData; class RenderedQueryOptions; class SourceQueryOptions; class GlyphManager; class ImageManager; class LineAtlas; class PatternAtlas; class CrossTileSymbolIndex; class RenderTree; namespace style { class LayerProperties; } // namespace style class RenderOrchestrator final : public GlyphManagerObserver, public ImageManagerObserver, public RenderSourceObserver { public: RenderOrchestrator(bool backgroundLayerAsColor_, const optional& localFontFamily_); ~RenderOrchestrator() override; void markContextLost() { contextLost = true; }; // TODO: Introduce RenderOrchestratorObserver. void setObserver(RendererObserver*); std::unique_ptr createRenderTree(const std::shared_ptr&); std::vector queryRenderedFeatures(const ScreenLineString&, const RenderedQueryOptions&) const; std::vector querySourceFeatures(const std::string& sourceID, const SourceQueryOptions&) const; std::vector queryShapeAnnotations(const ScreenLineString&) const; FeatureExtensionValue queryFeatureExtensions(const std::string& sourceID, const Feature& feature, const std::string& extension, const std::string& extensionField, const optional>& args) const; void setFeatureState(const std::string& sourceID, const optional& layerID, const std::string& featureID, const FeatureState& state); void getFeatureState(FeatureState& state, const std::string& sourceID, const optional& layerID, const std::string& featureID) const; void removeFeatureState(const std::string& sourceID, const optional& sourceLayerID, const optional& featureID, const optional& stateKey); void reduceMemoryUse(); void dumpDebugLogs(); void collectPlacedSymbolData(bool); const std::vector& getPlacedSymbolsData() const; void clearData(); private: bool isLoaded() const; bool hasTransitions(TimePoint) const; RenderSource* getRenderSource(const std::string& id) const; RenderLayer* getRenderLayer(const std::string& id); const RenderLayer* getRenderLayer(const std::string& id) const; void queryRenderedSymbols(std::unordered_map>& resultsByLayer, const ScreenLineString& geometry, const std::unordered_map& layers, const RenderedQueryOptions& options) const; std::vector queryRenderedFeatures(const ScreenLineString&, const RenderedQueryOptions&, const std::unordered_map&) const; // GlyphManagerObserver implementation. void onGlyphsError(const FontStack&, const GlyphRange&, std::exception_ptr) override; // RenderSourceObserver implementation. void onTileChanged(RenderSource&, const OverscaledTileID&) override; void onTileError(RenderSource&, const OverscaledTileID&, std::exception_ptr) override; // ImageManagerObserver implementation void onStyleImageMissing(const std::string&, const std::function&) override; void onRemoveUnusedStyleImages(const std::vector&) override; RendererObserver* observer; ZoomHistory zoomHistory; TransformState transformState; std::unique_ptr glyphManager; std::unique_ptr imageManager; std::unique_ptr lineAtlas; std::unique_ptr patternAtlas; Immutable>> imageImpls; Immutable>> sourceImpls; Immutable>> layerImpls; std::unordered_map> renderSources; std::unordered_map> renderLayers; RenderLight renderLight; CrossTileSymbolIndex crossTileSymbolIndex; PlacementController placementController; const bool backgroundLayerAsColor; bool contextLost = false; bool placedSymbolDataCollected = false; // Vectors with reserved capacity of layerImpls->size() to avoid reallocation // on each frame. std::vector> filteredLayersForSource; RenderLayerReferences orderedLayers; RenderLayerReferences layersNeedPlacement; }; } // namespace mbgl