2012-05-18 19:35:43 +02:00
|
|
|
/***************************************************************************
|
|
|
|
qgswmsdataitems.h
|
|
|
|
---------------------
|
|
|
|
begin : October 2011
|
|
|
|
copyright : (C) 2011 by Martin Dobias
|
2012-10-08 00:29:13 +02:00
|
|
|
email : wonder dot sk at gmail dot com
|
2012-05-18 19:35:43 +02:00
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
2011-10-13 21:17:05 -03:00
|
|
|
#ifndef QGSWMSDATAITEMS_H
|
|
|
|
#define QGSWMSDATAITEMS_H
|
|
|
|
|
2011-10-18 23:02:09 -03:00
|
|
|
#include "qgsdataitem.h"
|
2016-08-31 16:37:05 +08:00
|
|
|
#include "qgsdataitemprovider.h"
|
2012-06-14 11:40:07 +02:00
|
|
|
#include "qgsdatasourceuri.h"
|
2011-10-13 21:17:05 -03:00
|
|
|
#include "qgswmsprovider.h"
|
2017-08-07 02:24:12 +07:00
|
|
|
#include "qgsgeonodeconnection.h"
|
2011-10-13 21:17:05 -03:00
|
|
|
|
2015-08-27 12:36:36 +02:00
|
|
|
class QgsWmsCapabilitiesDownload;
|
|
|
|
|
2011-10-13 21:17:05 -03:00
|
|
|
class QgsWMSConnectionItem : public QgsDataCollectionItem
|
|
|
|
{
|
2011-10-13 21:28:37 -03:00
|
|
|
Q_OBJECT
|
2011-10-13 21:17:05 -03:00
|
|
|
public:
|
2017-03-03 08:42:00 +01:00
|
|
|
QgsWMSConnectionItem( QgsDataItem *parent, QString name, QString path, QString uri );
|
2017-12-15 08:57:22 +10:00
|
|
|
~QgsWMSConnectionItem() override;
|
2011-10-13 21:17:05 -03:00
|
|
|
|
2017-03-03 08:42:00 +01:00
|
|
|
QVector<QgsDataItem *> createChildren() override;
|
2017-12-15 08:57:22 +10:00
|
|
|
bool equal( const QgsDataItem *other ) override;
|
2011-10-13 21:17:05 -03:00
|
|
|
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2017-12-15 08:57:22 +10:00
|
|
|
QList<QAction *> actions( QWidget *parent ) override;
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2011-10-13 21:28:37 -03:00
|
|
|
|
|
|
|
public slots:
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2011-10-13 21:28:37 -03:00
|
|
|
void editConnection();
|
|
|
|
void deleteConnection();
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2017-12-15 08:57:22 +10:00
|
|
|
void deleteLater() override;
|
2014-11-10 19:39:55 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString mUri;
|
2017-02-18 18:09:47 +10:00
|
|
|
QgsWmsCapabilitiesDownload *mCapabilitiesDownload = nullptr;
|
2011-10-13 21:17:05 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
// WMS Layers may be nested, so that they may be both QgsDataCollectionItem and QgsLayerItem
|
|
|
|
// We have to use QgsDataCollectionItem and support layer methods if necessary
|
|
|
|
class QgsWMSLayerItem : public QgsLayerItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-03-03 08:42:00 +01:00
|
|
|
QgsWMSLayerItem( QgsDataItem *parent, QString name, QString path,
|
|
|
|
const QgsWmsCapabilitiesProperty &capabilitiesProperty,
|
|
|
|
const QgsDataSourceUri &dataSourceUri,
|
2014-02-10 23:32:25 +01:00
|
|
|
const QgsWmsLayerProperty &layerProperty );
|
2011-10-13 21:17:05 -03:00
|
|
|
|
|
|
|
QString createUri();
|
|
|
|
|
|
|
|
QgsWmsCapabilitiesProperty mCapabilitiesProperty;
|
2016-08-04 09:10:08 +02:00
|
|
|
QgsDataSourceUri mDataSourceUri;
|
2011-10-13 21:17:05 -03:00
|
|
|
QgsWmsLayerProperty mLayerProperty;
|
|
|
|
};
|
|
|
|
|
2014-02-10 23:32:25 +01:00
|
|
|
class QgsWMTSLayerItem : public QgsLayerItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-03-03 08:42:00 +01:00
|
|
|
QgsWMTSLayerItem( QgsDataItem *parent,
|
2014-02-10 23:32:25 +01:00
|
|
|
const QString &name,
|
|
|
|
const QString &path,
|
2016-08-04 09:10:08 +02:00
|
|
|
const QgsDataSourceUri &dataSourceUri,
|
2014-02-10 23:32:25 +01:00
|
|
|
const QString &id,
|
|
|
|
const QString &format,
|
|
|
|
const QString &style,
|
|
|
|
const QString &tileMatrixSet,
|
|
|
|
const QString &crs,
|
|
|
|
const QString &title );
|
|
|
|
|
|
|
|
QString createUri();
|
2015-01-16 08:11:14 +01:00
|
|
|
QString layerName() const override { return mTitle; }
|
2014-02-10 23:32:25 +01:00
|
|
|
|
|
|
|
private:
|
2016-08-04 09:10:08 +02:00
|
|
|
QgsDataSourceUri mDataSourceUri;
|
2014-02-10 23:32:25 +01:00
|
|
|
QString mId, mFormat, mStyle, mTileMatrixSet, mCrs, mTitle;
|
|
|
|
};
|
|
|
|
|
2011-10-13 21:17:05 -03:00
|
|
|
class QgsWMSRootItem : public QgsDataCollectionItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-03-03 08:42:00 +01:00
|
|
|
QgsWMSRootItem( QgsDataItem *parent, QString name, QString path );
|
2011-10-13 21:17:05 -03:00
|
|
|
|
2017-03-03 08:42:00 +01:00
|
|
|
QVector<QgsDataItem *> createChildren() override;
|
2011-10-13 21:17:05 -03:00
|
|
|
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2017-12-15 08:57:22 +10:00
|
|
|
QList<QAction *> actions( QWidget *parent ) override;
|
|
|
|
QWidget *paramWidget() override;
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2011-10-13 21:17:05 -03:00
|
|
|
|
|
|
|
public slots:
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2011-10-13 21:28:37 -03:00
|
|
|
void newConnection();
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2017-07-11 13:52:45 +02:00
|
|
|
|
2011-10-13 21:17:05 -03:00
|
|
|
};
|
|
|
|
|
2016-08-31 18:37:46 +08:00
|
|
|
|
|
|
|
//! Provider for WMS root data item
|
|
|
|
class QgsWmsDataItemProvider : public QgsDataItemProvider
|
|
|
|
{
|
|
|
|
public:
|
2017-12-15 08:57:22 +10:00
|
|
|
QString name() override { return QStringLiteral( "WMS" ); }
|
2016-08-31 18:37:46 +08:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
int capabilities() override { return QgsDataProvider::Net; }
|
2016-08-31 18:37:46 +08:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override;
|
2017-08-07 02:24:12 +07:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
QVector<QgsDataItem *> createDataItems( const QString &path, QgsDataItem *parentItem ) override;
|
2016-08-31 18:37:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-08-31 16:37:05 +08:00
|
|
|
//! Root item for XYZ tile layers
|
|
|
|
class QgsXyzTileRootItem : public QgsDataCollectionItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-03-03 08:42:00 +01:00
|
|
|
QgsXyzTileRootItem( QgsDataItem *parent, QString name, QString path );
|
2016-08-31 16:37:05 +08:00
|
|
|
|
2017-03-03 08:42:00 +01:00
|
|
|
QVector<QgsDataItem *> createChildren() override;
|
2016-08-31 16:37:05 +08:00
|
|
|
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2017-12-15 08:57:22 +10:00
|
|
|
QList<QAction *> actions( QWidget *parent ) override;
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2016-08-31 16:37:05 +08:00
|
|
|
|
|
|
|
private slots:
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2016-08-31 16:37:05 +08:00
|
|
|
void newConnection();
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2016-08-31 16:37:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Item implementation for XYZ tile layers
|
|
|
|
class QgsXyzLayerItem : public QgsLayerItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-03-03 08:42:00 +01:00
|
|
|
QgsXyzLayerItem( QgsDataItem *parent, QString name, QString path, const QString &encodedUri );
|
2016-08-31 16:37:05 +08:00
|
|
|
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2017-12-15 08:57:22 +10:00
|
|
|
QList<QAction *> actions( QWidget *parent ) override;
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2016-08-31 16:37:05 +08:00
|
|
|
|
|
|
|
public slots:
|
2017-07-06 14:05:08 +02:00
|
|
|
#ifdef HAVE_GUI
|
2017-02-25 17:44:55 +08:00
|
|
|
void editConnection();
|
2016-08-31 16:37:05 +08:00
|
|
|
void deleteConnection();
|
2017-07-06 14:05:08 +02:00
|
|
|
#endif
|
2016-08-31 16:37:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//! Provider for XYZ root data item
|
|
|
|
class QgsXyzTileDataItemProvider : public QgsDataItemProvider
|
|
|
|
{
|
|
|
|
public:
|
2017-12-15 08:57:22 +10:00
|
|
|
QString name() override { return QStringLiteral( "XYZ Tiles" ); }
|
2016-08-31 16:37:05 +08:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
int capabilities() override { return QgsDataProvider::Net; }
|
2016-08-31 16:37:05 +08:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override
|
2016-08-31 16:37:05 +08:00
|
|
|
{
|
|
|
|
if ( path.isEmpty() )
|
2017-04-06 16:41:24 +02:00
|
|
|
return new QgsXyzTileRootItem( parentItem, QStringLiteral( "XYZ Tiles" ), QStringLiteral( "xyz:" ) );
|
2016-08-31 16:37:05 +08:00
|
|
|
return nullptr;
|
|
|
|
}
|
2017-08-07 02:24:12 +07:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
QVector<QgsDataItem *> createDataItems( const QString &path, QgsDataItem *parentItem ) override;
|
2016-08-31 16:37:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-13 21:17:05 -03:00
|
|
|
#endif // QGSWMSDATAITEMS_H
|