#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace mln { class FileSource; class ResourceTransform; namespace gfx { class ShaderRegistry; } // namespace gfx namespace util { class ActionJournal; } // namespace util struct StillImageRequest { StillImageRequest(Map::StillImageCallback&& callback_) : callback(std::move(callback_)) {} Map::StillImageCallback callback; }; class Map::Impl final : public TransformObserver, public style::Observer, public RendererObserver { public: Impl(RendererFrontend&, MapObserver&, std::shared_ptr, const MapOptions&); ~Impl() final; // TransformObserver void onCameraWillChange(MapObserver::CameraChangeMode) final; void onCameraIsChanging() final; void onCameraDidChange(MapObserver::CameraChangeMode) final; // StyleObserver void onSourceChanged(style::Source&) final; void onUpdate() final; void onStyleLoading() final; void onStyleLoaded() final; void onStyleError(std::exception_ptr) final; void onSpriteLoaded(const std::optional&) final; void onSpriteError(const std::optional&, std::exception_ptr) final; void onSpriteRequested(const std::optional&) final; // RendererObserver void onInvalidate() final; void onResourceError(std::exception_ptr) final; void onWillStartRenderingFrame() final; void onDidFinishRenderingFrame(RenderMode, bool, bool, const gfx::RenderingStats&) final; void onWillStartRenderingMap() final; void onDidFinishRenderingMap() final; void onStyleImageMissing(const std::string&, const std::function&) final; void onRemoveUnusedStyleImages(const std::vector&) final; void onRegisterShaders(gfx::ShaderRegistry&) final; void onPreCompileShader(shaders::BuiltIn, gfx::Backend::Type, const std::string&) final; void onPostCompileShader(shaders::BuiltIn, gfx::Backend::Type, const std::string&) final; void onShaderCompileFailed(shaders::BuiltIn, gfx::Backend::Type, const std::string&) final; void onGlyphsLoaded(const FontStack&, const GlyphRange&) final; void onGlyphsError(const FontStack&, const GlyphRange&, std::exception_ptr) final; void onGlyphsRequested(const FontStack&, const GlyphRange&) final; void onTileAction(TileOperation op, const OverscaledTileID&, const std::string&) final; void onRenderError(std::exception_ptr) final; void onSymbolError(const std::string&) final; // Map void jumpTo(const CameraOptions&); bool isRenderingStatsViewEnabled() const; void enableRenderingStatsView(bool value); MapObserver& observer; RendererFrontend& rendererFrontend; std::unique_ptr actionJournal; Transform transform; const MapMode mode; const float pixelRatio; const bool crossSourceCollisions; const bool fastPFOREnabled; MapDebugOptions debugOptions{MapDebugOptions::NoDebug}; std::unique_ptr renderingStatsView; std::shared_ptr fileSource; std::unique_ptr style; AnnotationManager annotationManager; bool cameraMutated = false; uint8_t prefetchZoomDelta = util::DEFAULT_PREFETCH_ZOOM_DELTA; bool loading = false; bool rendererFullyLoaded; std::unique_ptr stillImageRequest; double tileLodMinRadius = 3; double tileLodScale = 1; double tileLodPitchThreshold = (60.0 / 180.0) * std::numbers::pi; double tileLodZoomShift = 0; TileLodMode tileLodMode = TileLodMode::Default; }; // Forward declaration of this method is required for the MapProjection class CameraOptions cameraForLatLngs(const std::vector& latLngs, const Transform& transform, const EdgeInsets& padding); } // namespace mln