[core] map snapshotter - add attributions to snapshotter callback
This commit is contained in:
committed by
Ivo van Dongen
parent
3cdb249c70
commit
2c0c516354
@@ -76,10 +76,21 @@ void MapSnapshotter::Impl::snapshot(ActorRef<MapSnapshotter::Callback> callback)
|
||||
return transform.latLngToScreenCoordinate(unwrappedLatLng);
|
||||
}};
|
||||
|
||||
// Collect all source attributions
|
||||
std::vector<std::string> attributions;
|
||||
for (auto source : map.getStyle().getSources()) {
|
||||
auto attribution = source->getAttribution();
|
||||
if (attribution) {
|
||||
attributions.push_back(*attribution);
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke callback
|
||||
callback.invoke(
|
||||
&MapSnapshotter::Callback::operator(),
|
||||
error,
|
||||
error ? PremultipliedImage() : frontend.readStillImage(),
|
||||
std::move(attributions),
|
||||
std::move(pointForFn)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -48,7 +49,8 @@ public:
|
||||
LatLngBounds getRegion() const;
|
||||
|
||||
using PointForFn = std::function<ScreenCoordinate (const LatLng&)>;
|
||||
using Callback = std::function<void (std::exception_ptr, PremultipliedImage, PointForFn)>;
|
||||
using Attributions = std::vector<std::string>;
|
||||
using Callback = std::function<void (std::exception_ptr, PremultipliedImage, Attributions, PointForFn)>;
|
||||
void snapshot(ActorRef<Callback>);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user