From 2c0c5163546d81d25cf2c5755c8d7c6005953d30 Mon Sep 17 00:00:00 2001 From: Ivo van Dongen Date: Fri, 27 Oct 2017 20:05:45 +0300 Subject: [core] map snapshotter - add attributions to snapshotter callback --- platform/default/mbgl/map/map_snapshotter.cpp | 11 +++++++++++ platform/default/mbgl/map/map_snapshotter.hpp | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/platform/default/mbgl/map/map_snapshotter.cpp b/platform/default/mbgl/map/map_snapshotter.cpp index 3e930c31f1..7b4ec5913b 100644 --- a/platform/default/mbgl/map/map_snapshotter.cpp +++ b/platform/default/mbgl/map/map_snapshotter.cpp @@ -76,10 +76,21 @@ void MapSnapshotter::Impl::snapshot(ActorRef callback) return transform.latLngToScreenCoordinate(unwrappedLatLng); }}; + // Collect all source attributions + std::vector 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) ); }); diff --git a/platform/default/mbgl/map/map_snapshotter.hpp b/platform/default/mbgl/map/map_snapshotter.hpp index b3cfb3058f..985396e5a3 100644 --- a/platform/default/mbgl/map/map_snapshotter.hpp +++ b/platform/default/mbgl/map/map_snapshotter.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include namespace mbgl { @@ -48,7 +49,8 @@ public: LatLngBounds getRegion() const; using PointForFn = std::function; - using Callback = std::function; + using Attributions = std::vector; + using Callback = std::function; void snapshot(ActorRef); private: -- cgit v1.2.1