[QGIS Commit] r15762 - in trunk/qgis: python/core src/app src/core
src/core/raster src/providers/wms
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Apr 18 16:54:50 EDT 2011
Author: jef
Date: 2011-04-18 13:54:50 -0700 (Mon, 18 Apr 2011)
New Revision: 15762
Modified:
trunk/qgis/python/core/qgsdataprovider.sip
trunk/qgis/src/app/qgisapp.cpp
trunk/qgis/src/app/qgisapp.h
trunk/qgis/src/app/qgisappinterface.cpp
trunk/qgis/src/app/qgswmssourceselect.cpp
trunk/qgis/src/app/qgswmssourceselect.h
trunk/qgis/src/core/qgsdataprovider.h
trunk/qgis/src/core/raster/qgsrasterlayer.cpp
trunk/qgis/src/core/raster/qgsrasterlayer.h
trunk/qgis/src/providers/wms/qgswmsprovider.cpp
trunk/qgis/src/providers/wms/qgswmsprovider.h
Log:
revert r15747
Modified: trunk/qgis/python/core/qgsdataprovider.sip
===================================================================
--- trunk/qgis/python/core/qgsdataprovider.sip 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/python/core/qgsdataprovider.sip 2011-04-18 20:54:50 UTC (rev 15762)
@@ -60,12 +60,6 @@
*/
virtual QgsRectangle extent() = 0;
- /**
- * Set the extent of the layer
- * @param extent the layer extent
- * @note added in 1.8
- */
- virtual void setExtent( QgsRectangle extent );
/**
* Returns true if this is a valid layer. It is up to individual providers
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/app/qgisapp.cpp 2011-04-18 20:54:50 UTC (rev 15762)
@@ -6278,8 +6278,7 @@
QStringList const & layers,
QStringList const & styles,
QString const &format,
- QString const &crs,
- QgsRectangle extent )
+ QString const &crs )
{
QgsDebugMsg( "about to get library for " + providerKey );
@@ -6308,7 +6307,7 @@
+ " and CRS of " + crs );
// TODO: Remove the 0 when the raster layer becomes a full provider gateway.
- layer = new QgsRasterLayer( 0, rasterLayerPath, baseName, providerKey, layers, styles, format, crs, extent );
+ layer = new QgsRasterLayer( 0, rasterLayerPath, baseName, providerKey, layers, styles, format, crs );
QgsDebugMsg( "Constructed new layer." );
Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/app/qgisapp.h 2011-04-18 20:54:50 UTC (rev 15762)
@@ -123,8 +123,7 @@
QStringList const & layers,
QStringList const & styles,
QString const & format,
- QString const & crs,
- QgsRectangle extent );
+ QString const & crs );
/** open a raster layer for the given file
@returns false if unable to open a raster layer for rasterFile
Modified: trunk/qgis/src/app/qgisappinterface.cpp
===================================================================
--- trunk/qgis/src/app/qgisappinterface.cpp 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/app/qgisappinterface.cpp 2011-04-18 20:54:50 UTC (rev 15762)
@@ -111,7 +111,7 @@
QgsRasterLayer* QgisAppInterface::addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey,
const QStringList& layers, const QStringList& styles, const QString& format, const QString& crs )
{
- return qgis->addRasterLayer( url, baseName, providerKey, layers, styles, format, crs, QgsRectangle() );
+ return qgis->addRasterLayer( url, baseName, providerKey, layers, styles, format, crs );
}
Modified: trunk/qgis/src/app/qgswmssourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgswmssourceselect.cpp 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/app/qgswmssourceselect.cpp 2011-04-18 20:54:50 UTC (rev 15762)
@@ -53,7 +53,6 @@
QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
: QDialog( parent, fl )
- , mWmsProvider( 0 )
, mCurrentTileset( 0 )
{
setupUi( this );
@@ -164,10 +163,9 @@
QSettings settings;
QgsDebugMsg( "saving geometry" );
settings.setValue( "/Windows/WMSSourceSelect/geometry", saveGeometry() );
-
- delete mWmsProvider;
}
+
void QgsWMSSourceSelect::populateConnectionList()
{
QSettings settings;
@@ -283,12 +281,12 @@
return item;
}
-bool QgsWMSSourceSelect::populateLayerList()
+bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
{
mCRSs.clear();
QVector<QgsWmsLayerProperty> layers;
- if ( !mWmsProvider->supportedLayers( layers ) )
+ if ( !wmsProvider->supportedLayers( layers ) )
return false;
foreach( QAbstractButton *b, mImageFormatGroup->buttons() )
@@ -296,7 +294,7 @@
b->setHidden( true );
}
- foreach( QString encoding, mWmsProvider->supportedImageEncodings() )
+ foreach( QString encoding, wmsProvider->supportedImageEncodings() )
{
int id = mMimeMap.value( encoding, -1 );
if ( id < 0 )
@@ -313,7 +311,7 @@
QMap<int, QgsNumericSortTreeWidgetItem *> items;
QMap<int, int> layerParents;
QMap<int, QStringList> layerParentNames;
- mWmsProvider->layerParents( layerParents, layerParentNames );
+ wmsProvider->layerParents( layerParents, layerParentNames );
lstLayers->clear();
lstLayers->setSortingEnabled( true );
@@ -350,7 +348,7 @@
lstLayers->sortByColumn( 0, Qt::AscendingOrder );
QVector<QgsWmsTileSetProfile> tilesets;
- mWmsProvider->supportedTileSets( tilesets );
+ wmsProvider->supportedTileSets( tilesets );
tabServers->setTabEnabled( tabServers->indexOf( tabTilesets ), tilesets.size() > 0 );
if ( tabServers->isTabEnabled( tabServers->indexOf( tabTilesets ) ) )
@@ -474,23 +472,24 @@
// load the server data provider plugin
QgsProviderRegistry * pReg = QgsProviderRegistry::instance();
- delete mWmsProvider;
+ QgsWmsProvider *wmsProvider =
+ ( QgsWmsProvider* ) pReg->getProvider( "wms", mConnectionInfo );
- mWmsProvider = static_cast< QgsWmsProvider * >( pReg->getProvider( "wms", mConnectionInfo ) );
-
- if ( mWmsProvider )
+ if ( wmsProvider )
{
QApplication::setOverrideCursor( Qt::WaitCursor );
- connect( mWmsProvider, SIGNAL( statusChanged( QString ) ), this, SLOT( showStatusMessage( QString ) ) );
+ connect( wmsProvider, SIGNAL( statusChanged( QString ) ), this, SLOT( showStatusMessage( QString ) ) );
// WMS Provider all set up; let's get some layers
- if ( !populateLayerList() )
+ if ( !populateLayerList( wmsProvider ) )
{
- showError();
+ showError( wmsProvider );
}
+ delete wmsProvider;
+
QApplication::restoreOverrideCursor();
}
else
@@ -541,14 +540,9 @@
}
}
- // set the layers to retrieve the correct extent
- mWmsProvider->addLayers( layers, styles );
- mWmsProvider->setImageEncoding( format );
- mWmsProvider->setImageCrs( crs );
-
QgisApp::instance()->addRasterLayer( connInfo,
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
- "wms", layers, styles, format, crs, mWmsProvider->extent() );
+ "wms", layers, styles, format, crs );
}
void QgsWMSSourceSelect::enableLayersForCrs( QTreeWidgetItem *item )
@@ -1001,18 +995,18 @@
}
-void QgsWMSSourceSelect::showError()
+void QgsWMSSourceSelect::showError( QgsWmsProvider * wms )
{
QgsMessageViewer * mv = new QgsMessageViewer( this );
- mv->setWindowTitle( mWmsProvider->lastErrorTitle() );
+ mv->setWindowTitle( wms->lastErrorTitle() );
- if ( mWmsProvider->lastErrorFormat() == "text/html" )
+ if ( wms->lastErrorFormat() == "text/html" )
{
- mv->setMessageAsHtml( mWmsProvider->lastError() );
+ mv->setMessageAsHtml( wms->lastError() );
}
else
{
- mv->setMessageAsPlainText( tr( "Could not understand the response. The %1 provider said:\n%2" ).arg( mWmsProvider->name() ).arg( mWmsProvider->lastError() ) );
+ mv->setMessageAsPlainText( tr( "Could not understand the response. The %1 provider said:\n%2" ).arg( wms->name() ).arg( wms->lastError() ) );
}
mv->showMessage( true ); // Is deleted when closed
}
Modified: trunk/qgis/src/app/qgswmssourceselect.h
===================================================================
--- trunk/qgis/src/app/qgswmssourceselect.h 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/app/qgswmssourceselect.h 2011-04-18 20:54:50 UTC (rev 15762)
@@ -21,7 +21,6 @@
#include "ui_qgswmssourceselectbase.h"
#include "qgisgui.h"
#include "qgscontexthelp.h"
-#include "qgsrectangle.h"
#include <QStringList>
#include <QPushButton>
@@ -85,7 +84,7 @@
void showStatusMessage( QString const &theMessage );
//! show whatever error is exposed by the QgsWmsProvider.
- void showError();
+ void showError( QgsWmsProvider *wms );
//! Stores the selected datasource whenerver it is changed
void on_cmbConnections_activated( int );
@@ -144,7 +143,7 @@
* \retval false if the layers could not be retrieved or parsed -
* see mWmsProvider->errorString() for more info
*/
- bool populateLayerList();
+ bool populateLayerList( QgsWmsProvider *wmsProvider );
//! create an item including possible parents
QgsNumericSortTreeWidgetItem *createItem( int id,
@@ -187,7 +186,6 @@
QString selectedImageEncoding();
QList<QTreeWidgetItem*> mCurrentSelection;
- QgsWmsProvider *mWmsProvider;
QTableWidgetItem* mCurrentTileset;
private slots:
Modified: trunk/qgis/src/core/qgsdataprovider.h
===================================================================
--- trunk/qgis/src/core/qgsdataprovider.h 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/core/qgsdataprovider.h 2011-04-18 20:54:50 UTC (rev 15762)
@@ -22,8 +22,7 @@
#include <QString>
#include <QStringList>
-#include <qgsrectangle.h>
-
+class QgsRectangle;
class QgsCoordinateReferenceSystem;
@@ -91,15 +90,6 @@
*/
virtual QgsRectangle extent() = 0;
- /**
- * Set the extent of the layer
- * @param extent the layer extent
- * @note added in 1.8
- */
- virtual void setExtent( QgsRectangle extent )
- {
- // NOP by default
- }
/**
* Returns true if this is a valid layer. It is up to individual providers
Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2011-04-18 20:54:50 UTC (rev 15762)
@@ -99,7 +99,7 @@
// TODO, call constructor with provider key for now
init();
- setDataProvider( "gdal", QStringList(), QStringList(), QString(), QString(), loadDefaultStyleFlag, QgsRectangle() );
+ setDataProvider( "gdal", QStringList(), QStringList(), QString(), QString(), loadDefaultStyleFlag );
return;
@@ -116,8 +116,7 @@
QStringList const & layers,
QStringList const & styles,
QString const & format,
- QString const & crs,
- QgsRectangle extent )
+ QString const & crs )
: QgsMapLayer( RasterLayer, baseName, rasterLayerPath )
, mStandardDeviations( 0 )
, mDataProvider( 0 )
@@ -140,7 +139,7 @@
init();
// if we're given a provider type, try to create and bind one to this layer
bool loadDefaultStyleFlag = false ; // ???
- setDataProvider( providerKey, layers, styles, format, crs, loadDefaultStyleFlag, extent );
+ setDataProvider( providerKey, layers, styles, format, crs, loadDefaultStyleFlag );
// Default for the popup menu
// TODO: popMenu = 0;
@@ -2251,7 +2250,7 @@
QString const & format,
QString const & crs )
{
- setDataProvider( provider, layers, styles, format, crs, false, QgsRectangle() );
+ setDataProvider( provider, layers, styles, format, crs, false );
}
/** Copied from QgsVectorLayer::setDataProvider
@@ -2262,8 +2261,7 @@
QStringList const & styles,
QString const & format,
QString const & crs,
- bool loadDefaultStyleFlag,
- QgsRectangle extent )
+ bool loadDefaultStyleFlag )
{
// XXX should I check for and possibly delete any pre-existing providers?
// XXX How often will that scenario occur?
@@ -2287,6 +2285,7 @@
return;
}
+
QgsDebugMsg( "Instantiated the data provider plugin"
+ QString( " with layer list of " ) + layers.join( ", " )
+ " and style list of " + styles.join( ", " )
@@ -2303,18 +2302,8 @@
setNoDataValue( mDataProvider->noDataValue() );
- QgsRectangle mbr;
- if ( mDataProvider && !extent.isEmpty() )
- {
- // set the extent
- mDataProvider->setExtent( extent );
- mbr = extent;
- }
- else
- {
- // get the extent
- mbr = mDataProvider->extent();
- }
+ // get the extent
+ QgsRectangle mbr = mDataProvider->extent();
// show the extent
QString s = mbr.toString();
@@ -4468,7 +4457,6 @@
bool QgsRasterLayer::update()
{
QgsDebugMsg( "entered." );
-
// Check if data changed
if ( mDataProvider->dataTimestamp() > mDataProvider->timestamp() )
{
Modified: trunk/qgis/src/core/raster/qgsrasterlayer.h
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.h 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.h 2011-04-18 20:54:50 UTC (rev 15762)
@@ -207,8 +207,7 @@
const QStringList & layers = QStringList(),
const QStringList & styles = QStringList(),
const QString & format = QString(),
- const QString & crs = QString(),
- const QgsRectangle extent = QgsRectangle() );
+ const QString & crs = QString() );
/** \brief The destructor */
@@ -313,8 +312,7 @@
const QStringList & styles,
const QString & format,
const QString & crs,
- bool loadDefaultStyleFlag,
- QgsRectangle extent );
+ bool loadDefaultStyleFlag );
static QLibrary* loadProviderLibrary( QString theProviderKey );
static QgsRasterDataProvider* loadProvider( QString theProviderKey, QString theDataSource = 0 );
Modified: trunk/qgis/src/providers/wms/qgswmsprovider.cpp
===================================================================
--- trunk/qgis/src/providers/wms/qgswmsprovider.cpp 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/providers/wms/qgswmsprovider.cpp 2011-04-18 20:54:50 UTC (rev 15762)
@@ -899,7 +899,7 @@
QNetworkRequest request( url );
setAuthorization( request );
- request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, forceRefresh ? QNetworkRequest::PreferNetwork : QNetworkRequest::PreferCache );
+ request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork );
request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true );
QgsDebugMsg( QString( "getcapabilities: %1" ).arg( url ) );
@@ -978,9 +978,6 @@
return;
}
- QgsDebugMsg( QString( "getcapabilities from cache: %1" )
- .arg( mCapabilitiesReply->attribute( QNetworkRequest::SourceIsFromCacheAttribute ).toBool() ? "yes" : "no" ) );
-
httpcapabilitiesresponse = mCapabilitiesReply->readAll();
if ( httpcapabilitiesresponse.isEmpty() )
@@ -2031,12 +2028,8 @@
QgsDebugMsg( "exiting." );
}
-void QgsWmsProvider::setExtent( QgsRectangle extent )
-{
- layerExtent = extent;
- extentDirty = false;
-}
+
QgsRectangle QgsWmsProvider::extent()
{
if ( extentDirty )
@@ -2177,6 +2170,7 @@
QgsDebugMsg( "exiting with '" + layerExtent.toString() + "'." );
return true;
+
}
Modified: trunk/qgis/src/providers/wms/qgswmsprovider.h
===================================================================
--- trunk/qgis/src/providers/wms/qgswmsprovider.h 2011-04-18 20:40:50 UTC (rev 15761)
+++ trunk/qgis/src/providers/wms/qgswmsprovider.h 2011-04-18 20:54:50 UTC (rev 15762)
@@ -464,11 +464,6 @@
//void readBlock( int bandNo, QgsRectangle const & viewExtent, int width, int height, QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, void *data );
- /**
- * preset the extent to prevent and extra GetCapabilities request
- */
- virtual void setExtent( QgsRectangle extent );
-
/** Return the extent for this data layer
*/
virtual QgsRectangle extent();
More information about the QGIS-commit
mailing list