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

Jens-Michael Hoffmann jensmh at gmx.de
Wed Jan 27 19:52:53 CET 2010


SVN commit 1081105 by jmhoffmann:

Declare TextureTile::initJumpTables private.

initJumpTables is an operation which has to take place after the QImage
representing the original downloaded tile has changed, whether directly
after creation of a TextureTile object or after an update of an existing
TextureTile object because the content was expired.

One special thing about TextureTile::initJumpTables is that it has a
parameter (requestTileUpdate) specifying whether the signal tileUpdateDone
should be emitted.

There were two users of TextureTile::initJumpTables outside TextureTile.

1) TileLoader::loadTile, here TextureTile::initJumpTables was called with
   requestTileUpdate=false after TextureTile::loadDataset.
   The solution in this case was to call initJumpTables from within
   TextureTile::loadDataset.
2) MarbleModel::paintTile, here TextureTile::initJumpTables was called
   with requestTileUpdate, which is a parameter for paintTile also.
   MarbleModel::paintTile in turn is called from two places,
   a) TileLoader::loadTile, here with requestTileUpdate=false,
      so no change required
   b) TileLoader::reloadTile, here with requestTileUpdate=true,
      therefore we have to emit tileUpdateAvailable after the
      paintTile call.

 M  +1 -3      MarbleModel.cpp  
 M  +1 -1      MarbleModel.h  
 M  +2 -4      TextureTile.cpp  
 M  +1 -3      TextureTile.h  
 M  +3 -3      TileLoader.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1081104:1081105
@@ -834,8 +834,7 @@
     }
 }
 
-void MarbleModel::paintTile( TextureTile* tile, GeoSceneTexture *textureLayer,
-                             bool requestTileUpdate )
+void MarbleModel::paintTile( TextureTile* tile, GeoSceneTexture *textureLayer )
 {
 //    mDebug() << "MarbleModel::paintTile: " << "x: " << x << "y:" << y << "level: " << level
 //             << "requestTileUpdate" << requestTileUpdate;
@@ -849,7 +848,6 @@
     d->m_layerDecorator->setTile( tile->tile() );
 
     d->m_layerDecorator->paint( "maps/" + textureLayer->sourceDir(), mapTheme() );
-    tile->initJumpTables( requestTileUpdate );
 }
 
 PluginManager* MarbleModel::pluginManager() const
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.h #1081104:1081105
@@ -306,7 +306,7 @@
     void clearPersistentTileCache();
 
 //  private Q_SLOTS:
-    void paintTile( TextureTile* tile, GeoSceneTexture *textureLayer, bool requestTileUpdate );
+    void paintTile( TextureTile* tile, GeoSceneTexture *textureLayer );
 
     /**
      * @brief Update the model
--- trunk/KDE/kdeedu/marble/src/lib/TextureTile.cpp #1081104:1081105
@@ -381,8 +381,10 @@
                 }
 
                 d->m_rawtile = temptile;
+                d->m_depth = d->m_rawtile.depth();
                 d->m_created = lastModified;
                 tileFound = true;
+                initJumpTables( false );
             }
         }
 
@@ -399,10 +401,6 @@
     }
 
 //    mDebug() << "TextureTile::loadDataset end";
-
-    d->m_depth = d->m_rawtile.depth();
-
-//    mDebug() << "m_depth =" << m_depth;
 }
 
 void TextureTile::initJumpTables( bool requestTileUpdate )
--- trunk/KDE/kdeedu/marble/src/lib/TextureTile.h #1081104:1081105
@@ -76,15 +76,13 @@
     void downloadTile(const QUrl& sourceUrl, const QString& destinationFileName,
                       const QString& id, DownloadUsage );
 
- public Q_SLOTS:
-    void initJumpTables( bool requestTileUpdate = true );
-
  protected:
     TextureTile( TextureTilePrivate &dd, QObject *parent );
 
  private:
     Q_DECLARE_PRIVATE( TextureTile )
     Q_DISABLE_COPY( TextureTile )
+    void initJumpTables( bool requestTileUpdate = true );
     TextureTilePrivate *d;
 };
 
--- trunk/KDE/kdeedu/marble/src/lib/TileLoader.cpp #1081104:1081105
@@ -253,11 +253,10 @@
              this, SIGNAL( tileUpdateAvailable() ) );
 
     tile->loadDataset( texture, &d->m_tileCache );
-    tile->initJumpTables( false );
 
     // TODO should emit signal rather than directly calling paintTile
     // emit paintTile( tile, tilx, tily, tileLevel, d->m_theme, false );
-    m_parent->paintTile( tile, texture, false );
+    m_parent->paintTile( tile, texture );
 
     return tile;
 }
@@ -362,7 +361,8 @@
         GeoSceneTexture * texture = static_cast<GeoSceneTexture *>( d->m_layer->groundDataset() );
 
         d->m_tilesOnDisplay[id]->loadDataset( texture, &d->m_tileCache );
-        m_parent->paintTile( d->m_tilesOnDisplay[id], texture, true );
+        m_parent->paintTile( d->m_tilesOnDisplay[id], texture );
+        emit tileUpdateAvailable();
 //         (d->m_tilesOnDisplay[id])->reloadTile( x, y, level, d->m_theme );
     } else {
         // Remove "false" tile from cache so it doesn't get loaded anymore


More information about the Marble-commits mailing list