summaryrefslogtreecommitdiff
path: root/src/imports
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp83
-rw-r--r--src/imports/location/qdeclarativegeomap_p.h1
2 files changed, 0 insertions, 84 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 117641ce..d401fe21 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -1176,89 +1176,6 @@ void QDeclarativeGeoMap::geometryChanged(const QRectF &newGeometry, const QRectF
}
-// TODO Remove this function -> BC break
-/*!
- \qmlmethod void QtLocation::Map::fitViewportToGeoShape(QGeoShape shape)
-
- \internal
-
- Fits the current viewport to the boundary of the shape. The camera is positioned
- in the center of the shape, and at the largest integral zoom level possible which
- allows the whole shape to be visible on screen
-
-*/
-void QDeclarativeGeoMap::fitViewportToGeoShape(const QVariant &variantShape)
-{
- if (!m_map || !m_mappingManagerInitialized)
- return;
-
- QGeoShape shape;
-
- if (variantShape.userType() == qMetaTypeId<QGeoRectangle>())
- shape = variantShape.value<QGeoRectangle>();
- else if (variantShape.userType() == qMetaTypeId<QGeoCircle>())
- shape = variantShape.value<QGeoCircle>();
- else if (variantShape.userType() == qMetaTypeId<QGeoShape>())
- shape = variantShape.value<QGeoShape>();
-
- if (!shape.isValid())
- return;
-
- double bboxWidth;
- double bboxHeight;
- QGeoCoordinate centerCoordinate;
-
- switch (shape.type()) {
- case QGeoShape::RectangleType:
- {
- QGeoRectangle rect = shape;
- QDoubleVector2D topLeftPoint = m_map->coordinateToItemPosition(rect.topLeft(), false);
- QDoubleVector2D botRightPoint = m_map->coordinateToItemPosition(rect.bottomRight(), false);
- bboxWidth = qAbs(topLeftPoint.x() - botRightPoint.x());
- bboxHeight = qAbs(topLeftPoint.y() - botRightPoint.y());
- centerCoordinate = rect.center();
- break;
- }
- case QGeoShape::CircleType:
- {
- QGeoCircle circle = shape;
- centerCoordinate = circle.center();
- QGeoCoordinate edge = centerCoordinate.atDistanceAndAzimuth(circle.radius(), 90);
- QDoubleVector2D centerPoint = m_map->coordinateToItemPosition(centerCoordinate, false);
- QDoubleVector2D edgePoint = m_map->coordinateToItemPosition(edge, false);
- bboxWidth = qAbs(centerPoint.x() - edgePoint.x()) * 2;
- bboxHeight = bboxWidth;
- break;
- }
- case QGeoShape::UnknownType:
- //Fallthrough to default
- default:
- return;
- }
-
- // position camera to the center of bounding box
- setProperty("center", QVariant::fromValue(centerCoordinate));
-
- //If the shape is empty we just change centerposition, not zoom
- if (bboxHeight == 0 && bboxWidth == 0)
- return;
-
- // adjust zoom
- double bboxWidthRatio = bboxWidth / (bboxWidth + bboxHeight);
- double mapWidthRatio = width() / (width() + height());
- double zoomRatio;
-
- if (bboxWidthRatio > mapWidthRatio)
- zoomRatio = bboxWidth / width();
- else
- zoomRatio = bboxHeight / height();
-
- qreal newZoom = std::log10(zoomRatio) / std::log10(0.5);
-
- newZoom = std::floor(qMax(minimumZoomLevel(), (m_map->mapController()->zoom() + newZoom)));
- setProperty("zoomLevel", QVariant::fromValue(newZoom));
-}
-
/*!
\qmlmethod void QtLocation::Map::fitViewportToMapItems()
diff --git a/src/imports/location/qdeclarativegeomap_p.h b/src/imports/location/qdeclarativegeomap_p.h
index acfdd4f5..22450ec1 100644
--- a/src/imports/location/qdeclarativegeomap_p.h
+++ b/src/imports/location/qdeclarativegeomap_p.h
@@ -124,7 +124,6 @@ public:
QQuickGeoMapGestureArea *gesture();
- Q_INVOKABLE void fitViewportToGeoShape(const QVariant &shape);
Q_INVOKABLE void fitViewportToMapItems();
Q_INVOKABLE void pan(int dx, int dy);
Q_INVOKABLE void prefetchData(); // optional hint for prefetch