[Marble-commits] branches/KDE/4.6/kdeedu/marble/src/lib
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Wed Dec 29 23:03:30 CET 2010
SVN commit 1210167 by beschow:
backport of trunk-r1208783: move MergedLayerDecorator into StackedTileLoader in order to isolate composition of tiles into the latter
* This is mainly a cosmetic move to emphasize that the concept of stacked tiles still contains hardcoded tile layers.
There should be a framework in the future which allows to implement the MergedLayerDecorator and the blendings in an uniform manner.
M +21 -7 StackedTileLoader.cpp
M +4 -2 StackedTileLoader.h
M +2 -17 TextureLayer.cpp
M +0 -5 TextureLayer.h
--- branches/KDE/4.6/kdeedu/marble/src/lib/StackedTileLoader.cpp #1210166:1210167
@@ -35,6 +35,7 @@
#include "MapThemeManager.h"
#include "MarbleDebug.h"
#include "MarbleDirs.h"
+#include "MergedLayerDecorator.h"
#include "StackedTile.h"
#include "TextureLayer.h"
#include "TextureTile.h"
@@ -60,16 +61,16 @@
class StackedTileLoaderPrivate
{
public:
- StackedTileLoaderPrivate( TileLoader *tileLoader, TextureLayer *textureLayer )
- : m_parent( textureLayer ),
- m_datasetProvider( 0 ),
+ StackedTileLoaderPrivate( TileLoader *tileLoader, SunLocator *sunLocator )
+ : m_datasetProvider( 0 ),
+ m_layerDecorator( tileLoader, sunLocator ),
m_tileLoader( tileLoader )
{
m_tileCache.setMaxCost( 20000 * 1024 ); // Cache size measured in bytes
}
- TextureLayer *const m_parent;
DatasetProvider *m_datasetProvider;
+ MergedLayerDecorator m_layerDecorator;
TileLoader *m_tileLoader;
QVector<GeoSceneTexture const *> m_textureLayers;
QHash <TileId, StackedTile*> m_tilesOnDisplay;
@@ -77,11 +78,12 @@
};
StackedTileLoader::StackedTileLoader( TileLoader * const tileLoader,
- TextureLayer * const parent )
- : d( new StackedTileLoaderPrivate( tileLoader, parent ) )
+ SunLocator * const sunLocator )
+ : d( new StackedTileLoaderPrivate( tileLoader, sunLocator ) )
{
connect( d->m_tileLoader, SIGNAL( tileCompleted( TileId, TileId )),
SLOT( updateTile( TileId, TileId )));
+ connect( &d->m_layerDecorator, SIGNAL( repaintMap() ), SIGNAL( tileUpdateAvailable() ) );
}
StackedTileLoader::~StackedTileLoader()
@@ -101,6 +103,11 @@
d->m_tileCache.clear();
}
+void StackedTileLoader::setShowTileId( bool show )
+{
+ d->m_layerDecorator.setShowTileId( show );
+}
+
void StackedTileLoader::resetTilehash()
{
QHash<TileId, StackedTile*>::const_iterator it = d->m_tilesOnDisplay.constBegin();
@@ -394,7 +401,14 @@
void StackedTileLoader::mergeDecorations( StackedTile * const tile ) const
{
Q_ASSERT( !tile->resultTile()->isNull() );
- d->m_parent->paintTile( tile );
+ Q_ASSERT( !d->m_textureLayers.isEmpty() );
+// mDebug() << "MarbleModel::paintTile: " << "x: " << x << "y:" << y << "level: " << level
+// << "requestTileUpdate" << requestTileUpdate;
+
+ d->m_layerDecorator.setInfo( tile->id() );
+ d->m_layerDecorator.setTile( tile->resultTile() );
+
+ d->m_layerDecorator.paint( "maps/" + d->m_textureLayers.at( 0 )->sourceDir() );
}
// This method should not alter m_tileCache, as the given tile is managed
--- branches/KDE/4.6/kdeedu/marble/src/lib/StackedTileLoader.h #1210166:1210167
@@ -40,7 +40,7 @@
class GeoSceneDocument;
class GeoSceneLayer;
class GeoSceneTexture;
-class TextureLayer;
+class SunLocator;
class TileLoader;
class StackedTileLoaderPrivate;
@@ -69,11 +69,13 @@
* @param downloadManager The download manager that shall be used to fetch
* the tiles from a remote resource.
*/
- StackedTileLoader( TileLoader * const tileLoader, TextureLayer * const parent );
+ StackedTileLoader( TileLoader * const tileLoader, SunLocator * const sunLocator );
virtual ~StackedTileLoader();
void setTextureLayers( QVector<GeoSceneTexture const *> & );
+ void setShowTileId( bool show );
+
/**
* Loads a tile and returns it.
*
--- branches/KDE/4.6/kdeedu/marble/src/lib/TextureLayer.cpp #1210166:1210167
@@ -28,7 +28,6 @@
#include "GeoSceneSettings.h"
#include "MarbleDebug.h"
#include "MarbleDirs.h"
-#include "MergedLayerDecorator.h"
#include "StackedTile.h"
#include "StackedTileLoader.h"
#include "TextureColorizer.h"
@@ -56,7 +55,6 @@
TextureColorizer m_texcolorizer;
TileLoader m_loader;
StackedTileLoader m_tileLoader;
- MergedLayerDecorator m_layerDecorator;
VectorComposer m_veccomposer;
AbstractScanlineTextureMapper *m_texmapper;
GeoSceneDocument *m_mapTheme;
@@ -67,8 +65,7 @@
: m_parent( parent )
, m_texcolorizer()
, m_loader( downloadManager, mapThemeManager )
- , m_tileLoader( &m_loader, parent )
- , m_layerDecorator( &m_loader, sunLocator )
+ , m_tileLoader( &m_loader, sunLocator )
, m_veccomposer( parent )
, m_texmapper( 0 )
, m_mapTheme( 0 )
@@ -157,7 +154,6 @@
: QObject()
, d( new Private( mapThemeManager, downloadManager, sunLocator, this ) )
{
- connect( &d->m_layerDecorator, SIGNAL( repaintMap() ), SLOT( mapChanged() ) );
connect( &d->m_veccomposer, SIGNAL( datasetLoaded() ), SLOT( mapChanged() ) );
connect( &d->m_tileLoader, SIGNAL( tileUpdateAvailable() ), SLOT( mapChanged() ) );
}
@@ -229,7 +225,7 @@
void TextureLayer::setShowTileId( bool show )
{
- d->m_layerDecorator.setShowTileId( show );
+ d->m_tileLoader.setShowTileId( show );
}
void TextureLayer::setupTextureMapper( Projection projection )
@@ -370,17 +366,6 @@
return d->m_tileLoader.volatileCacheLimit();
}
-void TextureLayer::paintTile( StackedTile* tile )
-{
-// mDebug() << "MarbleModel::paintTile: " << "x: " << x << "y:" << y << "level: " << level
-// << "requestTileUpdate" << requestTileUpdate;
-
- d->m_layerDecorator.setInfo( tile->id() );
- d->m_layerDecorator.setTile( tile->resultTile() );
-
- d->m_layerDecorator.paint( "maps/" + d->textureLayer()->sourceDir() );
}
-}
-
#include "TextureLayer.moc"
--- branches/KDE/4.6/kdeedu/marble/src/lib/TextureLayer.h #1210166:1210167
@@ -30,8 +30,6 @@
class GeoSceneDocument;
class HttpDownloadManager;
class MapThemeManager;
-class StackedTile;
-class StackedTileLoader;
class SunLocator;
class ViewParams;
@@ -87,9 +85,6 @@
void repaintNeeded( const QRegion & );
private:
- friend class StackedTileLoader;
- void paintTile( StackedTile *tile );
-
Q_PRIVATE_SLOT( d, void mapChanged() )
Q_PRIVATE_SLOT( d, void updateTextureLayers() )
More information about the Marble-commits
mailing list