[Marble-commits] KDE/kdeedu/marble/src/lib
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Sat Dec 18 13:15:22 CET 2010
SVN commit 1207517 by beschow:
use a TileLoader rather than a StackedTileLoader in MergedLayerDecorator
* removes forMergedLayerDecorator flag from StackedTileLoader::loadTile()
* removes StackedTile::{forMergedLayerDecorator(), setForMergedLayerDecorator()} and associated attribute
M +10 -11 MergedLayerDecorator.cpp
M +4 -4 MergedLayerDecorator.h
M +1 -12 StackedTile.cpp
M +0 -3 StackedTile.h
M +1 -5 StackedTileLoader.cpp
M +1 -2 StackedTileLoader.h
M +0 -1 StackedTile_p.h
M +1 -1 SunLocator.cpp
M +1 -1 SunLocator.h
M +1 -1 TextureLayer.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MergedLayerDecorator.cpp #1207516:1207517
@@ -32,13 +32,15 @@
#include "Planet.h"
#include "TileCreator.h"
#include "TileCreatorDialog.h"
+#include "TileLoader.h"
#include <QtGui/QPainter>
#include <QtCore/QPointer>
+#include "TextureTile.h"
using namespace Marble;
-MergedLayerDecorator::MergedLayerDecorator( StackedTileLoader * const tileLoader,
+MergedLayerDecorator::MergedLayerDecorator( TileLoader * const tileLoader,
SunLocator* sunLocator )
: m_tileLoader( tileLoader ),
m_tile( 0 ),
@@ -66,7 +68,7 @@
QString sourceDir = texture->sourceDir();
QString installMap = texture->installMap();
- if ( !m_tileLoader->baseTilesAvailable( layer ) ) {
+ if ( !StackedTileLoader::baseTilesAvailable( layer ) ) {
TileCreator *tileCreator = new TileCreator(
sourceDir,
installMap,
@@ -120,12 +122,11 @@
return m_showTileId;
}
-StackedTile * MergedLayerDecorator::loadDataset( GeoSceneTexture *textureLayer )
+QImage MergedLayerDecorator::loadDataset()
{
- const TileId decorationTileId( textureLayer->sourceDir(), m_id.zoomLevel(), m_id.x(), m_id.y());
- StackedTile * const tile = m_tileLoader->loadTile( decorationTileId, DownloadBrowse, true );
- tile->setUsed( true );
- return tile;
+ const TileId decorationTileId( m_cityLightsTextureLayer->sourceDir(), m_id.zoomLevel(), m_id.x(), m_id.y());
+ QImage image = *m_tileLoader->loadTile( decorationTileId, decorationTileId, DownloadBrowse )->image();
+ return image;
}
void MergedLayerDecorator::paintSunShading()
@@ -153,17 +154,15 @@
//Don't use city lights on non-earth planets!
if ( m_sunLocator->getCitylights() && m_sunLocator->planet()->id() == "earth" ) {
- StackedTile * tile = loadDataset( m_cityLightsTextureLayer );
+ const QImage nighttile = loadDataset();
- QImage * nighttile = tile->resultTile();
-
for ( int cur_y = 0; cur_y < tileHeight; ++cur_y ) {
qreal lat = lat_scale * ( m_id.y() * tileHeight + cur_y ) - 0.5*M_PI;
qreal a = sin( ( lat+DEG2RAD * m_sunLocator->getLat() )/2.0 );
qreal c = cos(lat)*cos( -DEG2RAD * m_sunLocator->getLat() );
QRgb* scanline = (QRgb*)m_tile->scanLine( cur_y );
- QRgb* nscanline = (QRgb*)nighttile->scanLine( cur_y );
+ const QRgb* nscanline = (QRgb*)nighttile.scanLine( cur_y );
qreal shade = 0;
qreal lastShade = -10.0;
--- trunk/KDE/kdeedu/marble/src/lib/MergedLayerDecorator.h #1207516:1207517
@@ -31,14 +31,14 @@
class GeoSceneTexture;
class SunLocator;
class StackedTile;
-class StackedTileLoader;
+class TileLoader;
class MergedLayerDecorator : public QObject
{
Q_OBJECT
public:
- MergedLayerDecorator( StackedTileLoader * const tileLoader, SunLocator* sunLocator );
+ MergedLayerDecorator( TileLoader * const tileLoader, SunLocator* sunLocator );
virtual ~MergedLayerDecorator();
// The Parameter themeId is only used for displaying the TileId,
@@ -56,7 +56,7 @@
void repaintMap();
private:
- StackedTile * loadDataset( GeoSceneTexture *textureLayer );
+ QImage loadDataset();
int maxDivisor( int maximum, int fullLength );
void initCityLights();
@@ -66,7 +66,7 @@
protected:
Q_DISABLE_COPY( MergedLayerDecorator )
- StackedTileLoader * const m_tileLoader;
+ TileLoader * const m_tileLoader;
QImage* m_tile;
TileId m_id;
SunLocator* m_sunLocator;
--- trunk/KDE/kdeedu/marble/src/lib/StackedTile.cpp #1207516:1207517
@@ -63,8 +63,7 @@
m_resultTile(),
m_byteCount(0),
m_depth(0),
- m_isGrayscale( false ),
- m_forMergedLayerDecorator( false )
+ m_isGrayscale( false )
{
}
@@ -254,16 +253,6 @@
return result;
}
-bool StackedTile::forMergedLayerDecorator() const
-{
- return d->m_forMergedLayerDecorator;
-}
-
-void StackedTile::setForMergedLayerDecorator()
-{
- d->m_forMergedLayerDecorator = true;
-}
-
void StackedTile::initJumpTables()
{
// mDebug() << "Entered initJumpTables( bool ) of Tile" << d->m_id;
--- trunk/KDE/kdeedu/marble/src/lib/StackedTile.h #1207516:1207517
@@ -69,9 +69,6 @@
int numBytes() const;
bool isExpired() const;
- bool forMergedLayerDecorator() const;
- void setForMergedLayerDecorator();
-
/*!
\brief Returns the stack of TextureTiles
\return A non-zero pointer to the container of TextureTile objects.
--- trunk/KDE/kdeedu/marble/src/lib/StackedTileLoader.cpp #1207516:1207517
@@ -167,8 +167,7 @@
d->m_tilesOnDisplay.clear();
}
-StackedTile* StackedTileLoader::loadTile( TileId const & stackedTileId, DownloadUsage const usage,
- bool const forMergedLayerDecorator )
+StackedTile* StackedTileLoader::loadTile( TileId const & stackedTileId, DownloadUsage const usage )
{
// check if the tile is in the hash
StackedTile * stackedTile = d->m_tilesOnDisplay.value( stackedTileId, 0 );
@@ -218,8 +217,6 @@
Q_ASSERT( !tiles.isEmpty() );
stackedTile = new StackedTile( stackedTileId, tiles );
- if ( forMergedLayerDecorator )
- stackedTile->setForMergedLayerDecorator();
d->m_tilesOnDisplay[ stackedTileId ] = stackedTile;
stackedTile->initResultTile();
mergeDecorations( stackedTile );
@@ -491,7 +488,6 @@
void StackedTileLoader::mergeDecorations( StackedTile * const tile ) const
{
Q_ASSERT( !tile->resultTile()->isNull() );
- if ( !tile->forMergedLayerDecorator() )
d->m_parent->paintTile( tile );
}
--- trunk/KDE/kdeedu/marble/src/lib/StackedTileLoader.h #1207516:1207517
@@ -80,8 +80,7 @@
* @param stackedTileId The Id of the requested tile, containing the x and y coordinate
* and the zoom level.
*/
- StackedTile* loadTile( TileId const &stackedTileId, DownloadUsage const,
- bool const forMergedLayerDecorator = false );
+ StackedTile* loadTile( TileId const &stackedTileId, DownloadUsage const );
StackedTile* reloadTile( TileId const & stackedTileId, DownloadUsage const );
void downloadTile( TileId const & stackedTileId );
--- trunk/KDE/kdeedu/marble/src/lib/StackedTile_p.h #1207516:1207517
@@ -41,7 +41,6 @@
int m_depth;
bool m_isGrayscale;
- bool m_forMergedLayerDecorator;
explicit StackedTilePrivate( const TileId& id );
virtual ~StackedTilePrivate();
--- trunk/KDE/kdeedu/marble/src/lib/SunLocator.cpp #1207516:1207517
@@ -203,7 +203,7 @@
}
}
-void SunLocator::shadePixelComposite(QRgb& pixcol, QRgb& dpixcol,
+void SunLocator::shadePixelComposite(QRgb& pixcol, const QRgb& dpixcol,
qreal brightness) const
{
// daylight - no change
--- trunk/KDE/kdeedu/marble/src/lib/SunLocator.h #1207516:1207517
@@ -45,7 +45,7 @@
qreal shading(qreal lon, qreal a, qreal c) const;
void shadePixel(QRgb& pixcol, qreal shade) const;
- void shadePixelComposite(QRgb& pixcol, QRgb& dpixcol, qreal shade) const;
+ void shadePixelComposite(QRgb& pixcol, const QRgb& dpixcol, qreal shade) const;
void setShow(bool show);
void setCitylights(bool show);
--- trunk/KDE/kdeedu/marble/src/lib/TextureLayer.cpp #1207516:1207517
@@ -65,7 +65,7 @@
, m_texcolorizer()
, m_loader( downloadManager )
, m_tileLoader( mapThemeManager, &m_loader, parent )
- , m_layerDecorator( &m_tileLoader, sunLocator )
+ , m_layerDecorator( &m_loader, sunLocator )
, m_veccomposer( parent )
, m_texmapper( 0 )
, m_mapTheme( 0 )
More information about the Marble-commits
mailing list