Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
101 lines
3.4 KiB
C++
101 lines
3.4 KiB
C++
#pragma once
|
|
|
|
#include <mbgl/annotation/annotation_manager.hpp>
|
|
#include <mbgl/map/map.hpp>
|
|
#include <mbgl/map/map_observer.hpp>
|
|
#include <mbgl/map/map_options.hpp>
|
|
#include <mbgl/map/mode.hpp>
|
|
#include <mbgl/map/transform.hpp>
|
|
#include <mbgl/renderer/renderer_frontend.hpp>
|
|
#include <mbgl/renderer/renderer_observer.hpp>
|
|
#include <mbgl/style/observer.hpp>
|
|
#include <mbgl/style/source.hpp>
|
|
#include <mbgl/style/style.hpp>
|
|
#include <mbgl/util/size.hpp>
|
|
#include <mbgl/tile/tile_operation.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
class FileSource;
|
|
class ResourceTransform;
|
|
|
|
namespace gfx {
|
|
class ShaderRegistry;
|
|
} // namespace gfx
|
|
|
|
struct StillImageRequest {
|
|
StillImageRequest(Map::StillImageCallback&& callback_)
|
|
: callback(std::move(callback_)) {}
|
|
|
|
Map::StillImageCallback callback;
|
|
};
|
|
|
|
class Map::Impl final : public style::Observer, public RendererObserver {
|
|
public:
|
|
Impl(RendererFrontend&, MapObserver&, std::shared_ptr<FileSource>, const MapOptions&);
|
|
~Impl() 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<style::Sprite>&) final;
|
|
void onSpriteError(const std::optional<style::Sprite>&, std::exception_ptr) final;
|
|
void onSpriteRequested(const std::optional<style::Sprite>&) final;
|
|
|
|
// RendererObserver
|
|
void onInvalidate() final;
|
|
void onResourceError(std::exception_ptr) final;
|
|
void onWillStartRenderingFrame() final;
|
|
void onDidFinishRenderingFrame(RenderMode, bool, bool, double, double) final;
|
|
void onWillStartRenderingMap() final;
|
|
void onDidFinishRenderingMap() final;
|
|
void onStyleImageMissing(const std::string&, const std::function<void()>&) final;
|
|
void onRemoveUnusedStyleImages(const std::vector<std::string>&) 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;
|
|
|
|
// Map
|
|
void jumpTo(const CameraOptions&);
|
|
|
|
MapObserver& observer;
|
|
RendererFrontend& rendererFrontend;
|
|
|
|
Transform transform;
|
|
|
|
const MapMode mode;
|
|
const float pixelRatio;
|
|
const bool crossSourceCollisions;
|
|
|
|
MapDebugOptions debugOptions{MapDebugOptions::NoDebug};
|
|
|
|
std::shared_ptr<FileSource> fileSource;
|
|
|
|
std::unique_ptr<style::Style> style;
|
|
AnnotationManager annotationManager;
|
|
|
|
bool cameraMutated = false;
|
|
|
|
uint8_t prefetchZoomDelta = util::DEFAULT_PREFETCH_ZOOM_DELTA;
|
|
|
|
bool loading = false;
|
|
bool rendererFullyLoaded;
|
|
std::unique_ptr<StillImageRequest> stillImageRequest;
|
|
};
|
|
|
|
// Forward declaration of this method is required for the MapProjection class
|
|
CameraOptions cameraForLatLngs(const std::vector<LatLng>& latLngs,
|
|
const Transform& transform,
|
|
const EdgeInsets& padding);
|
|
|
|
} // namespace mbgl
|