Files
MapLibreParticleLab/platform/default/include/mbgl/map/map_snapshotter.hpp
Thiago Marcos P. Santos 06f1dc48a2 [core] Make the BackgroundScheduler a singleton
- Do not carry it over everywhere as parameter, it is a shared
  instance anyway and the lifecycle is pretty much the app lifecycle
  from the moment we instantiate a map.
- Rename to BackgroundScheduler because it is a Scheduler that will
  do tasks in the background, we don't make assumptions if it is a
  thread pool or a single thread.
- Most importantly, remove the dependency from `core` on `platform`.
2019-05-10 14:20:38 +03:00

67 lines
1.7 KiB
C++

#pragma once
#include <mbgl/util/image.hpp>
#include <mbgl/util/thread.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/geo.hpp>
#include <exception>
#include <memory>
#include <string>
#include <vector>
#include <functional>
namespace mbgl {
template<class> class ActorRef;
struct CameraOptions;
class FileSource;
class Size;
class LatLngBounds;
class ResourceOptions;
namespace style {
class Style;
} // namespace style
class MapSnapshotter {
public:
MapSnapshotter(const std::pair<bool, std::string> style,
const Size&,
const float pixelRatio,
const optional<CameraOptions> cameraOptions,
const optional<LatLngBounds> region,
const optional<std::string> cacheDir,
const optional<std::string> localFontFamily,
const ResourceOptions&);
~MapSnapshotter();
void setStyleURL(const std::string& styleURL);
std::string getStyleURL() const;
void setStyleJSON(const std::string& styleJSON);
std::string getStyleJSON() const;
void setSize(const Size&);
Size getSize() const;
void setCameraOptions(const CameraOptions&);
CameraOptions getCameraOptions() const;
void setRegion(const LatLngBounds&);
LatLngBounds getRegion() const;
using PointForFn = std::function<ScreenCoordinate (const LatLng&)>;
using LatLngForFn = std::function<LatLng (const ScreenCoordinate&)>;
using Attributions = std::vector<std::string>;
using Callback = std::function<void (std::exception_ptr, PremultipliedImage, Attributions, PointForFn, LatLngForFn)>;
void snapshot(ActorRef<Callback>);
private:
class Impl;
std::unique_ptr<util::Thread<Impl>> impl;
};
} // namespace mbgl