QVariant cameraInterpolator(const QGeoCameraData &start, const QGeoCameraData &end, qreal progress) { QGeoCameraData result = start; QGeoCoordinate from = start.center(); QGeoCoordinate to = end.center(); if (from == to) { if (progress < 0.5) { result.setCenter(from); } else { result.setCenter(to); } } else { QGeoCoordinate coordinateResult = QGeoProjection::coordinateInterpolation(from, to, progress); result.setCenter(coordinateResult); } double sf = 1.0 - progress; double ef = progress; result.setBearing(sf * start.bearing() + ef * end.bearing()); result.setTilt(sf * start.tilt() + ef * end.tilt()); result.setRoll(sf * start.roll() + ef * end.roll()); result.setZoomLevel(sf * start.zoomLevel() + ef * end.zoomLevel()); return QVariant::fromValue(result); }
void QGeoMapController::setTilt(qreal tilt) { QGeoCameraData cd = map_->cameraData(); if (tilt == cd.tilt()) return; cd.setTilt(tilt); map_->setCameraData(cd); }