| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
|
|
||
| SET (WCS_SRCS | ||
| qgswcsprovider.cpp | ||
| qgswcscapabilities.cpp | ||
| qgswcssourceselect.cpp | ||
| qgswcsdataitems.cpp | ||
| ) | ||
| SET (WCS_MOC_HDRS | ||
| qgswcsprovider.h | ||
| qgswcscapabilities.h | ||
| qgswcssourceselect.h | ||
| qgswcsdataitems.h | ||
| ) | ||
|
|
||
| QT4_WRAP_CPP (WCS_MOC_SRCS ${WCS_MOC_HDRS}) | ||
|
|
||
| INCLUDE_DIRECTORIES( . ../../core ../../core/raster ../../gui | ||
| ${CMAKE_CURRENT_BINARY_DIR}/../../ui | ||
| ${GDAL_INCLUDE_DIR} | ||
| ) | ||
|
|
||
| ADD_LIBRARY(wcsprovider MODULE ${WCS_SRCS} ${WCS_MOC_SRCS}) | ||
|
|
||
| TARGET_LINK_LIBRARIES(wcsprovider | ||
| qgis_core | ||
| qgis_gui | ||
| ) | ||
|
|
||
| INSTALL (TARGETS wcsprovider | ||
| RUNTIME DESTINATION ${QGIS_PLUGIN_DIR} | ||
| LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,308 @@ | ||
| /*************************************************************************** | ||
| qgswcsdataitems.cpp | ||
| --------------------- | ||
| begin : 2 July, 2012 | ||
| copyright : (C) 2012 by Radim Blazek | ||
| email : radim dot blazek at gmail.com | ||
| *************************************************************************** | ||
| * * | ||
| * 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. * | ||
| * * | ||
| ***************************************************************************/ | ||
| #include "qgswcsdataitems.h" | ||
| #include "qgswcsprovider.h" | ||
| #include "qgslogger.h" | ||
| #include "qgsdatasourceuri.h" | ||
| #include "qgswcssourceselect.h" | ||
| #include "qgsowsconnection.h" | ||
| #include "qgsnewhttpconnection.h" | ||
|
|
||
| #include <QFileInfo> | ||
| #include <QSettings> | ||
|
|
||
| QgsWCSConnectionItem::QgsWCSConnectionItem( QgsDataItem* parent, QString name, QString path ) | ||
| : QgsDataCollectionItem( parent, name, path ) | ||
| { | ||
| mIcon = QIcon( getThemePixmap( "mIconWcs.png" ) ); | ||
| } | ||
|
|
||
| QgsWCSConnectionItem::~QgsWCSConnectionItem() | ||
| { | ||
| QgsDebugMsg( "Entered" ); | ||
| } | ||
|
|
||
| QVector<QgsDataItem*> QgsWCSConnectionItem::createChildren() | ||
| { | ||
| QgsDebugMsg( "Entered" ); | ||
| QVector<QgsDataItem*> children; | ||
|
|
||
| QString encodedUri = mPath; | ||
| QgsDataSourceURI uri; | ||
| uri.setEncodedUri( encodedUri ); | ||
| QgsDebugMsg( "encodedUri = " + encodedUri ); | ||
|
|
||
| mCapabilities.setUri( uri ); | ||
|
|
||
| // Attention: supportedLayers() gives tree leafes, not top level | ||
| if ( !mCapabilities.lastError().isEmpty() ) | ||
| { | ||
| //children.append( new QgsErrorItem( this, tr( "Failed to retrieve layers" ), mPath + "/error" ) ); | ||
| // TODO: show the error without adding child | ||
| return children; | ||
| } | ||
|
|
||
| foreach( QgsWcsCoverageSummary coverageSummary, mCapabilities.capabilities().contents.coverageSummary ) | ||
| { | ||
| // Attention, the name may be empty | ||
| QgsDebugMsg( QString::number( coverageSummary.orderId ) + " " + coverageSummary.identifier + " " + coverageSummary.title ); | ||
| QString pathName = coverageSummary.identifier.isEmpty() ? QString::number( coverageSummary.orderId ) : coverageSummary.identifier; | ||
|
|
||
| QgsWCSLayerItem * layer = new QgsWCSLayerItem( this, coverageSummary.title, mPath + "/" + pathName, mCapabilities.capabilities(), uri, coverageSummary ); | ||
|
|
||
| children.append( layer ); | ||
| } | ||
| return children; | ||
| } | ||
|
|
||
| bool QgsWCSConnectionItem::equal( const QgsDataItem *other ) | ||
| { | ||
| if ( type() != other->type() ) | ||
| { | ||
| return false; | ||
| } | ||
| const QgsWCSConnectionItem *o = dynamic_cast<const QgsWCSConnectionItem *>( other ); | ||
| if ( !o ) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| return ( mPath == o->mPath && mName == o->mName ); | ||
| } | ||
|
|
||
| QList<QAction*> QgsWCSConnectionItem::actions() | ||
| { | ||
| QList<QAction*> lst; | ||
|
|
||
| QAction* actionEdit = new QAction( tr( "Edit..." ), this ); | ||
| connect( actionEdit, SIGNAL( triggered() ), this, SLOT( editConnection() ) ); | ||
| lst.append( actionEdit ); | ||
|
|
||
| QAction* actionDelete = new QAction( tr( "Delete" ), this ); | ||
| connect( actionDelete, SIGNAL( triggered() ), this, SLOT( deleteConnection() ) ); | ||
| lst.append( actionDelete ); | ||
|
|
||
| return lst; | ||
| } | ||
|
|
||
| void QgsWCSConnectionItem::editConnection() | ||
| { | ||
| QgsNewHttpConnection nc( 0, "/Qgis/connections-wcs/", mName ); | ||
|
|
||
| if ( nc.exec() ) | ||
| { | ||
| // the parent should be updated | ||
| mParent->refresh(); | ||
| } | ||
| } | ||
|
|
||
| void QgsWCSConnectionItem::deleteConnection() | ||
| { | ||
| QgsOWSConnection::deleteConnection( "WCS", mName ); | ||
| // the parent should be updated | ||
| mParent->refresh(); | ||
| } | ||
|
|
||
|
|
||
| // --------------------------------------------------------------------------- | ||
|
|
||
| QgsWCSLayerItem::QgsWCSLayerItem( QgsDataItem* parent, QString name, QString path, QgsWcsCapabilitiesProperty capabilitiesProperty, QgsDataSourceURI dataSourceUri, QgsWcsCoverageSummary coverageSummary ) | ||
| : QgsLayerItem( parent, name, path, QString(), QgsLayerItem::Raster, "wcs" ), | ||
| mCapabilities( capabilitiesProperty ), | ||
| mDataSourceUri( dataSourceUri ), | ||
| mCoverageSummary( coverageSummary ) | ||
| { | ||
| QgsDebugMsg( "uri = " + mDataSourceUri.encodedUri() ); | ||
| mUri = createUri(); | ||
| // Populate everything, it costs nothing, all info about layers is collected | ||
| foreach( QgsWcsCoverageSummary coverageSummary, mCoverageSummary.coverageSummary ) | ||
| { | ||
| // Attention, the name may be empty | ||
| QgsDebugMsg( QString::number( coverageSummary.orderId ) + " " + coverageSummary.identifier + " " + coverageSummary.title ); | ||
| QString pathName = coverageSummary.identifier.isEmpty() ? QString::number( coverageSummary.orderId ) : coverageSummary.identifier; | ||
| QgsWCSLayerItem * layer = new QgsWCSLayerItem( this, coverageSummary.title, mPath + "/" + pathName, mCapabilities, mDataSourceUri, coverageSummary ); | ||
| mChildren.append( layer ); | ||
| } | ||
|
|
||
| if ( mChildren.size() == 0 ) | ||
| { | ||
| //mIcon = iconRaster(); | ||
| mIcon = QIcon( getThemePixmap( "mIconWcs.png" ) ); | ||
| } | ||
| mPopulated = true; | ||
| } | ||
|
|
||
| QgsWCSLayerItem::~QgsWCSLayerItem() | ||
| { | ||
| } | ||
|
|
||
| QString QgsWCSLayerItem::createUri() | ||
| { | ||
| if ( mCoverageSummary.identifier.isEmpty() ) | ||
| return ""; // layer collection | ||
|
|
||
| // Number of styles must match number of layers | ||
| mDataSourceUri.setParam( "identifier", mCoverageSummary.identifier ); | ||
|
|
||
| // TODO(?): with WCS 1.0 GetCapabilities does not contain CRS and formats, | ||
| // to get them we would need to call QgsWcsCapabilities::describeCoverage | ||
| // but it is problematic to get QgsWcsCapabilities here (copy not allowed | ||
| // by QObject, pointer is dangerous (OWS provider is changing parent)) | ||
| // We leave CRS and format default for now. | ||
|
|
||
| QString format; | ||
| // get first supported by GDAL and server | ||
| // TODO | ||
| //QStringList mimes = QgsGdalProvider::supportedMimes().keys(); | ||
| QStringList mimes; | ||
| // prefer tiff | ||
| if ( mimes.contains( "image/tiff" ) && mCoverageSummary.supportedFormat.contains( "image/tiff" ) ) | ||
| { | ||
| format = "image/tiff"; | ||
| } | ||
| else | ||
| { | ||
| foreach( QString f, mimes ) | ||
| { | ||
| if ( mCoverageSummary.supportedFormat.indexOf( f ) >= 0 ) | ||
| { | ||
| format = f; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| if ( !format.isEmpty() ) | ||
| { | ||
| mDataSourceUri.setParam( "format", format ); | ||
| } | ||
|
|
||
| QString crs; | ||
|
|
||
| // TODO: prefer project CRS | ||
| // get first known if possible | ||
| QgsCoordinateReferenceSystem testCrs; | ||
| foreach( QString c, mCoverageSummary.supportedCrs ) | ||
| { | ||
| testCrs.createFromOgcWmsCrs( c ); | ||
| if ( testCrs.isValid() ) | ||
| { | ||
| crs = c; | ||
| break; | ||
| } | ||
| } | ||
| if ( crs.isEmpty() && mCoverageSummary.supportedCrs.size() > 0 ) | ||
| { | ||
| crs = mCoverageSummary.supportedCrs.value( 0 ); | ||
| } | ||
| if ( !crs.isEmpty() ) | ||
| { | ||
| mDataSourceUri.setParam( "crs", crs ); | ||
| } | ||
|
|
||
| return mDataSourceUri.encodedUri(); | ||
| } | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
|
|
||
| QgsWCSRootItem::QgsWCSRootItem( QgsDataItem* parent, QString name, QString path ) | ||
| : QgsDataCollectionItem( parent, name, path ) | ||
| { | ||
| mIcon = QIcon( getThemePixmap( "mIconWcs.png" ) ); | ||
|
|
||
| populate(); | ||
| } | ||
|
|
||
| QgsWCSRootItem::~QgsWCSRootItem() | ||
| { | ||
| } | ||
|
|
||
| QVector<QgsDataItem*>QgsWCSRootItem::createChildren() | ||
| { | ||
| QVector<QgsDataItem*> connections; | ||
| foreach( QString connName, QgsOWSConnection::connectionList( "WCS" ) ) | ||
| { | ||
| //QgsDataItem * conn = new QgsWCSConnectionItem( this, connName, mPath + "/" + connName ); | ||
| QgsOWSConnection connection( "WCS", connName ); | ||
| QgsDataItem * conn = new QgsWCSConnectionItem( this, connName, connection.uri().encodedUri() ); | ||
|
|
||
| conn->setIcon( QIcon( getThemePixmap( "mIconConnect.png" ) ) ); | ||
| connections.append( conn ); | ||
| } | ||
| return connections; | ||
| } | ||
|
|
||
| QList<QAction*> QgsWCSRootItem::actions() | ||
| { | ||
| QList<QAction*> lst; | ||
|
|
||
| QAction* actionNew = new QAction( tr( "New Connection..." ), this ); | ||
| connect( actionNew, SIGNAL( triggered() ), this, SLOT( newConnection() ) ); | ||
| lst.append( actionNew ); | ||
|
|
||
| return lst; | ||
| } | ||
|
|
||
|
|
||
| QWidget * QgsWCSRootItem::paramWidget() | ||
| { | ||
| QgsWCSSourceSelect *select = new QgsWCSSourceSelect( 0, 0, true, true ); | ||
| connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); | ||
| return select; | ||
| return 0; | ||
| } | ||
| void QgsWCSRootItem::connectionsChanged() | ||
| { | ||
| refresh(); | ||
| } | ||
|
|
||
| void QgsWCSRootItem::newConnection() | ||
| { | ||
| QgsNewHttpConnection nc( 0, "/Qgis/connections-wcs/" ); | ||
|
|
||
| if ( nc.exec() ) | ||
| { | ||
| refresh(); | ||
| } | ||
| } | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
|
|
||
| static QString filterString; | ||
| static QStringList extensions = QStringList(); | ||
| static QStringList wildcards = QStringList(); | ||
|
|
||
| QGISEXTERN int dataCapabilities() | ||
| { | ||
| return QgsDataProvider::Net; | ||
| } | ||
|
|
||
| QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) | ||
| { | ||
| QgsDebugMsg( "thePath = " + thePath ); | ||
| if ( thePath.isEmpty() ) | ||
| { | ||
| // Top level WCS | ||
| return new QgsWCSRootItem( parentItem, "WCS", "wcs:" ); | ||
| } | ||
|
|
||
| // OWS server | ||
| QgsDebugMsg( "connection found in uri" ); | ||
| return new QgsWCSConnectionItem( parentItem, "WCS", thePath ); | ||
| } | ||
|
|
||
| QGISEXTERN QgsWCSSourceSelect * selectWidget( QWidget * parent, Qt::WFlags fl ) | ||
| { | ||
| return new QgsWCSSourceSelect( parent, fl ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /*************************************************************************** | ||
| qgswcsdataitems.h | ||
| --------------------- | ||
| begin : 2 July, 2012 | ||
| copyright : (C) 2012 by Radim Blazek | ||
| email : radim dot blazek at gmail.com | ||
| *************************************************************************** | ||
| * * | ||
| * 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. * | ||
| * * | ||
| ***************************************************************************/ | ||
| #ifndef QGSWCSDATAITEMS_H | ||
| #define QGSWCSDATAITEMS_H | ||
|
|
||
| #include "qgsdataitem.h" | ||
| #include "qgsdatasourceuri.h" | ||
| #include "qgswcscapabilities.h" | ||
|
|
||
| class QgsWCSConnectionItem : public QgsDataCollectionItem | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| QgsWCSConnectionItem( QgsDataItem* parent, QString name, QString path ); | ||
| ~QgsWCSConnectionItem(); | ||
|
|
||
| QVector<QgsDataItem*> createChildren(); | ||
| virtual bool equal( const QgsDataItem *other ); | ||
|
|
||
| virtual QList<QAction*> actions(); | ||
|
|
||
| QgsWcsCapabilities mCapabilities; | ||
| QVector<QgsWcsCoverageSummary> mLayerProperties; | ||
|
|
||
| public slots: | ||
| void editConnection(); | ||
| void deleteConnection(); | ||
| }; | ||
|
|
||
| // WCS 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 QgsWCSLayerItem : public QgsLayerItem | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| QgsWCSLayerItem( QgsDataItem* parent, QString name, QString path, | ||
| QgsWcsCapabilitiesProperty capabilitiesProperty, QgsDataSourceURI dataSourceUri, QgsWcsCoverageSummary coverageSummary ); | ||
| ~QgsWCSLayerItem(); | ||
|
|
||
| QString createUri(); | ||
|
|
||
| QgsWcsCapabilitiesProperty mCapabilities; | ||
| QgsDataSourceURI mDataSourceUri; | ||
| QgsWcsCoverageSummary mCoverageSummary; | ||
| }; | ||
|
|
||
| class QgsWCSRootItem : public QgsDataCollectionItem | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| QgsWCSRootItem( QgsDataItem* parent, QString name, QString path ); | ||
| ~QgsWCSRootItem(); | ||
|
|
||
| QVector<QgsDataItem*> createChildren(); | ||
|
|
||
| virtual QList<QAction*> actions(); | ||
|
|
||
| virtual QWidget * paramWidget(); | ||
|
|
||
| public slots: | ||
| void connectionsChanged(); | ||
|
|
||
| void newConnection(); | ||
| }; | ||
|
|
||
| #endif // QGSWCSDATAITEMS_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,374 @@ | ||
| /*************************************************************************** | ||
| qgswcsprovider.h - QGIS Data provider for | ||
| OGC Web Coverage Service layers | ||
| ------------------- | ||
| begin : 2 July, 2012 | ||
| copyright : (C) 2012 by Radim Blazek | ||
| email : radim dot blazek at gmail.com | ||
| Based on qgswmsprovider.h written by Brendan Morley. | ||
| ***************************************************************************/ | ||
|
|
||
| /*************************************************************************** | ||
| * * | ||
| * 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. * | ||
| * * | ||
| ***************************************************************************/ | ||
|
|
||
| #ifndef QGSWCSPROVIDER_H | ||
| #define QGSWCSPROVIDER_H | ||
|
|
||
| #include "qgsrasterdataprovider.h" | ||
| #include "qgsrectangle.h" | ||
|
|
||
| #include <QString> | ||
| #include <QStringList> | ||
| #include <QDomElement> | ||
| #include <QHash> | ||
| #include <QMap> | ||
| #include <QVector> | ||
| #include <QUrl> | ||
|
|
||
| class QgsCoordinateTransform; | ||
| class QNetworkAccessManager; | ||
| class QNetworkReply; | ||
| class QNetworkRequest; | ||
|
|
||
| /** | ||
| \brief Data provider for OGC WCS layers. | ||
| This provider implements the | ||
| interface defined in the QgsDataProvider class to provide access to spatial | ||
| data residing in a OGC Web Map Service. | ||
| */ | ||
| class QgsWcsProvider : public QgsRasterDataProvider | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| /** | ||
| * Constructor for the provider. | ||
| * | ||
| * \param uri HTTP URL of the Web Server. If needed a proxy will be used | ||
| * otherwise we contact the host directly. | ||
| * | ||
| */ | ||
| QgsWcsProvider( QString const & uri = 0 ); | ||
|
|
||
| //! Destructor | ||
| virtual ~QgsWcsProvider(); | ||
|
|
||
| /*! Get the QgsCoordinateReferenceSystem for this layer | ||
| * @note Must be reimplemented by each provider. | ||
| * If the provider isn't capable of returning | ||
| * its projection an empty srs will be return, ti will return 0 | ||
| */ | ||
| virtual QgsCoordinateReferenceSystem crs(); | ||
|
|
||
| /** | ||
| * Get the coverage format used in the transfer from the WCS server | ||
| */ | ||
| QString format() const; | ||
|
|
||
| /** | ||
| * Set the coverage format used in the transfer from the WCS server | ||
| */ | ||
| void setFormat( QString const & format ); | ||
|
|
||
| /** | ||
| * Set the image projection (in WCS CRS format) used in the transfer from the WCS server | ||
| * | ||
| * \note an empty crs value will result in the previous CRS being retained. | ||
| */ | ||
| void setCoverageCrs( QString const & crs ); | ||
|
|
||
| // TODO: Document this better. | ||
| /** \brief Renders the layer as an image | ||
| * | ||
| * \return A QImage - if the attempt to retrieve data for the draw was unsuccessful, returns 0 | ||
| * and more information can be found in lastError() and lastErrorTitle() | ||
| * | ||
| * \todo Add pixel depth parameter (intended to match the display or printer device) | ||
| * | ||
| * \note Ownership of the returned QImage remains with this provider and its lifetime | ||
| * is guaranteed only until the next call to draw() or destruction of this provider. | ||
| * | ||
| * \warning A pointer to an QImage is used, as a plain QImage seems to have difficulty being | ||
| * shared across library boundaries | ||
| */ | ||
| QImage *draw( QgsRectangle const & viewExtent, int pixelWidth, int pixelHeight ); | ||
|
|
||
| void readBlock( int bandNo, QgsRectangle const & viewExtent, int width, int height, void *data ); | ||
|
|
||
| /** Return the extent for this data layer | ||
| */ | ||
| virtual QgsRectangle extent(); | ||
|
|
||
| /**Returns true if layer is valid | ||
| */ | ||
| bool isValid(); | ||
|
|
||
| /**Returns the base url | ||
| */ | ||
| virtual QString baseUrl() const; | ||
|
|
||
| /**Returns the GetMap url | ||
| */ | ||
| virtual QString getMapUrl() const; | ||
|
|
||
| /**Returns the GetFeatureInfo url | ||
| */ | ||
| virtual QString getFeatureInfoUrl() const; | ||
|
|
||
| //! get WCS version string | ||
| QString wcsVersion(); | ||
|
|
||
| // Reimplemented QgsRasterDataProvider virtual methods | ||
| int capabilities() const; | ||
| int dataType( int bandNo ) const; | ||
| int srcDataType( int bandNo ) const; | ||
| int bandCount() const; | ||
| QString metadata(); | ||
| QString identifyAsHtml( const QgsPoint& point ); | ||
| QString identifyAsText( const QgsPoint& point ); | ||
| QString lastErrorTitle(); | ||
| QString lastError(); | ||
| QString lastErrorFormat(); | ||
| QString name() const; | ||
| QString description() const; | ||
| void reloadData(); | ||
|
|
||
| // WMS specific, maybe to be removed from QgsRasterDataProvider | ||
| void addLayers( QStringList const &layers, QStringList const &styles = QStringList() ) { Q_UNUSED( layers ); Q_UNUSED( styles ); } | ||
| QStringList supportedImageEncodings() { return QStringList(); } | ||
| QString imageEncoding() const { return QString(); } | ||
| void setImageEncoding( QString const &mimeType ) { Q_UNUSED( mimeType ); } | ||
| void setImageCrs( QString const &crs ) { Q_UNUSED( crs ); } | ||
|
|
||
| static QMap<QString, QString> supportedMimes(); | ||
|
|
||
| signals: | ||
|
|
||
| /** \brief emit a signal to notify of a progress event */ | ||
| void progressChanged( int theProgress, int theTotalSteps ); | ||
|
|
||
| /** \brief emit a signal to be caught by qgisapp and display a msg on status bar */ | ||
| void statusChanged( QString const & theStatusQString ); | ||
|
|
||
| void dataChanged(); | ||
|
|
||
| private slots: | ||
| void cacheReplyFinished(); | ||
| void cacheReplyProgress( qint64, qint64 ); | ||
|
|
||
| private: | ||
| void showMessageBox( const QString& title, const QString& text ); | ||
|
|
||
| // case insensitive attribute value lookup | ||
| static QString nodeAttribute( const QDomElement &e, QString name, QString defValue = QString::null ); | ||
|
|
||
| /** | ||
| * \brief parse the full WCS ServiceExceptionReport XML document | ||
| * | ||
| * \note mErrorCaption and mError are updated to suit the results of this function. | ||
| */ | ||
| bool parseServiceExceptionReportDom( QByteArray const &xml ); | ||
|
|
||
| //! parse the WCS ServiceException XML element | ||
| void parseServiceException( QDomElement const &e ); | ||
|
|
||
| /** | ||
| * \brief Calculates the combined extent of the layers selected by layersDrawn | ||
| * | ||
| * \retval false if the capabilities document could not be retrieved or parsed - | ||
| * see lastError() for more info | ||
| */ | ||
| bool calculateExtent(); | ||
|
|
||
| /** | ||
| * \brief Check for parameters in the uri, | ||
| * stripping and saving them if present. | ||
| * | ||
| * \param uri uri to check | ||
| * | ||
| * \note added in 1.1 | ||
| */ | ||
|
|
||
| void parseUri( QString uri ); | ||
|
|
||
| /** | ||
| * \brief Prepare the URI so that we can later simply append param=value | ||
| * \param uri uri to prepare | ||
| * \retval prepared uri | ||
| */ | ||
| QString prepareUri( QString uri ) const; | ||
|
|
||
| //QString layerMetadata( QgsWmsLayerProperty &layer ); | ||
| QString layerMetadata( ); | ||
|
|
||
| //! remove query item and replace it with a new value | ||
| void setQueryItem( QUrl &url, QString key, QString value ); | ||
|
|
||
| //! set authorization header | ||
| void setAuthorization( QNetworkRequest &request ) const; | ||
|
|
||
| //! Data source URI of the WCS for this layer | ||
| QString mHttpUri; | ||
|
|
||
| //! URL part of URI (httpuri) | ||
| QString mBaseUrl; | ||
|
|
||
| //! Identifier / coverage / layer name | ||
| QString mIdentifier; | ||
|
|
||
| //! Format of coverage to be used in request | ||
| QString mFormat; | ||
|
|
||
| /** | ||
| * Flag indicating if the layer data source is a valid WCS layer | ||
| */ | ||
| bool mValid; | ||
|
|
||
| /** | ||
| * Spatial reference id of the layer | ||
| */ | ||
| QString mSrid; | ||
|
|
||
| /** | ||
| * Rectangle that contains the extent (bounding box) of the layer | ||
| */ | ||
| QgsRectangle mLayerExtent; | ||
|
|
||
| /** | ||
| * Last Service Exception Report from the WCS | ||
| */ | ||
| QDomDocument mServiceExceptionReportDom; | ||
|
|
||
| /** | ||
| * extents per layer (in WCS CRS:84 datum) | ||
| */ | ||
| QMap<QString, QgsRectangle> mExtentForLayer; | ||
|
|
||
| /** | ||
| * available CRSs per layer | ||
| */ | ||
| QMap<QString, QStringList > mCrsForLayer; | ||
|
|
||
| /** | ||
| * WCS "queryable" per layer | ||
| * Used in determining if the Identify map tool can be useful on the rendered WCS map layer. | ||
| */ | ||
| QMap<QString, bool> mQueryableForLayer; | ||
|
|
||
| /** | ||
| * WCS CRS type of the image CRS used from the WCS server | ||
| */ | ||
| QString mImageCrs; | ||
|
|
||
| /** | ||
| * The previously retrieved image from the WCS server. | ||
| * This can be reused if draw() is called consecutively | ||
| * with the same parameters. | ||
| */ | ||
| QImage *mCachedImage; | ||
|
|
||
| /** | ||
| * The reply to the on going request to fill the cache | ||
| */ | ||
| QNetworkReply *mCacheReply; | ||
|
|
||
| /** | ||
| * Running tile requests | ||
| */ | ||
| QList<QNetworkReply*> mTileReplies; | ||
|
|
||
| /** | ||
| * The reply to the capabilities request | ||
| */ | ||
| QNetworkReply *mCapabilitiesReply; | ||
|
|
||
| /** | ||
| * The reply to the capabilities request | ||
| */ | ||
| QNetworkReply *mIdentifyReply; | ||
|
|
||
| /** | ||
| * The result of the identify reply | ||
| */ | ||
| QString mIdentifyResult; | ||
|
|
||
| /** | ||
| * The previous parameters to draw(). | ||
| */ | ||
| QgsRectangle mCachedViewExtent; | ||
| int mCachedViewWidth; | ||
| int mCachedViewHeight; | ||
|
|
||
| /** | ||
| * Maximum width and height of getmap requests | ||
| */ | ||
| int mMaxWidth; | ||
| int mMaxHeight; | ||
|
|
||
| /** | ||
| * The error caption associated with the last WCS error. | ||
| */ | ||
| QString mErrorCaption; | ||
|
|
||
| /** | ||
| * The error message associated with the last WCS error. | ||
| */ | ||
| QString mError; | ||
|
|
||
|
|
||
| /** The mime type of the message | ||
| */ | ||
| QString mErrorFormat; | ||
|
|
||
| //! A QgsCoordinateTransform is used for transformation of WCS layer extents | ||
| QgsCoordinateTransform *mCoordinateTransform; | ||
|
|
||
| //! See if calculateExtents() needs to be called before extent() returns useful data | ||
| bool mExtentDirty; | ||
|
|
||
| //! Base URL for WCS GetFeatureInfo requests | ||
| QString mGetFeatureInfoUrlBase; | ||
| QString mServiceMetadataURL; | ||
|
|
||
| //! number of layers and parents | ||
| //int mLayerCount; | ||
| //QMap<int, int> mLayerParents; | ||
| //QMap<int, QStringList> mLayerParentNames; | ||
|
|
||
| //! flag set while provider is fetching tiles synchronously | ||
| bool mWaiting; | ||
|
|
||
| //! Errors counter | ||
| int mErrors; | ||
|
|
||
| //! Username for basic http authentication | ||
| QString mUserName; | ||
|
|
||
| //! Password for basic http authentication | ||
| QString mPassword; | ||
|
|
||
| //! whether to use hrefs from GetCapabilities (default) or | ||
| // the given base urls for GetMap and GetFeatureInfo | ||
| bool mIgnoreGetMapUrl; | ||
| bool mIgnoreGetFeatureInfoUrl; | ||
| bool mIgnoreAxisOrientation; | ||
| bool mInvertAxisOrientation; | ||
|
|
||
| QgsCoordinateReferenceSystem mCrs; | ||
| }; | ||
|
|
||
|
|
||
| #endif | ||
|
|
||
| // ENDS |