diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-25 23:39:31 +0200 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-28 16:41:15 +0200 |
commit | 11afef7825d622a237fa026e45e6d61b4de94068 (patch) | |
tree | 85f2eaa3f145a59a869ed29311369649df4388cb /src | |
parent | e639087c9103b25bd0ea7594ab4280c227243f88 (diff) | |
download | qtlocation-mapboxgl-11afef7825d622a237fa026e45e6d61b4de94068.tar.gz |
[core] Add interface to change the orientation through MapOptions
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/map.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.cpp | 1 | ||||
-rw-r--r-- | src/mbgl/map/map_options.cpp | 10 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index e609e22c97..06c637b232 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -326,10 +326,6 @@ void Map::setNorthOrientation(NorthOrientation orientation) { impl->onUpdate(); } -NorthOrientation Map::getNorthOrientation() const { - return impl->transform.getNorthOrientation(); -} - #pragma mark - Constrain mode void Map::setConstrainMode(mbgl::ConstrainMode mode) { @@ -351,7 +347,8 @@ MapOptions Map::getMapOptions() const { .withMapMode(impl->mode) .withConstrainMode(impl->transform.getConstrainMode()) .withViewportMode(impl->transform.getViewportMode()) - .withCrossSourceCollisions(impl->crossSourceCollisions)); + .withCrossSourceCollisions(impl->crossSourceCollisions) + .withNorthOrientation(impl->transform.getNorthOrientation())); } #pragma mark - Projection mode diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index 348e26700f..cdc8c231e4 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -24,6 +24,7 @@ Map::Impl::Impl(RendererFrontend& frontend_, fileSource(std::move(fileSource_)), style(std::make_unique<style::Style>(scheduler, *fileSource, pixelRatio)), annotationManager(*style) { + transform.setNorthOrientation(mapOptions.northOrientation()); style->impl->setObserver(this); rendererFrontend.setObserver(*this); transform.resize(size_); diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index 7c254476d6..b4ad38ac7f 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -7,6 +7,7 @@ public: MapMode mapMode = MapMode::Continuous; ConstrainMode constrainMode = ConstrainMode::HeightOnly; ViewportMode viewportMode = ViewportMode::Default; + NorthOrientation orientation = NorthOrientation::Upwards; bool crossSourceCollisions = true; }; @@ -51,4 +52,13 @@ bool MapOptions::crossSourceCollisions() const { return impl_->crossSourceCollisions; } +MapOptions& MapOptions::withNorthOrientation(NorthOrientation orientation) { + impl_->orientation = orientation; + return *this; +} + +NorthOrientation MapOptions::northOrientation() const { + return impl_->orientation; +} + } // namespace mbgl |