[Marble-commits] KDE/kdeedu/marble/src/lib
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Tue Nov 30 16:00:22 CET 2010
SVN commit 1202360 by beschow:
don't expose the StackedTileLoader in the TextureLayer
M +8 -17 MarbleModel.cpp
M +33 -2 TextureLayer.cpp
M +9 -1 TextureLayer.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1202359:1202360
@@ -642,8 +642,7 @@
void MarbleModel::update()
{
- mDebug() << "MarbleModel::update()";
- QTimer::singleShot( 0, d->m_textureLayer->tileLoader(), SLOT( update() ) );
+ d->m_textureLayer->update();
}
qreal MarbleModel::planetRadius() const
@@ -680,18 +679,18 @@
void MarbleModel::clearVolatileTileCache()
{
- d->m_textureLayer->tileLoader()->update();
+ d->m_textureLayer->update();
mDebug() << "Cleared Volatile Cache!";
}
quint64 MarbleModel::volatileTileCacheLimit() const
{
- return d->m_textureLayer->tileLoader()->volatileCacheLimit();
+ return d->m_textureLayer->volatileCacheLimit();
}
void MarbleModel::setVolatileTileCacheLimit( quint64 kiloBytes )
{
- d->m_textureLayer->tileLoader()->setVolatileCacheLimit( kiloBytes );
+ d->m_textureLayer->setVolatileCacheLimit( kiloBytes );
}
void MarbleModel::clearPersistentTileCache()
@@ -806,22 +805,14 @@
void MarbleModel::reloadMap() const
{
- Q_ASSERT( d->m_textureLayer->tileLoader() );
- QList<TileId> displayed = d->m_textureLayer->tileLoader()->tilesOnDisplay();
- QList<TileId>::const_iterator pos = displayed.constBegin();
- QList<TileId>::const_iterator const end = displayed.constEnd();
- for (; pos != end; ++pos ) {
- // it's debatable here, whether DownloadBulk or DownloadBrowse should be used
- // but since "reload" or "refresh" seems to be a common action of a browser and it
- // allows for more connections (in our model), use "DownloadBrowse"
- d->m_textureLayer->tileLoader()->reloadTile( *pos, DownloadBrowse );
+ Q_ASSERT( d->m_textureLayer );
+ d->m_textureLayer->reload();
}
-}
void MarbleModel::downloadRegion( QString const & mapThemeId,
QVector<TileCoordsPyramid> const & pyramid ) const
{
- Q_ASSERT( d->m_textureLayer->tileLoader() );
+ Q_ASSERT( d->m_textureLayer );
Q_ASSERT( !pyramid.isEmpty() );
QTime t;
t.start();
@@ -856,7 +847,7 @@
}
QSetIterator<TileId> i( tileIdSet );
while( i.hasNext() ) {
- d->m_textureLayer->tileLoader()->downloadTile( i.next() );
+ d->m_textureLayer->downloadTile( i.next() );
}
tilesCount += tileIdSet.count();
}
--- trunk/KDE/kdeedu/marble/src/lib/TextureLayer.cpp #1202359:1202360
@@ -14,6 +14,8 @@
#include "TextureLayer.h"
#include "TextureLayer.moc"
+#include <QtCore/QTimer>
+
#include "SphericalScanlineTextureMapper.h"
#include "EquirectScanlineTextureMapper.h"
#include "MercatorScanlineTextureMapper.h"
@@ -198,6 +200,35 @@
connect( d->m_texmapper, SIGNAL( mapChanged() ), SIGNAL( modelChanged() ) );
}
+void TextureLayer::setVolatileCacheLimit( quint64 kilobytes )
+{
+ d->m_tileLoader.setVolatileCacheLimit( kilobytes );
+}
+
+void TextureLayer::update()
+{
+ mDebug() << "TextureLayer::update()";
+ QTimer::singleShot( 0, &d->m_tileLoader, SLOT( update() ) );
+}
+
+void TextureLayer::reload()
+{
+ QList<TileId> displayed = d->m_tileLoader.tilesOnDisplay();
+ QList<TileId>::const_iterator pos = displayed.constBegin();
+ QList<TileId>::const_iterator const end = displayed.constEnd();
+ for (; pos != end; ++pos ) {
+ // it's debatable here, whether DownloadBulk or DownloadBrowse should be used
+ // but since "reload" or "refresh" seems to be a common action of a browser and it
+ // allows for more connections (in our model), use "DownloadBrowse"
+ d->m_tileLoader.reloadTile( *pos, DownloadBrowse );
+ }
+}
+
+void TextureLayer::downloadTile( const TileId &tileId )
+{
+ d->m_tileLoader.downloadTile( tileId );
+}
+
void TextureLayer::setMapTheme(GeoSceneDocument* mapTheme)
{
d->m_mapTheme = mapTheme;
@@ -258,9 +289,9 @@
return d->textureLayer()->levelZeroRows();
}
-StackedTileLoader* TextureLayer::tileLoader()
+qint64 TextureLayer::volatileCacheLimit() const
{
- return &d->m_tileLoader;
+ return d->m_tileLoader.volatileCacheLimit();
}
void TextureLayer::paintTile( StackedTile* tile, const GeoSceneTexture *textureLayer )
--- trunk/KDE/kdeedu/marble/src/lib/TextureLayer.h #1202359:1202360
@@ -56,6 +56,14 @@
void setMapTheme( GeoSceneDocument* mapTheme );
+ void setVolatileCacheLimit( quint64 kilobytes );
+
+ void update();
+
+ void reload();
+
+ void downloadTile( const TileId &tileId );
+
/**
* @brief Return the current tile zoom level. For example for OpenStreetMap
* possible values are 1..18, for BlueMarble 0..6.
@@ -69,7 +77,7 @@
int levelZeroColumns() const;
int levelZeroRows() const;
- StackedTileLoader *tileLoader();
+ qint64 volatileCacheLimit() const;
Q_SIGNALS:
void tileLevelChanged( int );
More information about the Marble-commits
mailing list