[Marble-commits] KDE/kdeedu/marble/src/lib
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Tue Oct 5 16:05:05 CEST 2010
SVN commit 1182738 by beschow:
remove MarbleMap::zoom{In, Out}() and simplify MarbleWidget::zoom{In, Out, View}()
M +0 -11 MarbleMap.cpp
M +0 -9 MarbleMap.h
M +0 -1 MarbleMap_p.h
M +7 -45 MarbleWidget.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.cpp #1182737:1182738
@@ -81,7 +81,6 @@
m_dirtyAtmosphere = false;
m_logzoom = 0;
- m_zoomStep = 40;
// FloatItems
m_showFrameRate = false;
@@ -691,16 +690,6 @@
}
-void MarbleMap::zoomIn()
-{
- zoomViewBy( d->m_zoomStep );
-}
-
-void MarbleMap::zoomOut()
-{
- zoomViewBy( -d->m_zoomStep );
-}
-
void MarbleMap::rotateBy( const Quaternion& incRot )
{
d->m_viewParams.setPlanetAxis( incRot * d->m_viewParams.planetAxis() );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.h #1182737:1182738
@@ -494,15 +494,6 @@
void zoomViewBy( int zoomStep );
/**
- * @brief Zoom in by the amount zoomStep.
- */
- void zoomIn();
- /**
- * @brief Zoom out by the amount zoomStep.
- */
- void zoomOut();
-
- /**
* @brief Rotate the view by the two angles phi and theta.
* @param deltaLon an angle that specifies the change in terms of longitude
* @param deltaLat an angle that specifies the change in terms of latitude
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap_p.h #1182737:1182738
@@ -64,7 +64,6 @@
// zoom related
int m_logzoom;
- int m_zoomStep;
TextureColorizer *m_sealegend;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1182737:1182738
@@ -70,6 +70,7 @@
m_stillQuality( HighQuality ),
m_animationQuality( LowQuality ),
m_animationsEnabled( false ),
+ m_zoomStep( 40 ),
m_inputhandler( 0 ),
m_physics( new MarblePhysics( parent ) ),
m_repaintTimer()
@@ -111,9 +112,7 @@
bool m_animationsEnabled;
- // Some values from m_map, as they were last time we repainted.
- // To store them here will save some repaintings.
- int m_logZoom;
+ int m_zoomStep;
MarbleWidgetInputHandler *m_inputhandler;
@@ -216,8 +215,6 @@
m_widget, SLOT( creatingTilesStart( TileCreator*, const QString&,
const QString& ) ) );
- m_logZoom = 0;
-
m_widget->connect( m_model->sunLocator(), SIGNAL( enableWidgetInput( bool ) ),
m_widget, SLOT( setInputEnabled( bool ) ) );
@@ -500,28 +497,11 @@
void MarbleWidget::zoomView( int newZoom, FlyToMode mode )
{
- if ( mode == Instant || !d->m_animationsEnabled ) {
- // This function is tricky since it needs to be possible to call
- // both from above as an ordinary function, and "from below",
- // i.e. as a slot. That's why we need to save m_logZoom from when
- // we repainted last time.
+ GeoDataLookAt target = d->m_map->lookAt();
+ target.setRange( KM2METER * d->m_map->distanceFromZoom( newZoom ) );
- // Make all the internal changes to the map.
- d->m_map->zoomView( newZoom );
-
- // If no change, we don't need to repainting or anything else.
- if ( d->m_logZoom == newZoom )
- return;
-
- d->m_logZoom = newZoom;
- d->repaint();
+ flyTo( target, mode );
}
- else {
- GeoDataLookAt target = d->m_map->lookAt();
- target.setRange( 1000 * d->m_map->distanceFromZoom( newZoom ) );
- flyTo( target, mode == Automatic ? Instant : mode );
- }
-}
void MarbleWidget::zoomViewBy( int zoomStep, FlyToMode mode )
@@ -532,31 +512,13 @@
void MarbleWidget::zoomIn( FlyToMode mode )
{
- if ( mode == Instant || !d->m_animationsEnabled ) {
- d->m_map->zoomIn();
- d->repaint();
+ zoomViewBy( d->m_zoomStep, mode );
}
- else {
- GeoDataLookAt target = d->m_map->lookAt();
- MarbleMap *map = d->m_map;
- target.setRange( 1000 * d->m_map->distanceFromZoom( map->zoom() + map->d->m_zoomStep ) );
- flyTo( target, mode );
- }
-}
void MarbleWidget::zoomOut( FlyToMode mode )
{
- if ( mode == Instant || !d->m_animationsEnabled ) {
- d->m_map->zoomOut();
- d->repaint();
+ zoomViewBy( -d->m_zoomStep, mode );
}
- else {
- GeoDataLookAt target = d->m_map->lookAt();
- MarbleMap *map = d->m_map;
- target.setRange( 1000 * d->m_map->distanceFromZoom( map->zoom() - map->d->m_zoomStep ) );
- flyTo( target, mode );
- }
-}
void MarbleWidget::rotateBy( const Quaternion& incRot )
{
More information about the Marble-commits
mailing list