Skip to content

Commit

Permalink
wms provider: make smooth pixmap transformation in wmts optional (fol…
Browse files Browse the repository at this point in the history
…lowup 6604d2f)
  • Loading branch information
jef-n committed Apr 18, 2013
1 parent fc715d9 commit 105e45b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/gui/qgsmanageconnectionsdialog.cpp
Expand Up @@ -346,6 +346,7 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &
el.setAttribute( "ignoreAxisOrientation", settings.value( path + connections[i] + "/ignoreAxisOrientation", false ).toBool() ? "true" : "false" );
el.setAttribute( "invertAxisOrientation", settings.value( path + connections[i] + "/invertAxisOrientation", false ).toBool() ? "true" : "false" );
el.setAttribute( "referer", settings.value( path + connections[ i ] + "/referer", "" ).toString() );
el.setAttribute( "smoothPixmapTransform", settings.value( path + connections[i] + "/smoothPixmapTransform", false ).toBool() ? "true" : "false" );
}

path = "/Qgis/" + service.toUpper() + "/";
Expand Down Expand Up @@ -580,6 +581,7 @@ void QgsManageConnectionsDialog::loadOWSConnections( const QDomDocument &doc, co
settings.setValue( QString( "/" + connectionName + "/ignoreAxisOrientation" ), child.attribute( "ignoreAxisOrientation" ) == "true" );
settings.setValue( QString( "/" + connectionName + "/invertAxisOrientation" ), child.attribute( "invertAxisOrientation" ) == "true" );
settings.setValue( QString( "/" + connectionName + "/referer" ), child.attribute( "referer" ) );
settings.setValue( QString( "/" + connectionName + "/smoothPixmapTransform" ), child.attribute( "smoothPixmapTransform" ) == "true" );
settings.endGroup();

if ( !child.attribute( "username" ).isEmpty() )
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -55,6 +55,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(
cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() );
cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() );
cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );
cbxSmoothPixmapTransform->setChecked( settings.value( key + "/smoothPixmapTransform", false ).toBool() );

txtReferer->setText( settings.value( key + "/referer" ).toString() );

Expand Down Expand Up @@ -159,6 +160,7 @@ void QgsNewHttpConnection::accept()
settings.setValue( key + "/ignoreGetMapURI", cbxIgnoreGetMapURI->isChecked() );
settings.setValue( key + "/ignoreAxisOrientation", cbxIgnoreAxisOrientation->isChecked() );
settings.setValue( key + "/invertAxisOrientation", cbxInvertAxisOrientation->isChecked() );
settings.setValue( key + "/smoothPixmapTransform", cbxSmoothPixmapTransform->isChecked() );
}
if ( mBaseKey == "/Qgis/connections-wms/" )
{
Expand Down
8 changes: 8 additions & 0 deletions src/providers/wms/qgswmsconnection.cpp
Expand Up @@ -77,6 +77,7 @@ QgsWMSConnection::QgsWMSConnection( QString theConnName ) :
bool ignoreGetFeatureInfo = settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool();
bool ignoreAxisOrientation = settings.value( key + "/ignoreAxisOrientation", false ).toBool();
bool invertAxisOrientation = settings.value( key + "/invertAxisOrientation", false ).toBool();
bool smoothPixmapTransform = settings.value( key + "/smoothPixmapTransform", false ).toBool();

QString connArgs, delim;

Expand Down Expand Up @@ -109,6 +110,13 @@ QgsWMSConnection::QgsWMSConnection( QString theConnName ) :
mUri.setParam( "InvertAxisOrientation", "1" );
}

if ( smoothPixmapTransform )
{
connArgs += delim + "SmoothPixmapTransform";
delim = ";";
mUri.setParam( "SmoothPixmapTransform", "1" );
}

if ( !connArgs.isEmpty() )
{
connArgs.prepend( "ignoreUrl=" );
Expand Down
4 changes: 3 additions & 1 deletion src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -158,6 +158,7 @@ bool QgsWmsProvider::parseUri( QString uriString )
mIgnoreGetFeatureInfoUrl = uri.hasParam( "IgnoreGetFeatureInfoUrl" );
mIgnoreAxisOrientation = uri.hasParam( "IgnoreAxisOrientation" ); // must be before parsing!
mInvertAxisOrientation = uri.hasParam( "InvertAxisOrientation" ); // must be before parsing!
mSmoothPixmapTransform = uri.hasParam( "SmoothPixmapTransform" );

mUserName = uri.param( "username" );
QgsDebugMsg( "set username to " + mUserName );
Expand Down Expand Up @@ -1184,7 +1185,8 @@ void QgsWmsProvider::tileReplyFinished()
if ( !myLocalImage.isNull() )
{
QPainter p( mCachedImage );
p.setRenderHint( QPainter::SmoothPixmapTransform, true );
if ( mSmoothPixmapTransform )
p.setRenderHint( QPainter::SmoothPixmapTransform, true );
p.drawImage( dst, myLocalImage );
#if 0
myLocalImage.save( QString( "%1/%2-tile-%3.png" ).arg( QDir::tempPath() ).arg( mTileReqNo ).arg( tileNo ) );
Expand Down
1 change: 1 addition & 0 deletions src/providers/wms/qgswmsprovider.h
Expand Up @@ -1084,6 +1084,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
bool mIgnoreGetFeatureInfoUrl;
bool mIgnoreAxisOrientation;
bool mInvertAxisOrientation;
bool mSmoothPixmapTransform;

//! supported formats for GetFeatureInfo in order of preference
QStringList mSupportedGetFeatureFormats;
Expand Down
7 changes: 7 additions & 0 deletions src/ui/qgsnewhttpconnectionbase.ui
Expand Up @@ -162,6 +162,13 @@
</property>
</widget>
</item>
<item row="12" column="0" colspan="2">
<widget class="QCheckBox" name="cbxSmoothPixmapTransform">
<property name="text">
<string>Smooth pixmap transform</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="txtReferer"/>
</item>
Expand Down

0 comments on commit 105e45b

Please sign in to comment.