marble
TileScalingTextureMapper.cpp
Go to the documentation of this file.
34 TileScalingTextureMapper::TileScalingTextureMapper( StackedTileLoader *tileLoader, QObject *parent )
58 const QImage::Format optimalFormat = ScanlineTextureMapperContext::optimalCanvasImageFormat( viewport );
86 void TileScalingTextureMapper::mapTexture( GeoPainter *painter, const ViewportParams *viewport, int tileZoomLevel, TextureColorizer *texColorizer )
112 const int minTileY = qMax( qreal( numTilesY * ( yNormalizedCenter - imageHeight/( 8.0 * radius ) ) ),
114 const int maxTileY = qMin( qreal( numTilesY * ( yNormalizedCenter + imageHeight/( 8.0 * radius ) ) ),
127 const qreal xLeft = ( 4.0 * radius ) * ( ( tileX ) / (qreal)numTilesX - xNormalizedCenter ) + ( imageWidth / 2.0 );
128 const qreal xRight = ( 4.0 * radius ) * ( ( tileX + 1 ) / (qreal)numTilesX - xNormalizedCenter ) + ( imageWidth / 2.0 );
129 const qreal yTop = ( 4.0 * radius ) * ( ( tileY ) / (qreal)numTilesY - yNormalizedCenter ) + ( imageHeight / 2.0 );
130 const qreal yBottom = ( 4.0 * radius ) * ( ( tileY + 1 ) / (qreal)numTilesY - yNormalizedCenter ) + ( imageHeight / 2.0 );
133 const TileId stackedId = TileId( 0, tileZoomLevel, ( ( tileX % numTilesX ) + numTilesX ) % numTilesX, tileY );
145 const QImage part = toScale->copy( startX, startY, partWidth, partHeight ).scaled( toScale->size() );
160 const qreal xLeft = ( 4.0 * radius ) * ( ( tileX ) / (qreal)numTilesX - xNormalizedCenter ) + ( imageWidth / 2.0 );
161 const qreal xRight = ( 4.0 * radius ) * ( ( tileX + 1 ) / (qreal)numTilesX - xNormalizedCenter ) + ( imageWidth / 2.0 );
162 const qreal yTop = ( 4.0 * radius ) * ( ( tileY ) / (qreal)numTilesY - yNormalizedCenter ) + ( imageHeight / 2.0 );
163 const qreal yBottom = ( 4.0 * radius ) * ( ( tileY + 1 ) / (qreal)numTilesY - yNormalizedCenter ) + ( imageHeight / 2.0 );
166 const TileId stackedId = TileId( 0, tileZoomLevel, ( ( tileX % numTilesX ) + numTilesX ) % numTilesX, tileY );
167 const StackedTile *const tile = m_tileLoader->loadTile( stackedId ); // load tile here for every frame, otherwise cleanupTilehash() clears all visible tiles
169 const QSize size = QSize( qRound( rect.right() - rect.left() ), qRound( rect.bottom() - rect.top() ) );
171 const TileId cacheId = TileId( cacheHash, stackedId.zoomLevel(), stackedId.x(), stackedId.y() );
184 const QImage part = toScale->copy( startX, startY, partWidth, partHeight ).scaled( toScale->size() );
186 im = new QPixmap( QPixmap::fromImage( part.scaled( size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ) );
int width() const
void setRenderHint(RenderHint hint, bool on)
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:98
void colorize(QImage *origimg, const ViewportParams *viewport, MapQuality mapQuality)
Definition: TextureColorizer.cpp:228
void save()
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
qreal top() const
QImage copy(const QRect &rectangle) const
qreal left() const
A single tile that consists of a stack of Tile layers.
Definition: StackedTile.h:56
qreal bottom() const
void fill(uint pixelValue)
int width() const
bool mapCoversViewport() const
Definition: ViewportParams.cpp:398
static QImage::Format optimalCanvasImageFormat(const ViewportParams *viewport)
Definition: ScanlineTextureMapperContext.cpp:429
QPointF topLeft() const
virtual void mapTexture(GeoPainter *painter, const ViewportParams *viewport, int tileZoomLevel, const QRect &dirtyRect, TextureColorizer *texColorizer)
Definition: TileScalingTextureMapper.cpp:47
QImage const * resultImage() const
Returns the QImage that describes the merged stack of Tiles.
Definition: StackedTile.cpp:262
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
qreal right() const
void drawImage(const GeoDataCoordinates ¢erPosition, const QImage &image)
Draws an image at the given position. The image is placed with its center located at the given center...
Definition: GeoPainter.cpp:428
Definition: TextureColorizer.h:33
This file contains the headers for ViewportParams.
int tileColumnCount(int level) const
Definition: StackedTileLoader.cpp:70
int tileRowCount(int level) const
Definition: StackedTileLoader.cpp:75
qreal centerLatitude() const
Definition: ViewportParams.cpp:294
void restore()
bool m_repaintNeeded
Definition: TextureMapperInterface.h:42
Definition: TileId.h:27
qreal centerLongitude() const
Definition: ViewportParams.cpp:289
int height() const
QSize size() const
TileScalingTextureMapper(StackedTileLoader *tileLoader, QObject *parent=0)
Definition: TileScalingTextureMapper.cpp:34
int height() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Format format() const
void drawPixmap(const GeoDataCoordinates ¢erPosition, const QPixmap &pixmap)
Draws a pixmap at the given position. The pixmap is placed with its center located at the given cente...
Definition: GeoPainter.cpp:452
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
const StackedTile * loadTile(TileId const &stackedTileId)
Loads a tile and returns it.
Definition: StackedTileLoader.cpp:118
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.