@@ -753,7 +753,7 @@ void QgisApp::dropEvent( QDropEvent *event )
753753 }
754754 else if ( u.layerType == " raster" )
755755 {
756- addRasterLayer ( u.uri , u.name , u.providerKey , QStringList (), QStringList (), QString (), QString () );
756+ addRasterLayer ( u.uri , u.name , u.providerKey );
757757 }
758758 }
759759 }
@@ -2632,10 +2632,8 @@ void QgisApp::addWmsLayer()
26322632 QMessageBox::warning ( this , tr ( " WMS" ), tr ( " Cannot get WMS select dialog from provider." ) );
26332633 return ;
26342634 }
2635- connect ( wmss , SIGNAL ( addRasterLayer ( QString const &, QString const &, QString const &, QStringList const &, QStringList const &, QString const &,
2636- QString const & ) ),
2637- this , SLOT ( addRasterLayer ( QString const &, QString const &, QString const &, QStringList const &, QStringList const &, QString const &,
2638- QString const & ) ) );
2635+ connect ( wmss , SIGNAL ( addRasterLayer ( QString const &, QString const &, QString const & ) ),
2636+ this , SLOT ( addRasterLayer ( QString const &, QString const &, QString const & ) ) );
26392637 wmss->exec ();
26402638 delete wmss;
26412639}
@@ -6813,22 +6811,17 @@ QgsRasterLayer* QgisApp::addRasterLayer( QString const & rasterFile, QString con
68136811
68146812/* * Add a raster layer directly without prompting user for location
68156813 The caller must provide information compatible with the provider plugin
6816- using the rasterLayerPath and baseName. The provider can use these
6814+ using the uri and baseName. The provider can use these
68176815 parameters in any way necessary to initialize the layer. The baseName
68186816 parameter is used in the Map Legend so it should be formed in a meaningful
68196817 way.
68206818
68216819 \note Copied from the equivalent addVectorLayer function in this file
6822- TODO Make it work for rasters specifically.
68236820 */
68246821QgsRasterLayer* QgisApp::addRasterLayer (
6825- QString const &rasterLayerPath ,
6822+ QString const &uri ,
68266823 QString const &baseName,
6827- QString const &providerKey,
6828- QStringList const & layers,
6829- QStringList const & styles,
6830- QString const &format,
6831- QString const &crs )
6824+ QString const &providerKey )
68326825{
68336826 QgsDebugMsg ( " about to get library for " + providerKey );
68346827
@@ -6839,42 +6832,20 @@ QgsRasterLayer* QgisApp::addRasterLayer(
68396832
68406833 mMapCanvas ->freeze ();
68416834
6842- // Let render() do its own cursor management
6843- // QApplication::setOverrideCursor(Qt::WaitCursor);
6844-
68456835 // create the layer
68466836 QgsRasterLayer *layer;
6847- /* Eliminate the need to instantiate the layer based on provider type.
6848- The caller is responsible for cobbling together the needed information to
6849- open the layer
6850- */
6851- QgsDebugMsg ( " Creating new raster layer using " + rasterLayerPath
6852- + " with baseName of " + baseName
6853- + " and layer list of " + layers.join ( " , " )
6854- + " and style list of " + styles.join ( " , " )
6855- + " and format of " + format
6856- + " and providerKey of " + providerKey
6857- + " and CRS of " + crs );
6837+ QgsDebugMsg ( " Creating new raster layer using " + uri
6838+ + " with baseName of " + baseName );
68586839
6859- // TODO: Remove the 0 when the raster layer becomes a full provider gateway.
6860- layer = new QgsRasterLayer ( 0 , rasterLayerPath, baseName, providerKey, layers, styles, format, crs );
6840+ layer = new QgsRasterLayer ( uri, baseName, providerKey );
68616841
68626842 QgsDebugMsg ( " Constructed new layer." );
68636843
6864- if ( layer && shouldAskUserForGDALSublayers ( layer ) )
6865- {
6866- askUserForGDALSublayers ( layer );
6867-
6868- // The first layer loaded is not useful in that case. The user can select it in
6869- // the list if he wants to load it.
6870- delete layer;
6871- }
6872- else if ( layer && layer->isValid () )
6844+ if ( layer && layer->isValid () )
68736845 {
68746846 addRasterLayer ( layer );
68756847
68766848 statusBar ()->showMessage ( mMapCanvas ->extent ().toString ( 2 ) );
6877-
68786849 }
68796850 else
68806851 {
@@ -6889,10 +6860,6 @@ QgsRasterLayer* QgisApp::addRasterLayer(
68896860 mMapCanvas ->refresh ();
68906861
68916862 return layer;
6892-
6893- // Let render() do its own cursor management
6894- // QApplication::restoreOverrideCursor();
6895-
68966863} // QgisApp::addRasterLayer
68976864
68986865
0 commit comments