summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-10-27 20:05:45 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-10-31 19:52:08 +0200
commit2c0c5163546d81d25cf2c5755c8d7c6005953d30 (patch)
treecc1d525fdde24448884f7409fde55ddb3d0e38e3
parent3cdb249c703b9e21a111afe060f78033f0933138 (diff)
downloadqtlocation-mapboxgl-2c0c5163546d81d25cf2c5755c8d7c6005953d30.tar.gz
[core] map snapshotter - add attributions to snapshotter callback
-rw-r--r--platform/default/mbgl/map/map_snapshotter.cpp11
-rw-r--r--platform/default/mbgl/map/map_snapshotter.hpp4
2 files changed, 14 insertions, 1 deletions
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<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)
);
});
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 <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: