SVN commit 1226289 by beschow: forward some methods of MarbleMap in MarbleWidget * allows for "widget->foo(...)" rather than forcing "widget->map()->foo(...)" M +3 -3 ControlView.cpp M +1 -2 lib/GoToDialog.cpp M +32 -0 lib/MarbleWidget.cpp M +24 -0 lib/MarbleWidget.h M +3 -4 lib/MarbleWidgetInputHandler.cpp M +0 -1 lib/MarbleWidgetInputHandler.h --- trunk/KDE/kdeedu/marble/src/ControlView.cpp #1226288:1226289 @@ -205,11 +205,11 @@ QTextDocument document; QString text = "Marble Printout"; QPalette const originalPalette = m_marbleWidget->palette(); - bool const wasBackgroundVisible = m_marbleWidget->map()->showBackground(); + bool const wasBackgroundVisible = m_marbleWidget->showBackground(); bool const hideBackground = !mapCoversViewport && !printOptions->printBackground(); if ( hideBackground ) { // Temporarily remove the black background and layers painting on it - m_marbleWidget->map()->setShowBackground( false ); + m_marbleWidget->setShowBackground( false ); m_marbleWidget->setPalette( QPalette ( Qt::white ) ); m_marbleWidget->repaint(); } @@ -239,7 +239,7 @@ document.print( printDialog->printer() ); if ( hideBackground ) { - m_marbleWidget->map()->setShowBackground( wasBackgroundVisible ); + m_marbleWidget->setShowBackground( wasBackgroundVisible ); m_marbleWidget->setPalette( originalPalette ); m_marbleWidget->repaint(); } --- trunk/KDE/kdeedu/marble/src/lib/GoToDialog.cpp #1226288:1226289 @@ -11,7 +11,6 @@ #include "GoToDialog.h" #include "MarbleWidget.h" #include "MarbleModel.h" -#include "MarbleMap.h" #include "GeoDataFolder.h" #include "PositionTracking.h" #include "BookmarkManager.h" @@ -177,7 +176,7 @@ GeoDataLookAt result; result.setLongitude( lon, GeoDataCoordinates::Degree ); result.setLatitude( lat, GeoDataCoordinates::Degree ); - result.setRange( m_marbleWidget->map()->distanceFromZoom( zoom ) * KM2METER ); + result.setRange( m_marbleWidget->distanceFromZoom( zoom ) * KM2METER ); return qVariantFromValue( result ); } } --- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1226288:1226289 @@ -491,6 +491,11 @@ return d->m_map->showFrameRate(); } +bool MarbleWidget::showBackground() const +{ + return d->m_map->showBackground(); +} + quint64 MarbleWidget::volatileTileCacheLimit() const { return d->m_map->volatileTileCacheLimit(); @@ -965,6 +970,13 @@ repaint(); } +void MarbleWidget::setShowBackground( bool visible ) +{ + d->m_map->setShowBackground( visible ); + + repaint(); +} + void MarbleWidget::setShowGps( bool visible ) { d->m_map->setShowGps( visible ); @@ -1246,6 +1258,26 @@ return d->m_map->lookAt(); } +qreal MarbleWidget::radiusFromDistance( qreal distance ) const +{ + return d->m_map->radiusFromDistance( distance ); +} + +qreal MarbleWidget::distanceFromRadius( qreal radius ) const +{ + return d->m_map->distanceFromRadius( radius ); +} + +qreal MarbleWidget::zoomFromDistance( qreal distance ) const +{ + return d->m_map->zoomFromDistance( distance ); +} + +qreal MarbleWidget::distanceFromZoom( qreal zoom ) const +{ + return d->m_map->distanceFromZoom( zoom ); +} + RoutingLayer* MarbleWidget::routingLayer() { return d->m_routingLayer; --- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #1226288:1226289 @@ -387,6 +387,26 @@ */ GeoDataLookAt lookAt() const; + /** + * @brief Return the globe radius (pixel) for the given distance (km) + */ + qreal radiusFromDistance( qreal distance ) const; + + /** + * @brief Return the distance (km) at the given globe radius (pixel) + */ + qreal distanceFromRadius( qreal radius ) const; + + /** + * Returns the zoom value (no unit) corresponding to the given camera distance (km) + */ + qreal zoomFromDistance( qreal distance ) const; + + /** + * Returns the distance (km) corresponding to the given zoom value + */ + qreal distanceFromZoom( qreal zoom ) const; + //@} /// @name Placemark management @@ -513,6 +533,8 @@ */ bool showFrameRate() const; + bool showBackground() const; + /** * @brief Retrieve the map quality depending on the view context */ @@ -855,6 +877,8 @@ */ void setShowFrameRate( bool visible ); + void setShowBackground( bool visible ); + /** * @brief Set whether the is tile is visible * NOTE: This is part of the transitional debug API --- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetInputHandler.cpp #1226288:1226289 @@ -33,7 +33,6 @@ #include "GeoDataCoordinates.h" #include "MarbleDirs.h" #include "MarbleWidget.h" -#include "MarbleMap.h" #include "MarbleModel.h" #include "ViewportParams.h" #include "AbstractFloatItem.h" @@ -241,7 +240,7 @@ soon.setPlanetAxis(now->planetAxis()); soon.setSize(now->size()); - qreal newRadius = marbleWidget->map()->radiusFromDistance(newDistance); + qreal newRadius = marbleWidget->radiusFromDistance(newDistance); soon.setRadius( newRadius ); qreal mouseLon, mouseLat; @@ -720,9 +719,9 @@ qreal target = MarbleWidgetInputHandler::d->m_wheelZoomTargetDistance; if ( marbleWidget->animationsEnabled() && target > 0.0 ) { // Do not use intermediate (interpolated) distance values caused by animations - zoom = marbleWidget->map()->zoomFromDistance( target ); + zoom = marbleWidget->zoomFromDistance( target ); } - qreal newDistance = marbleWidget->map()->distanceFromZoom( zoom + steps ); + qreal newDistance = marbleWidget->distanceFromZoom( zoom + steps ); MarbleWidgetInputHandler::d->m_wheelZoomTargetDistance = newDistance; d->ZoomAt(MarbleWidgetInputHandler::d->m_widget, wheelevt->pos(), newDistance); --- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetInputHandler.h #1226288:1226289 @@ -30,7 +30,6 @@ class MarbleModel; class MarbleWidget; -class MarbleMap; class MarbleWidgetPopupMenu; class AbstractDataPluginItem; class RenderPlugin;