Skip to content
Permalink
Browse files

wms provider: make smooth pixmap transformation in wmts optional (fol…

…lowup 6604d2f)
  • Loading branch information
jef-n committed Apr 18, 2013
1 parent fc715d9 commit 105e45be0edc983aa54c93e668094436799cce5f
@@ -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() + "/";
@@ -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() )
@@ -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() );

@@ -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/" )
{
@@ -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;

@@ -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=" );
@@ -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 );
@@ -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 ) );
@@ -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;
@@ -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>

0 comments on commit 105e45b

Please sign in to comment.
You can’t perform that action at this time.