diff options
Diffstat (limited to 'platform/default/src/mbgl/map/map_snapshotter.cpp')
-rw-r--r-- | platform/default/src/mbgl/map/map_snapshotter.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index 705a791af9..0c94eadc33 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -12,6 +12,17 @@ namespace mbgl { +/* + * MSVC implementation of std::promise is buggy and only works with types that can be default-constructed. + * Wrap LatLngBounds in such a struct to avoid a compilation failure in the instantiation of ask() inside + * MapSnapshotter::getRegion() since that would create a std::promise<LanLngBounds>. + */ +struct RegionWrapper { + explicit RegionWrapper() : region(LatLngBounds::unbounded()) {} + + LatLngBounds region; +}; + class MapSnapshotter::Impl { public: Impl(const std::pair<bool, std::string> style, @@ -35,7 +46,7 @@ public: CameraOptions getCameraOptions() const; void setRegion(LatLngBounds); - LatLngBounds getRegion() const; + RegionWrapper getRegion() const; void snapshot(ActorRef<MapSnapshotter::Callback>); @@ -157,8 +168,10 @@ void MapSnapshotter::Impl::setRegion(LatLngBounds region) { map.jumpTo(map.cameraForLatLngs(latLngs, insets)); } -LatLngBounds MapSnapshotter::Impl::getRegion() const { - return map.latLngBoundsForCamera(getCameraOptions()); +RegionWrapper MapSnapshotter::Impl::getRegion() const { + RegionWrapper region; + region.region = map.latLngBoundsForCamera(getCameraOptions()); + return region; } MapSnapshotter::MapSnapshotter(const std::pair<bool, std::string> style, @@ -215,7 +228,7 @@ void MapSnapshotter::setRegion(const LatLngBounds& bounds) { } LatLngBounds MapSnapshotter::getRegion() const { - return impl->actor().ask(&Impl::getRegion).get(); + return impl->actor().ask(&Impl::getRegion).get().region; } } // namespace mbgl |