diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-02-27 19:01:29 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-04 14:45:32 +0200 |
commit | f5f10ec11989ccb403c2cd4261db74c44b263558 (patch) | |
tree | 8c88ee24819281609206e36c719eef617acb52b6 /platform/qt | |
parent | 491fce68790e05cd0a876815751dc5cb72a2761e (diff) | |
download | qtlocation-mapboxgl-f5f10ec11989ccb403c2cd4261db74c44b263558.tar.gz |
[core] Remove map zoom setters/getters
Diffstat (limited to 'platform/qt')
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index cc4028b64d..8059960601 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -726,12 +726,12 @@ void QMapboxGL::setLongitude(double longitude_) */ double QMapboxGL::scale() const { - return std::pow(2.0, d_ptr->mapObj->getZoom()); + return std::pow(2.0, zoom()); } void QMapboxGL::setScale(double scale_, const QPointF ¢er) { - d_ptr->mapObj->setZoom(::log2(scale_), mbgl::ScreenCoordinate { center.x(), center.y() }); + d_ptr->mapObj->jumpTo(mbgl::CameraOptions().withZoom(::log2(scale_)).withAnchor(mbgl::ScreenCoordinate { center.x(), center.y() })); } /*! @@ -746,12 +746,12 @@ void QMapboxGL::setScale(double scale_, const QPointF ¢er) */ double QMapboxGL::zoom() const { - return d_ptr->mapObj->getZoom(); + return *d_ptr->mapObj->getCameraOptions().zoom; } void QMapboxGL::setZoom(double zoom_) { - d_ptr->mapObj->setZoom(zoom_, d_ptr->margins); + d_ptr->mapObj->jumpTo(mbgl::CameraOptions().withZoom(zoom_).withPadding(d_ptr->margins)); } /*! @@ -806,8 +806,10 @@ void QMapboxGL::setCoordinate(const QMapbox::Coordinate &coordinate_) */ void QMapboxGL::setCoordinateZoom(const QMapbox::Coordinate &coordinate_, double zoom_) { - d_ptr->mapObj->setLatLngZoom( - mbgl::LatLng { coordinate_.first, coordinate_.second }, zoom_, d_ptr->margins); + d_ptr->mapObj->jumpTo(mbgl::CameraOptions() + .withCenter(mbgl::LatLng { coordinate_.first, coordinate_.second }) + .withZoom(zoom_) + .withPadding(d_ptr->margins)); } /*! |