Files
MapLibreParticleLab/include/mbgl/map/map_observer.hpp
Ander Conselvan de Oliveira 7d19115720 [core] Don't use exceptions in MapObserver::onDidFailLoadingMap
Using different exception pointers to specify the loading failure makes
an awkward API. Most users rethrow the exception only to figure out what
type of error happened so it can be reported properly. So replace the
exception pointer with a enum an string description of the failure.
2019-03-13 11:58:27 +02:00

52 lines
1.2 KiB
C++

#pragma once
#include <mbgl/style/source.hpp>
#include <cstdint>
#include <string>
namespace mbgl {
enum class MapLoadError {
StyleParseError,
StyleLoadError,
NotFoundError,
UnknownError,
};
class MapObserver {
public:
virtual ~MapObserver() = default;
static MapObserver& nullObserver() {
static MapObserver mapObserver;
return mapObserver;
}
enum class CameraChangeMode : uint32_t {
Immediate,
Animated
};
enum class RenderMode : uint32_t {
Partial,
Full
};
virtual void onCameraWillChange(CameraChangeMode) {}
virtual void onCameraIsChanging() {}
virtual void onCameraDidChange(CameraChangeMode) {}
virtual void onWillStartLoadingMap() {}
virtual void onDidFinishLoadingMap() {}
virtual void onDidFailLoadingMap(MapLoadError, const std::string&) {}
virtual void onWillStartRenderingFrame() {}
virtual void onDidFinishRenderingFrame(RenderMode) {}
virtual void onWillStartRenderingMap() {}
virtual void onDidFinishRenderingMap(RenderMode) {}
virtual void onDidFinishLoadingStyle() {}
virtual void onSourceChanged(style::Source&) {}
virtual void onDidBecomeIdle() {}
};
} // namespace mbgl