@@ -77,6 +77,9 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
77
77
mAddButton ->setEnabled ( false );
78
78
populateConnectionList ();
79
79
80
+ cbxIgnoreGetMap->setEnabled ( false );
81
+ cbxIgnoreGetFeatureInfo->setEnabled ( false );
82
+
80
83
QHBoxLayout *layout = new QHBoxLayout;
81
84
mImageFormatGroup = new QButtonGroup;
82
85
@@ -403,6 +406,49 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
403
406
lstLayers->expandItem ( lstLayers->topLevelItem ( 0 ) );
404
407
}
405
408
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\n is 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\n is 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
+
406
452
return true ;
407
453
}
408
454
@@ -513,6 +559,31 @@ void QgsWMSSourceSelect::addClicked()
513
559
}
514
560
}
515
561
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
+
516
587
QgisApp::instance ()->addRasterLayer ( connInfo,
517
588
leLayerName->text ().isEmpty () ? layers.join ( " /" ) : leLayerName->text (),
518
589
" wms" , layers, styles, format, crs );
0 commit comments