[Kde-bindings] [marble] src/lib: MarbleWidget: forward focus point methods from ViewportParams
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Fri Dec 9 21:22:07 UTC 2011
Git commit 038c21e390cc31343d97e524d67728ab2f43ee1c by Bernhard Beschow.
Committed on 09/12/2011 at 18:43.
Pushed by beschow into branch 'master'.
MarbleWidget: forward focus point methods from ViewportParams
CCMAIL: kde-bindings at kde.org
M +15 -0 src/lib/MarbleWidget.cpp
M +21 -0 src/lib/MarbleWidget.h
M +5 -5 src/lib/MarbleWidgetInputHandler.cpp
M +3 -3 src/lib/ViewportParams.h
http://commits.kde.org/marble/038c21e390cc31343d97e524d67728ab2f43ee1c
diff --git a/src/lib/MarbleWidget.cpp b/src/lib/MarbleWidget.cpp
index a697082..157edc9 100644
--- a/src/lib/MarbleWidget.cpp
+++ b/src/lib/MarbleWidget.cpp
@@ -1341,6 +1341,21 @@ GeoDataLookAt MarbleWidget::lookAt() const
return result;
}
+GeoDataCoordinates MarbleWidget::focusPoint() const
+{
+ return d->m_map.viewport()->focusPoint();
+}
+
+void MarbleWidget::setFocusPoint( const GeoDataCoordinates &focusPoint )
+{
+ d->m_map.viewport()->setFocusPoint( focusPoint );
+}
+
+void MarbleWidget::resetFocusPoint()
+{
+ d->m_map.viewport()->resetFocusPoint();
+}
+
qreal MarbleWidget::radiusFromDistance( qreal distance ) const
{
return model()->planet()->radius() /
diff --git a/src/lib/MarbleWidget.h b/src/lib/MarbleWidget.h
index 114e969..31049ac 100644
--- a/src/lib/MarbleWidget.h
+++ b/src/lib/MarbleWidget.h
@@ -376,6 +376,27 @@ class MARBLE_EXPORT MarbleWidget : public QWidget
GeoDataLookAt lookAt() const;
/**
+ * @return The current point of focus, e.g. the point that is not moved
+ * when changing the zoom level. If not set, it defaults to the
+ * center point.
+ * @see centerLongitude centerLatitude setFocusPoint resetFocusPoint
+ */
+ GeoDataCoordinates focusPoint() const;
+
+ /**
+ * @brief Change the point of focus, overridding any previously set focus point.
+ * @param focusPoint New focus point
+ * @see focusPoint resetFocusPoint
+ */
+ void setFocusPoint( const GeoDataCoordinates &focusPoint );
+
+ /**
+ * @brief Invalidate any focus point set with @ref setFocusPoint.
+ * @see focusPoint setFocusPoint
+ */
+ void resetFocusPoint();
+
+ /**
* @brief Return the globe radius (pixel) for the given distance (km)
*/
qreal radiusFromDistance( qreal distance ) const;
diff --git a/src/lib/MarbleWidgetInputHandler.cpp b/src/lib/MarbleWidgetInputHandler.cpp
index 3b10500..e2705b7 100644
--- a/src/lib/MarbleWidgetInputHandler.cpp
+++ b/src/lib/MarbleWidgetInputHandler.cpp
@@ -275,7 +275,7 @@ void MarbleWidgetDefaultInputHandler::Private::ZoomAt(MarbleWidget* marbleWidget
lookAt.setAltitude( 0.0 );
lookAt.setRange( newDistance * KM2METER );
- marbleWidget->viewport()->setFocusPoint( GeoDataCoordinates( destLon, destLat ) );
+ marbleWidget->setFocusPoint( GeoDataCoordinates( destLon, destLat ) );
marbleWidget->flyTo( lookAt, Linear );
}
@@ -373,7 +373,7 @@ void MarbleWidgetInputHandler::restoreViewContext()
// Redraw the map with the quality set for Still (if necessary).
d->m_widget->setViewContext( Still );
- d->m_widget->viewport()->resetFocusPoint();
+ d->m_widget->resetFocusPoint();
d->m_wheelZoomTargetDistance = 0.0;
}
@@ -774,7 +774,7 @@ bool MarbleWidgetDefaultInputHandler::eventFilter( QObject* o, QEvent* e )
destLon, destLat, GeoDataCoordinates::Radian );
if (isValid) {
- marbleWidget->viewport()->setFocusPoint(GeoDataCoordinates(destLon, destLat));
+ marbleWidget->setFocusPoint(GeoDataCoordinates(destLon, destLat));
}
switch ( pinch->state() ) {
@@ -788,12 +788,12 @@ bool MarbleWidgetDefaultInputHandler::eventFilter( QObject* o, QEvent* e )
marbleWidget->setRadius( marbleWidget->radius() * scaleFactor );
break;
case Qt::GestureFinished:
- marbleWidget->viewport()->resetFocusPoint();
+ marbleWidget->resetFocusPoint();
marbleWidget->setViewContext( Still );
break;
case Qt::GestureCanceled:
marbleWidget->setRadius( d->m_startingRadius );
- marbleWidget->viewport()->resetFocusPoint();
+ marbleWidget->resetFocusPoint();
marbleWidget->setViewContext( Still );
break;
}
diff --git a/src/lib/ViewportParams.h b/src/lib/ViewportParams.h
index 83e8328..2b9193b 100644
--- a/src/lib/ViewportParams.h
+++ b/src/lib/ViewportParams.h
@@ -106,20 +106,20 @@ class MARBLE_EXPORT ViewportParams
* @return The current point of focus, e.g. the point that is not moved
* when changing the zoom level. If not set, it defaults to the
* center point.
- * @see centerCoordinates setFocusPoint resetFocusPoint focusPointIsCenter
+ * @see centerCoordinates setFocusPoint resetFocusPoint
*/
GeoDataCoordinates focusPoint() const;
/**
* @brief Change the point of focus, overridding any previously set focus point.
* @param focusPoint New focus point
- * @see focusPoint resetFocusPoint focusPointIsCenter
+ * @see focusPoint resetFocusPoint
*/
void setFocusPoint(const GeoDataCoordinates &focusPoint);
/**
* @brief Invalidate any focus point set with @ref setFocusPoint.
- * @see focusPoint setFocusPoint focusPointIsCenter
+ * @see focusPoint setFocusPoint
*/
void resetFocusPoint();
More information about the Kde-bindings
mailing list