[Marble-commits] KDE/kdeedu/marble/src/lib
Jens-Michael Hoffmann
jensmh at gmx.de
Tue Jan 26 12:37:34 CET 2010
SVN commit 1080535 by jmhoffmann:
TextureTile::loadDataset: Replace x, y and zoom level arguments with a single TileId argument.
M +1 -1 MergedLayerDecorator.cpp
M +9 -8 TextureTile.cpp
M +2 -2 TextureTile.h
M +4 -4 TileLoader.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MergedLayerDecorator.cpp #1080534:1080535
@@ -142,7 +142,7 @@
connect( &tile, SIGNAL( downloadTile( const QUrl&, const QString&, const QString&, DownloadUsage ) ),
this, SIGNAL( downloadTile( const QUrl&, const QString&, const QString&, DownloadUsage ) ) );
- tile.loadDataset( textureLayer, m_id.zoomLevel(), m_id.x(), m_id.y() );
+ tile.loadDataset( textureLayer, m_id );
return *( tile.tile() );
}
--- trunk/KDE/kdeedu/marble/src/lib/TextureTile.cpp #1080534:1080535
@@ -271,7 +271,7 @@
{
}
-void TextureTile::loadDataset( GeoSceneTexture *textureLayer, int level, int x, int y,
+void TextureTile::loadDataset( GeoSceneTexture *textureLayer, const TileId &id,
QCache<TileId, TextureTile> *tileCache )
{
// mDebug() << "TextureTile::loadDataset" << level << x << y;
@@ -288,18 +288,19 @@
const int levelZeroColumns = textureLayer->levelZeroColumns();
const int levelZeroRows = textureLayer->levelZeroRows();
- const int rowsRequestedLevel = TileLoaderHelper::levelToRow( levelZeroRows, level );
- const int columnsRequestedLevel = TileLoaderHelper::levelToColumn( levelZeroColumns, level );
+ const int rowsRequestedLevel = TileLoaderHelper::levelToRow( levelZeroRows, id.zoomLevel() );
+ const int columnsRequestedLevel = TileLoaderHelper::levelToColumn( levelZeroColumns,
+ id.zoomLevel() );
bool tileFound = false;
- for ( int currentLevel = level; !tileFound && currentLevel > -1; --currentLevel ) {
+ for ( int currentLevel = id.zoomLevel(); !tileFound && currentLevel > -1; --currentLevel ) {
const int rowsCurrentLevel =
TileLoaderHelper::levelToRow( levelZeroRows, currentLevel );
const int columnsCurrentLevel =
TileLoaderHelper::levelToColumn( levelZeroColumns, currentLevel );
- qreal normalizedX = (qreal)(x) / (qreal)( rowsRequestedLevel );
- qreal normalizedY = (qreal)(y) / (qreal)( columnsRequestedLevel );
+ qreal normalizedX = (qreal)( id.x() ) / (qreal)( rowsRequestedLevel );
+ qreal normalizedY = (qreal)( id.y() ) / (qreal)( columnsRequestedLevel );
qreal currentX = normalizedX * (qreal)( rowsCurrentLevel );
qreal currentY = normalizedY * (qreal)( columnsCurrentLevel );
@@ -370,9 +371,9 @@
if ( !temptile.isNull() ) {
// Don't scale if the current tile isn't a fallback
- if ( level != currentLevel ) {
+ if ( id.zoomLevel() != currentLevel ) {
d->scaleTileFrom( textureLayer, temptile, currentX, currentY, currentLevel,
- x, y, level );
+ id.x(), id.y(), id.zoomLevel() );
}
else {
d->m_state = TileComplete;
--- trunk/KDE/kdeedu/marble/src/lib/TextureTile.h #1080534:1080535
@@ -47,8 +47,8 @@
virtual ~TextureTile();
// TODO: Move into DatasetProvider:
- void loadDataset( GeoSceneTexture *textureLayer, int level, int x,
- int y, QCache<TileId, TextureTile> *tileCache = 0 );
+ void loadDataset( GeoSceneTexture *textureLayer, const TileId &id,
+ QCache<TileId, TextureTile> *tileCache = 0 );
int depth() const;
--- trunk/KDE/kdeedu/marble/src/lib/TileLoader.cpp #1080534:1080535
@@ -118,12 +118,12 @@
d->m_layer = layer;
- TileId id;
+ TileId id( 0, 0, 0 );
TextureTile tile( id );
GeoSceneTexture * texture = static_cast<GeoSceneTexture *>( d->m_layer->groundDataset() );
- tile.loadDataset( texture, 0, 0, 0 );
+ tile.loadDataset( texture, id );
// We assume that all tiles have the same size. TODO: check to be safe
d->m_tileWidth = tile.rawtile().width();
@@ -254,7 +254,7 @@
connect( tile, SIGNAL( tileUpdateDone() ),
this, SIGNAL( tileUpdateAvailable() ) );
- tile->loadDataset( texture, tileLevel, tilx, tily, &d->m_tileCache );
+ tile->loadDataset( texture, tileId, &d->m_tileCache );
tile->initJumpTables( false );
// TODO should emit signal rather than directly calling paintTile
@@ -365,7 +365,7 @@
// emit paintTile( d->m_tilesOnDisplay[id], x, y, level, d->m_theme, true );
GeoSceneTexture * texture = static_cast<GeoSceneTexture *>( d->m_layer->groundDataset() );
- d->m_tilesOnDisplay[id]->loadDataset( texture, level, x, y, &d->m_tileCache );
+ d->m_tilesOnDisplay[id]->loadDataset( texture, id, &d->m_tileCache );
m_parent->paintTile( d->m_tilesOnDisplay[id], x, y, level, texture, true );
// (d->m_tilesOnDisplay[id])->reloadTile( x, y, level, d->m_theme );
} else {
More information about the Marble-commits
mailing list