Skip to content
Permalink
Browse files
implement #2702
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13465 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 10, 2010
1 parent 4e19fa2 commit 28a8c9c6792ae68f9c48bcd7f3f0dac776ac17d5
@@ -77,6 +77,9 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
mAddButton->setEnabled( false );
populateConnectionList();

cbxIgnoreGetMap->setEnabled( false );
cbxIgnoreGetFeatureInfo->setEnabled( false );

QHBoxLayout *layout = new QHBoxLayout;
mImageFormatGroup = new QButtonGroup;

@@ -403,6 +406,49 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
lstLayers->expandItem( lstLayers->topLevelItem( 0 ) );
}

if ( wmsProvider->baseUrl() != wmsProvider->getMapUrl() )
{
if ( QMessageBox::information( this,
tr( "WMS Provider" ),
tr( "Advertised GetMap URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
"This might be an server configuration error. Should the URL be used?" )
.arg( wmsProvider->baseUrl() )
.arg( wmsProvider->getMapUrl() ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
{
cbxIgnoreGetMap->setChecked( false );
}
else
{
cbxIgnoreGetMap->setChecked( true );
}
cbxIgnoreGetMap->setEnabled( true );
}
else
{
cbxIgnoreGetMap->setEnabled( false );
cbxIgnoreGetMap->setChecked( false );
}

if ( wmsProvider->baseUrl() != wmsProvider->getFeatureInfoUrl() )
{
if ( QMessageBox::information( this,
tr( "WMS Provider" ),
tr( "Advertised GetFeatureInfo URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
"This might be an server configuration error. Should the URL be used?" )
.arg( wmsProvider->baseUrl() )
.arg( wmsProvider->getFeatureInfoUrl() ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
{
cbxIgnoreGetFeatureInfo->setChecked( false );
}
else
{
cbxIgnoreGetFeatureInfo->setChecked( true );
}
cbxIgnoreGetFeatureInfo->setEnabled( true );
}

return true;
}

@@ -513,6 +559,31 @@ void QgsWMSSourceSelect::addClicked()
}
}

if ( cbxIgnoreGetMap->isChecked() || cbxIgnoreGetFeatureInfo->isChecked() )
{
QString connArgs = "ignoreUrl=";

if ( cbxIgnoreGetMap->isChecked() )
{
connArgs += "GetMap";
if ( cbxIgnoreGetFeatureInfo->isChecked() )
connArgs += ";GetFeatureInfo";
}
else
{
connArgs += "GetFeatureInfo";
}

if ( connInfo.startsWith( "username=" ) )
{
connInfo.prepend( connArgs + "," );
}
else
{
connInfo.prepend( connArgs + ",url=" );
}
}

QgisApp::instance()->addRasterLayer( connInfo,
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
"wms", layers, styles, format, crs );

0 comments on commit 28a8c9c

Please sign in to comment.