diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2018-05-30 12:16:04 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-05-31 07:23:06 +0200 |
commit | 930d0bc17ca91176603df7f350bbff71fed8c75d (patch) | |
tree | df0653a7c2df4e45f45695dc94413931d840677b /platform | |
parent | 48940939718431effcb772c349439e6e93ef63f8 (diff) | |
download | qtlocation-mapboxgl-930d0bc17ca91176603df7f350bbff71fed8c75d.tar.gz |
[core] [android] - optional map snapshotter camera position
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.cpp | 7 | ||||
-rw-r--r-- | platform/default/mbgl/map/map_snapshotter.cpp | 11 | ||||
-rw-r--r-- | platform/default/mbgl/map/map_snapshotter.hpp | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp index 8c064f5707..155fdf81fb 100644 --- a/platform/android/src/snapshotter/map_snapshotter.cpp +++ b/platform/android/src/snapshotter/map_snapshotter.cpp @@ -38,7 +38,12 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env, jFileSource = FileSource::getNativePeer(_env, _jFileSource); auto& fileSource = mbgl::android::FileSource::getDefaultFileSource(_env, _jFileSource); auto size = mbgl::Size { static_cast<uint32_t>(width), static_cast<uint32_t>(height) }; - auto cameraOptions = position ? CameraPosition::getCameraOptions(_env, position) : CameraOptions(); + + optional<mbgl::CameraOptions> cameraOptions; + if (position) { + cameraOptions = CameraPosition::getCameraOptions(_env, position); + } + optional<mbgl::LatLngBounds> bounds; if (region) { bounds = LatLngBounds::getLatLngBounds(_env, region); diff --git a/platform/default/mbgl/map/map_snapshotter.cpp b/platform/default/mbgl/map/map_snapshotter.cpp index 39f96d7210..a909e3fe9b 100644 --- a/platform/default/mbgl/map/map_snapshotter.cpp +++ b/platform/default/mbgl/map/map_snapshotter.cpp @@ -18,7 +18,7 @@ public: const std::pair<bool, std::string> style, const Size&, const float pixelRatio, - const CameraOptions&, + const optional<CameraOptions> cameraOptions, const optional<LatLngBounds> region, const optional<std::string> programCacheDir); @@ -49,7 +49,7 @@ MapSnapshotter::Impl::Impl(FileSource& fileSource, const std::pair<bool, std::string> style, const Size& size, const float pixelRatio, - const CameraOptions& cameraOptions, + const optional<CameraOptions> cameraOptions, const optional<LatLngBounds> region, const optional<std::string> programCacheDir) : frontend(size, pixelRatio, fileSource, scheduler, programCacheDir) @@ -60,7 +60,10 @@ MapSnapshotter::Impl::Impl(FileSource& fileSource, } else{ map.getStyle().loadURL(style.second); } - map.jumpTo(cameraOptions); + + if (cameraOptions) { + map.jumpTo(*cameraOptions); + } // Set region, if specified if (region) { @@ -151,7 +154,7 @@ MapSnapshotter::MapSnapshotter(FileSource& fileSource, const std::pair<bool, std::string> style, const Size& size, const float pixelRatio, - const CameraOptions& cameraOptions, + const optional<CameraOptions> cameraOptions, const optional<LatLngBounds> region, const optional<std::string> programCacheDir) : impl(std::make_unique<util::Thread<MapSnapshotter::Impl>>("Map Snapshotter", fileSource, scheduler, style, size, pixelRatio, cameraOptions, region, programCacheDir)) { diff --git a/platform/default/mbgl/map/map_snapshotter.hpp b/platform/default/mbgl/map/map_snapshotter.hpp index e0363a7b38..b9e6307664 100644 --- a/platform/default/mbgl/map/map_snapshotter.hpp +++ b/platform/default/mbgl/map/map_snapshotter.hpp @@ -30,7 +30,7 @@ public: const std::pair<bool, std::string> style, const Size&, const float pixelRatio, - const CameraOptions&, + const optional<CameraOptions> cameraOptions, const optional<LatLngBounds> region, const optional<std::string> cacheDir = {}); |