Skip to content

Commit 28a8c9c

Browse files
author
jef
committedMay 10, 2010
implement #2702
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13465 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4e19fa2 commit 28a8c9c

File tree

4 files changed

+364
-210
lines changed

4 files changed

+364
-210
lines changed
 

‎src/app/qgswmssourceselect.cpp

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
7777
mAddButton->setEnabled( false );
7878
populateConnectionList();
7979

80+
cbxIgnoreGetMap->setEnabled( false );
81+
cbxIgnoreGetFeatureInfo->setEnabled( false );
82+
8083
QHBoxLayout *layout = new QHBoxLayout;
8184
mImageFormatGroup = new QButtonGroup;
8285

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

409+
if ( wmsProvider->baseUrl() != wmsProvider->getMapUrl() )
410+
{
411+
if ( QMessageBox::information( this,
412+
tr( "WMS Provider" ),
413+
tr( "Advertised GetMap URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
414+
"This might be an server configuration error. Should the URL be used?" )
415+
.arg( wmsProvider->baseUrl() )
416+
.arg( wmsProvider->getMapUrl() ),
417+
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
418+
{
419+
cbxIgnoreGetMap->setChecked( false );
420+
}
421+
else
422+
{
423+
cbxIgnoreGetMap->setChecked( true );
424+
}
425+
cbxIgnoreGetMap->setEnabled( true );
426+
}
427+
else
428+
{
429+
cbxIgnoreGetMap->setEnabled( false );
430+
cbxIgnoreGetMap->setChecked( false );
431+
}
432+
433+
if ( wmsProvider->baseUrl() != wmsProvider->getFeatureInfoUrl() )
434+
{
435+
if ( QMessageBox::information( this,
436+
tr( "WMS Provider" ),
437+
tr( "Advertised GetFeatureInfo URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
438+
"This might be an server configuration error. Should the URL be used?" )
439+
.arg( wmsProvider->baseUrl() )
440+
.arg( wmsProvider->getFeatureInfoUrl() ),
441+
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
442+
{
443+
cbxIgnoreGetFeatureInfo->setChecked( false );
444+
}
445+
else
446+
{
447+
cbxIgnoreGetFeatureInfo->setChecked( true );
448+
}
449+
cbxIgnoreGetFeatureInfo->setEnabled( true );
450+
}
451+
406452
return true;
407453
}
408454

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

562+
if ( cbxIgnoreGetMap->isChecked() || cbxIgnoreGetFeatureInfo->isChecked() )
563+
{
564+
QString connArgs = "ignoreUrl=";
565+
566+
if ( cbxIgnoreGetMap->isChecked() )
567+
{
568+
connArgs += "GetMap";
569+
if ( cbxIgnoreGetFeatureInfo->isChecked() )
570+
connArgs += ";GetFeatureInfo";
571+
}
572+
else
573+
{
574+
connArgs += "GetFeatureInfo";
575+
}
576+
577+
if ( connInfo.startsWith( "username=" ) )
578+
{
579+
connInfo.prepend( connArgs + "," );
580+
}
581+
else
582+
{
583+
connInfo.prepend( connArgs + ",url=" );
584+
}
585+
}
586+
516587
QgisApp::instance()->addRasterLayer( connInfo,
517588
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
518589
"wms", layers, styles, format, crs );

0 commit comments

Comments
 (0)