Skip to content

Commit

Permalink
implement #2702
Browse files Browse the repository at this point in the history
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 28a8c9c
Show file tree
Hide file tree
Showing 4 changed files with 364 additions and 210 deletions.
71 changes: 71 additions & 0 deletions src/app/qgswmssourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 );
Expand Down
Loading

0 comments on commit 28a8c9c

Please sign in to comment.