diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-25 23:24:02 +0200 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-28 16:41:15 +0200 |
commit | e639087c9103b25bd0ea7594ab4280c227243f88 (patch) | |
tree | af4d0df8a85d3695a8d2c5ca4efab9f7aef7cd10 | |
parent | fe8c07710f4444921a560029210ea1831a9ac52e (diff) | |
download | qtlocation-mapboxgl-e639087c9103b25bd0ea7594ab4280c227243f88.tar.gz |
[core] Add getter for Map options
Instead of having individual getter for each Map option,
add a common getter for all Map options.
-rw-r--r-- | include/mbgl/map/map.hpp | 7 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 2 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 2 | ||||
-rw-r--r-- | src/mbgl/map/map.cpp | 14 |
4 files changed, 12 insertions, 13 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index be8bf45142..bd0cfbc0d7 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -91,13 +91,10 @@ public: void setNorthOrientation(NorthOrientation); NorthOrientation getNorthOrientation() const; - // Constrain mode + // Map Options void setConstrainMode(ConstrainMode); - ConstrainMode getConstrainMode() const; - - // Viewport mode void setViewportMode(ViewportMode); - ViewportMode getViewportMode() const; + MapOptions getMapOptions() const; //Projection Mode void setProjectionMode(const ProjectionMode&); diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index eab690b854..f885f67a10 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1163,7 +1163,7 @@ public: BOOL isVisible = self.superview && self.window; if (isVisible && ! _displayLink) { - if (_mbglMap && self.mbglMap.getConstrainMode() == mbgl::ConstrainMode::None) + if (_mbglMap && self.mbglMap.getMapOptions().constrainMode() == mbgl::ConstrainMode::None) { self.mbglMap.setConstrainMode(mbgl::ConstrainMode::HeightOnly); } diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index c8e3d07908..c5d3279c81 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -695,7 +695,7 @@ public: self.dormant = NO; } - if (window && _mbglMap->getConstrainMode() == mbgl::ConstrainMode::None) { + if (window && _mbglMap->getMapOptions().constrainMode() == mbgl::ConstrainMode::None) { _mbglMap->setConstrainMode(mbgl::ConstrainMode::HeightOnly); } diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 54a95ceaeb..e609e22c97 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -337,10 +337,6 @@ void Map::setConstrainMode(mbgl::ConstrainMode mode) { impl->onUpdate(); } -ConstrainMode Map::getConstrainMode() const { - return impl->transform.getConstrainMode(); -} - #pragma mark - Viewport mode void Map::setViewportMode(mbgl::ViewportMode mode) { @@ -348,8 +344,14 @@ void Map::setViewportMode(mbgl::ViewportMode mode) { impl->onUpdate(); } -ViewportMode Map::getViewportMode() const { - return impl->transform.getViewportMode(); +#pragma mark - Map options + +MapOptions Map::getMapOptions() const { + return std::move(MapOptions() + .withMapMode(impl->mode) + .withConstrainMode(impl->transform.getConstrainMode()) + .withViewportMode(impl->transform.getViewportMode()) + .withCrossSourceCollisions(impl->crossSourceCollisions)); } #pragma mark - Projection mode |