[Marble-commits] branches/KDE/4.6/kdeedu/marble/src/lib

Bernhard Beschow bbeschow at cs.tu-berlin.de
Sat Jan 1 13:24:14 CET 2011


SVN commit 1210614 by beschow:

backport of trunk-r1210457: cleanup AbstractScanlineTextureMapper: merge selectTileLevel(), tileLevelInit(), initGlobalWidth(), and initGlobalHeight() into setRadius()

 M  +5 -23     AbstractScanlineTextureMapper.cpp  
 M  +1 -5      AbstractScanlineTextureMapper.h  
 M  +1 -1      EquirectScanlineTextureMapper.cpp  
 M  +1 -1      MercatorScanlineTextureMapper.cpp  
 M  +1 -1      SphericalScanlineTextureMapper.cpp  
 M  +1 -1      TileScalingTextureMapper.cpp  


--- branches/KDE/4.6/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.cpp #1210613:1210614
@@ -53,10 +53,8 @@
 }
 
 
-void AbstractScanlineTextureMapper::selectTileLevel( ViewParams * const viewParams )
+void AbstractScanlineTextureMapper::setRadius( int radius )
 {
-    const int radius = viewParams->radius();
-
     // As our tile resolution doubles with each level we calculate
     // the tile level from tilesize and the globe radius via log(2)
 
@@ -77,19 +75,14 @@
 
     if ( tileLevel != m_tileLevel ) {
         m_tileLoader->flush();
-        tileLevelInit( tileLevel );
-    }
-}
 
-
-void AbstractScanlineTextureMapper::tileLevelInit( const int tileLevel )
-{
     //    mDebug() << "Texture Level was set to: " << tileLevel;
     m_tileLevel = tileLevel;
 
-    initGlobalWidth();
+        m_globalWidth = m_tileSize.width() * m_tileLoader->tileColumnCount( m_tileLevel );
     m_normGlobalWidth = (qreal)( m_globalWidth / ( 2 * M_PI ) );
-    initGlobalHeight();
+
+        m_globalHeight = m_tileSize.height() * m_tileLoader->tileRowCount( m_tileLevel );
     m_normGlobalHeight = (qreal)( m_globalHeight /  M_PI );
 
     m_maxGlobalX = m_globalWidth  - 1;
@@ -104,6 +97,7 @@
 
     emit tileLevelChanged( m_tileLevel );
 }
+}
 
 
 void AbstractScanlineTextureMapper::pixelValueF( const qreal lon, const qreal lat,
@@ -553,16 +547,4 @@
     posY = lat - m_tilePosY;
 }
 
-void AbstractScanlineTextureMapper::initGlobalWidth()
-{
-    m_globalWidth = m_tileSize.width()
-        * m_tileLoader->tileColumnCount( m_tileLevel );
-}
-
-void AbstractScanlineTextureMapper::initGlobalHeight()
-{
-    m_globalHeight = m_tileSize.height()
-        * m_tileLoader->tileRowCount( m_tileLevel );
-}
-
 #include "AbstractScanlineTextureMapper.moc"
--- branches/KDE/4.6/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.h #1210613:1210614
@@ -67,8 +67,7 @@
     // method for precise interpolation
     void nextTile( qreal& posx, qreal& posy );
 
-    void selectTileLevel( ViewParams * const viewParams );
-    void tileLevelInit( const int tileLevel );
+    void setRadius( int radius );
 
     int globalWidth() const;
     int globalHeight() const;
@@ -120,9 +119,6 @@
 
  private:
     Q_DISABLE_COPY( AbstractScanlineTextureMapper )
-    void initGlobalWidth();
-    void initGlobalHeight();
-
     StackedTile *m_tile;
     int         m_previousRadius;
 
--- branches/KDE/4.6/kdeedu/marble/src/lib/EquirectScanlineTextureMapper.cpp #1210613:1210614
@@ -64,7 +64,7 @@
 
     // Reset backend
     m_tileLoader->resetTilehash();
-    selectTileLevel( viewParams );
+    setRadius( viewParams->radius() );
 
     // Evaluate the degree of interpolation
     const int n = interpolationStep( viewParams );
--- branches/KDE/4.6/kdeedu/marble/src/lib/MercatorScanlineTextureMapper.cpp #1210613:1210614
@@ -68,7 +68,7 @@
 
     // Reset backend
     m_tileLoader->resetTilehash();
-    selectTileLevel( viewParams );
+    setRadius( viewParams->radius() );
 
     // Evaluate the degree of interpolation
     const int n = interpolationStep( viewParams );
--- branches/KDE/4.6/kdeedu/marble/src/lib/SphericalScanlineTextureMapper.cpp #1210613:1210614
@@ -60,7 +60,7 @@
 
     // Reset backend
     m_tileLoader->resetTilehash();
-    selectTileLevel( viewParams );
+    setRadius( viewParams->radius() );
 
     // Evaluate the degree of interpolation
     const int n = interpolationStep( viewParams );
--- branches/KDE/4.6/kdeedu/marble/src/lib/TileScalingTextureMapper.cpp #1210613:1210614
@@ -57,7 +57,7 @@
 
     // Reset backend
     m_tileLoader->resetTilehash();
-    selectTileLevel( viewParams );
+    setRadius( viewParams->radius() );
 
     // Calculate translation of center point
     qreal centerLon, centerLat;


More information about the Marble-commits mailing list