Commit 1a47a384 authored by Bernhard Beschow's avatar Bernhard Beschow
Browse files

improve map quality when map width != height

Whenever the width and height of a map differ, choose the smaller one for calculating the visible tile level.
As a result, the tile level is increased earlier, leading to higher-resolution results.

Tested with the schangen1689 map theme.

CCMAIL: helmut.muelner@joanneum.at
parent ce38288d
......@@ -155,18 +155,21 @@ void TextureLayer::paintGlobe( GeoPainter *painter,
if ( !d->m_texmapper )
return;
// As our tile resolution doubles with each level we calculate
// the tile level from tilesize and the globe radius via log(2)
// choose the smaller dimension for selecting the tile level, leading to higher-resolution results
const int levelZeroWidth = d->m_tileLoader.tileSize().width() * d->m_tileLoader.tileColumnCount( 0 );
const int levelZeroHight = d->m_tileLoader.tileSize().height() * d->m_tileLoader.tileRowCount( 0 );
const int levelZeroMinDimension = ( levelZeroWidth < levelZeroHight ) ? levelZeroWidth : levelZeroHight;
qreal linearLevel = ( 4.0 * (qreal)( viewParams->radius() )
/ (qreal)( d->m_tileLoader.tileSize().width() * d->m_tileLoader.tileColumnCount( 0 ) ) );
int tileLevel = 0;
qreal linearLevel = ( 4.0 * (qreal)( viewParams->radius() ) / (qreal)( levelZeroMinDimension ) );
if ( linearLevel < 1.0 )
linearLevel = 1.0; // Dirty fix for invalid entry linearLevel
// As our tile resolution doubles with each level we calculate
// the tile level from tilesize and the globe radius via log(2)
qreal tileLevelF = log( linearLevel ) / log( 2.0 );
tileLevel = (int)( tileLevelF );
int tileLevel = (int)( tileLevelF );
// mDebug() << "tileLevelF: " << tileLevelF << " tileLevel: " << tileLevel;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment