Skip to content

Commit

Permalink
possibility to add WMS layers through plugin interface
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8593 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 5, 2008
1 parent 3e3d160 commit 41e4dea
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class QgisInterface : QObject
virtual QgsVectorLayer* addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)=0;
//! Add a raster layer given a raster layer file name
virtual QgsRasterLayer* addRasterLayer(QString rasterLayerPath, QString baseName = QString())=0;
//! Add a WMS layer
virtual QgsRasterLayer* addRasterLayer(const QString& url, const QString& layerName, const QString& providerKey, const QStringList& layers, const QStringList& styles, const QString& format, const QString& crs) = 0;

//! Add a project
virtual bool addProject(QString theProject)=0;
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5216,7 +5216,7 @@ QgsRasterLayer* QgisApp::addRasterLayer(QString const & rasterFile, QString cons
\note Copied from the equivalent addVectorLayer function in this file
TODO Make it work for rasters specifically.
*/
void QgisApp::addRasterLayer(QString const & rasterLayerPath,
QgsRasterLayer* QgisApp::addRasterLayer(QString const & rasterLayerPath,
QString const & baseName,
QString const & providerKey,
QStringList const & layers,
Expand All @@ -5232,7 +5232,7 @@ void QgisApp::addRasterLayer(QString const & rasterLayerPath,

if(mMapCanvas && mMapCanvas->isDrawing())
{
return;
return 0;
}

mMapCanvas->freeze();
Expand Down Expand Up @@ -5278,6 +5278,7 @@ void QgisApp::addRasterLayer(QString const & rasterLayerPath,
// draw the map
mMapCanvas->freeze(false);
mMapCanvas->refresh();
return layer;

// Let render() do its own cursor management
// QApplication::restoreOverrideCursor();
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class QgisApp : public QMainWindow
* Note this is included to support WMS layers only at this stage,
* GDAL layer support via a Provider is not yet implemented.
*/
void addRasterLayer(QString const & rasterLayerPath,
QgsRasterLayer* addRasterLayer(QString const & rasterLayerPath,
QString const & baseName,
QString const & providerKey,
QStringList const & layers,
Expand Down
6 changes: 6 additions & 0 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ QgsRasterLayer* QgisAppInterface::addRasterLayer(QString rasterLayerPath, QStrin
return qgis->addRasterLayer(rasterLayerPath, baseName);
}

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);
}


bool QgisAppInterface::addProject(QString theProjectName)
{
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgisappinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class QgisAppInterface : public QgisInterface
QgsVectorLayer* addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey);
//! Add a raster layer given its file name
QgsRasterLayer* addRasterLayer(QString rasterLayerPath, QString baseName);
//! Add a WMS layer
QgsRasterLayer* addRasterLayer(const QString& url, const QString& baseName, const QString& providerKey, \
const QStringList& layers, const QStringList& styles, const QString& format, const QString& crs);

//! Add a project
bool addProject(QString theProjectName);
Expand Down
3 changes: 3 additions & 0 deletions src/gui/qgisinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class GUI_EXPORT QgisInterface : public QObject
virtual QgsVectorLayer* addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)=0;
//! Add a raster layer given a raster layer file name
virtual QgsRasterLayer* addRasterLayer(QString rasterLayerPath, QString baseName = QString())=0;
//! Add a WMS layer
virtual QgsRasterLayer* addRasterLayer(const QString& url, const QString& layerName, const QString& providerKey, const QStringList& layers, \
const QStringList& styles, const QString& format, const QString& crs) = 0;

//! Add a project
virtual bool addProject(QString theProject)=0;
Expand Down

0 comments on commit 41e4dea

Please sign in to comment.