140 changes: 41 additions & 99 deletions src/providers/gdal/qgswcscapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,22 @@ QgsWcsCapabilities::QgsWcsCapabilities( QString const &theUri )
*/

QgsWcsCapabilities::QgsWcsCapabilities( QgsDataSourceURI const &theUri ):
mUri(theUri),
mCoverageCount(0)
mUri( theUri ),
mCoverageCount( 0 )
{
QgsDebugMsg( "uri = " + mUri.encodedUri() );

retrieveServerCapabilities();
}

QgsWcsCapabilities::QgsWcsCapabilities( ):
mCoverageCount(0)
mCoverageCount( 0 )
{
}

QgsWcsCapabilities::~QgsWcsCapabilities()
{
QgsDebugMsg( "deconstructing." );
/*
if ( cacheReply )
{
cacheReply->deleteLater();
cacheReply = 0;
}
*/
}

void QgsWcsCapabilities::setUri( QgsDataSourceURI const &theUri )
Expand All @@ -107,8 +100,8 @@ void QgsWcsCapabilities::setUri( QgsDataSourceURI const &theUri )
mCoveragesSupported.clear();
QgsWcsCapabilitiesProperty c;
mCapabilities = c;
retrieveServerCapabilities(true);

retrieveServerCapabilities( true );
}

QString QgsWcsCapabilities::prepareUri( QString uri )
Expand Down Expand Up @@ -142,20 +135,12 @@ bool QgsWcsCapabilities::supportedCoverages( QVector<QgsWcsCoverageSummary> &cov
return true;
}

/*
QString QgsWcsCapabilities::baseUrl() const
{
return prepareUri( mUri.param("url") );
}
*/

QString QgsWcsCapabilities::getCoverageUrl() const
{
QString url = mCapabilities.operationsMetadata.getCoverage.dcp.http.get.xlinkHref;
// TODO: ignore getCoverage url
if ( url.isEmpty() )
{
url = mUri.param("url");
url = mUri.param( "url" );
}
return url;
}
Expand All @@ -167,16 +152,16 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( bool forceRefresh )
if ( mCapabilitiesResponse.isNull() || forceRefresh )
{
// Check if user tried to force version
QString userVersion = QUrl( mUri.param("url") ).queryItemValue("VERSION");
if ( !userVersion.isEmpty() && !userVersion.startsWith("1.1.") )
QString userVersion = QUrl( mUri.param( "url" ) ).queryItemValue( "VERSION" );
if ( !userVersion.isEmpty() && !userVersion.startsWith( "1.1." ) )
{
mErrorTitle = tr( "Version not supported" );
mErrorFormat = "text/plain";
mError = tr( "The version %1 specified in connection URL parameter VERSION is not supported by QGIS" ).arg( userVersion );
return false;
}

QString url = prepareUri( mUri.param("url") ) + "SERVICE=WCS&REQUEST=GetCapabilities&VERSION=1.1.0";
QString url = prepareUri( mUri.param( "url" ) ) + "SERVICE=WCS&REQUEST=GetCapabilities&VERSION=1.1.0";

mError = "";

Expand Down Expand Up @@ -230,7 +215,6 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( bool forceRefresh )

return false;
}

}

QgsDebugMsg( "exiting." );
Expand Down Expand Up @@ -288,9 +272,9 @@ void QgsWcsCapabilities::capabilitiesReplyProgress( qint64 bytesReceived, qint64
emit statusChanged( msg );
}

QString QgsWcsCapabilities::stripNS ( const QString & name )
QString QgsWcsCapabilities::stripNS( const QString & name )
{
return name.contains( ":" ) ? name.section( ':', 1 ) : name;
return name.contains( ":" ) ? name.section( ':', 1 ) : name;
}

bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapabilitiesProperty &capabilities )
Expand Down Expand Up @@ -333,7 +317,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
QgsDebugMsg( "testing tagName " + docElem.tagName() );

if (
// We don't support 1.0, but try WCS_Capabilities tag to get version
// We don't support 1.0, but try WCS_Capabilities tag to get version
docElem.tagName() != "WCS_Capabilities" && // 1.0
docElem.tagName() != "Capabilities" // 1.1
)
Expand All @@ -353,7 +337,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
capabilities.version = docElem.attribute( "version" );
mVersion = capabilities.version;

if ( !mVersion.startsWith("1.1.") )
if ( !mVersion.startsWith( "1.1." ) )
{
mErrorTitle = tr( "Version not supported" );
mErrorFormat = "text/plain";
Expand All @@ -374,7 +358,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
QDomElement e = n.toElement(); // try to convert the node to an element.
if ( !e.isNull() )
{
QString tagName = stripNS ( e.tagName() );
QString tagName = stripNS( e.tagName() );
if ( tagName == "ServiceIdentification" )
{
QgsDebugMsg( " ServiceIdentification." );
Expand Down Expand Up @@ -410,7 +394,7 @@ void QgsWcsCapabilities::parseServiceIdentification( QDomElement const & e, QgsW
QDomElement el = n1.toElement(); // try to convert the node to an element.
if ( !el.isNull() )
{
QString tagName = stripNS ( el.tagName() );
QString tagName = stripNS( el.tagName() );

if ( tagName == "Title" )
{
Expand All @@ -437,11 +421,11 @@ void QgsWcsCapabilities::parseHttp( QDomElement const & e, QgsWcsHTTP& http )
QDomElement el = n1.toElement(); // try to convert the node to an element.
if ( !el.isNull() )
{
QString tagName = stripNS ( el.tagName() );
QString tagName = stripNS( el.tagName() );
if ( tagName == "Get" )
{
QgsDebugMsg( " Get." );
http.get.xlinkHref = el.attribute( "xlink:href" );
http.get.xlinkHref = el.attribute( "xlink:href" );
}
}
n1 = n1.nextSibling();
Expand All @@ -460,7 +444,7 @@ void QgsWcsCapabilities::parseDcp( QDomElement const & e, QgsWcsDCP& dcp )
QDomElement el = n1.toElement(); // try to convert the node to an element.
if ( !el.isNull() )
{
QString tagName = stripNS ( el.tagName() );
QString tagName = stripNS( el.tagName() );
if ( tagName == "HTTP" )
{
QgsDebugMsg( " HTTP." );
Expand All @@ -483,7 +467,7 @@ void QgsWcsCapabilities::parseOperation( QDomElement const & e, QgsWcsOperation&
QDomElement el = n1.toElement(); // try to convert the node to an element.
if ( !el.isNull() )
{
QString tagName = stripNS ( el.tagName() );
QString tagName = stripNS( el.tagName() );

if ( tagName == "DCP" )
{
Expand All @@ -508,7 +492,7 @@ void QgsWcsCapabilities::parseOperationsMetadata( QDomElement const & e, QgsWcs
QDomElement el = n1.toElement(); // try to convert the node to an element.
if ( !el.isNull() )
{
QString tagName = stripNS ( el.tagName() );
QString tagName = stripNS( el.tagName() );

if ( tagName == "GetCoverage" )
{
Expand All @@ -524,7 +508,7 @@ void QgsWcsCapabilities::parseOperationsMetadata( QDomElement const & e, QgsWcs

void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCoverageSummary &coverageSummary, QgsWcsCoverageSummary *parent )
{
QgsDebugMsg("entering.");
QgsDebugMsg( "entering." );

coverageSummary.orderId = ++mCoverageCount;

Expand All @@ -534,8 +518,8 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove
QDomElement el = n1.toElement(); // try to convert the node to an element.
if ( !el.isNull() )
{
QString tagName = stripNS ( el.tagName() );
QgsDebugMsg( tagName + " : " + el.text());
QString tagName = stripNS( el.tagName() );
QgsDebugMsg( tagName + " : " + el.text() );

if ( tagName == "Identifier" )
{
Expand All @@ -559,10 +543,10 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove
// TODO: SupportedCRS may be URL referencing a document
// URN format: urn:ogc:def:objectType:authority:version:code
// URN example: urn:ogc:def:crs:EPSG::4326
QStringList urn = el.text().split(":");
if ( urn.size() == 7 )
QStringList urn = el.text().split( ":" );
if ( urn.size() == 7 )
{
coverageSummary.supportedCrs << urn.value(4) + ":" + urn.value(6);
coverageSummary.supportedCrs << urn.value( 4 ) + ":" + urn.value( 6 );
}
}
else if ( tagName == "WGS84BoundingBox" )
Expand All @@ -574,10 +558,10 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove

double w, e, s, n;
bool wOk, eOk, sOk, nOk;
w = lower.value(0).toDouble( &wOk );
s = lower.value(1).toDouble( &sOk );
e = upper.value(0).toDouble( &eOk );
n = upper.value(1).toDouble( &nOk );
w = lower.value( 0 ).toDouble( &wOk );
s = lower.value( 1 ).toDouble( &sOk );
e = upper.value( 0 ).toDouble( &eOk );
n = upper.value( 1 ).toDouble( &nOk );
if ( wOk && eOk && sOk && nOk )
{
coverageSummary.wgs84BoundingBox = QgsRectangle( w, s, e, n );
Expand All @@ -594,7 +578,7 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove
QDomElement el = n1.toElement(); // try to convert the node to an element.
if ( !el.isNull() )
{
QString tagName = stripNS ( el.tagName() );
QString tagName = stripNS( el.tagName() );

if ( tagName == "CoverageSummary" )
{
Expand All @@ -616,7 +600,7 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove

if ( parent && parent->orderId > 1 ) // ignore Contents to put them on top level
{
QgsDebugMsg( QString( "coverage orderId = %1 identifier = %2 has parent %3").arg(coverageSummary.orderId).arg(coverageSummary.identifier).arg(parent->orderId) );
QgsDebugMsg( QString( "coverage orderId = %1 identifier = %2 has parent %3" ).arg( coverageSummary.orderId ).arg( coverageSummary.identifier ).arg( parent->orderId ) );
mCoverageParents[ coverageSummary.orderId ] = parent->orderId;
}

Expand All @@ -630,9 +614,9 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove
{
mCoverageParentIdentifiers[ coverageSummary.orderId ] = QStringList() << coverageSummary.identifier << coverageSummary.title << coverageSummary.abstract;
}
QgsDebugMsg( QString( "coverage orderId = %1 identifier = %2").arg(coverageSummary.orderId).arg(coverageSummary.identifier) );
QgsDebugMsg( QString( "coverage orderId = %1 identifier = %2" ).arg( coverageSummary.orderId ).arg( coverageSummary.identifier ) );

QgsDebugMsg("exiting.");
QgsDebugMsg( "exiting." );
}

void QgsWcsCapabilities::coverageParents( QMap<int, int> &parents, QMap<int, QStringList> &parentNames ) const
Expand All @@ -659,56 +643,14 @@ QString QgsWcsCapabilities::lastErrorFormat()

void QgsWcsCapabilities::setAuthorization( QNetworkRequest &request ) const
{
if ( mUri.hasParam("username") && mUri.hasParam("password") )
QgsDebugMsg( "entered" );
if ( mUri.hasParam( "username" ) && mUri.hasParam( "password" ) )
{
request.setRawHeader( "Authorization", "Basic " + QString( "%1:%2" ).arg( mUri.param("username") ).arg( mUri.param("password") ).toAscii().toBase64() );
QgsDebugMsg( "setAuthorization " + mUri.param( "username" ) );
request.setRawHeader( "Authorization", "Basic " + QString( "%1:%2" ).arg( mUri.param( "username" ) ).arg( mUri.param( "password" ) ).toAscii().toBase64() );
}
}

// TOD: GDAL supported formats?
/*
QVector<QgsWcsSupportedFormat> QgsWcsCapabilities::supportedFormats()
{
QVector<QgsWcsSupportedFormat> formats;
QStringList mFormats, mLabels;
QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
if ( supportedFormats.contains( "png" ) )
{
QgsWcsSupportedFormat p1 = { "image/png", "PNG" };
QgsWcsSupportedFormat p2 = { "image/png; mode=24bit", "PNG24" }; // UMN mapserver
QgsWcsSupportedFormat p3 = { "image/png8", "PNG8" }; // used by geoserver
QgsWcsSupportedFormat p4 = { "png", "PNG" }; // used by french IGN geoportail
QgsWcsSupportedFormat p5 = { "pngt", "PNGT" }; // used by french IGN geoportail
formats << p1 << p2 << p3 << p4 << p5;
}
if ( supportedFormats.contains( "jpg" ) )
{
QgsWcsSupportedFormat j1 = { "image/jpeg", "JPEG" };
QgsWcsSupportedFormat j2 = { "jpeg", "JPEG" }; // used by french IGN geoportail
formats << j1 << j2;
}
if ( supportedFormats.contains( "gif" ) )
{
QgsWcsSupportedFormat g1 = { "image/gif", "GIF" };
formats << g1;
}
if ( supportedFormats.contains( "tiff" ) )
{
QgsWcsSupportedFormat t1 = { "image/tiff", "TIFF" };
formats << t1;
}
return formats;
}
*/

void QgsWcsCapabilities::showMessageBox( const QString& title, const QString& text )
{
QgsMessageOutput *message = QgsMessageOutput::createMessageOutput();
Expand All @@ -717,9 +659,9 @@ void QgsWcsCapabilities::showMessageBox( const QString& title, const QString& te
message->showMessage();
}

QgsWcsCoverageSummary QgsWcsCapabilities::coverageSummary ( QString const & theIdentifier )
QgsWcsCoverageSummary QgsWcsCapabilities::coverageSummary( QString const & theIdentifier )
{
QgsDebugMsg ( "entered");
QgsDebugMsg( "entered" );
foreach( QgsWcsCoverageSummary c, mCoveragesSupported )
{
if ( c.identifier == theIdentifier ) return c;
Expand Down
75 changes: 4 additions & 71 deletions src/providers/gdal/qgswcscapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,9 @@ class QgsWcsCapabilities : public QObject
* \brief Returns a map for the hierarchy of layers
*/
void coverageParents( QMap<int, int> &parents, QMap<int, QStringList> &parentNames ) const;

//! Get coverage summare for identifier
QgsWcsCoverageSummary coverageSummary ( QString const & theIdentifier );

/**
* Set the name of the connection for use in authentication where required
* \note added in 1.1
*/
//void setConnectionName( QString const & connName );

/**Returns the base url
*/
//QString baseUrl() const;
//! Get coverage summare for identifier
QgsWcsCoverageSummary coverageSummary( QString const & theIdentifier );

/**
* \brief Prepare the URI so that we can later simply append param=value
Expand All @@ -189,12 +179,6 @@ class QgsWcsCapabilities : public QObject
//! set authorization header
void setAuthorization( QNetworkRequest &request ) const;

//! get WCS Server version string
//QString wmsVersion();

//! get raster image encodings supported by the WCS Server, expressed as MIME types
//QStringList supportedImageEncodings();

/**
* \brief Returns the caption error text for the last error in this provider
*
Expand All @@ -220,8 +204,6 @@ class QgsWcsCapabilities : public QObject
*/
QString lastErrorFormat();

//static QVector<QgsWcsSupportedFormat> supportedFormats();

signals:

/** \brief emit a signal to notify of a progress event */
Expand All @@ -238,7 +220,7 @@ class QgsWcsCapabilities : public QObject
void showMessageBox( const QString& title, const QString& text );

//! Get tag name without namespace
QString stripNS ( const QString & name );
QString stripNS( const QString & name );

/**
* \brief Retrieve and parse the (cached) Capabilities document from the server
Expand Down Expand Up @@ -274,33 +256,11 @@ class QgsWcsCapabilities : public QObject

//! parse the WCS Layer XML element
void parseCoverageSummary( QDomElement const &e, QgsWcsCoverageSummary &coverageSummary,
QgsWcsCoverageSummary *parent = 0 );

//! parse the WCS Layer XML element
//void parseContents( QDomElement const &e, QgsWcsContents &contents );

/**
* \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 );

//! Data source URI of the WCS for this layer
//QString httpuri;

//! Name of the stored connection
//QString connectionName;
QgsWcsCoverageSummary *parent = 0 );

//! Data source uri
QgsDataSourceURI mUri;

//! URL part of URI (httpuri)
//QString mBaseUrl;

//! Response capabilities version
QString mVersion;

Expand Down Expand Up @@ -329,21 +289,6 @@ class QgsWcsCapabilities : public QObject
*/
QVector<QgsWcsCoverageSummary> mCoveragesSupported;

/**
* extents per layer (in WCS CRS:84 datum)
*/
//QMap<QString, QgsRectangle> extentForLayer;

/**
* available CRSs per layer
*/
//QMap<QString, QStringList > mCrsForLayer;

/**
* available formats per layer
*/
//QMap<QString, QStringList > mFormatForLayer;

/**
* The reply to the capabilities request
*/
Expand All @@ -363,12 +308,6 @@ class QgsWcsCapabilities : public QObject
*/
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 extentDirty;

int mCoverageCount;

//! number of layers and parents
Expand All @@ -380,12 +319,6 @@ class QgsWcsCapabilities : public QObject

//! Password for basic http authentication
QString mPassword;

//! whether to use hrefs from GetCapabilities (default) or
// the given base urls for GetMap and GetFeatureInfo
//bool mIgnoreGetCoverageUrl;


};


Expand Down
87 changes: 48 additions & 39 deletions src/providers/gdal/qgswcssourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,30 @@
#endif

QgsWCSSourceSelect::QgsWCSSourceSelect( QWidget * parent, Qt::WFlags fl, bool managerMode, bool embeddedMode )
: QgsOWSSourceSelect ( "WCS", parent, fl, managerMode, embeddedMode )
: QgsOWSSourceSelect( "WCS", parent, fl, managerMode, embeddedMode )
{
// Hide irrelevant widgets
// Hide irrelevant widgets
mWMSGroupBox->hide();
mLayersTab->layout()->removeWidget ( mWMSGroupBox );
mLayersTab->layout()->removeWidget( mWMSGroupBox );
mTabWidget->removeTab( mTabWidget->indexOf( mLayerOrderTab ) );
mTabWidget->removeTab( mTabWidget->indexOf( mTilesetsTab ) );
mTabWidget->removeTab( mTabWidget->indexOf( mSearchTab ) );
mAddDefaultButton->hide();
mLayersTreeWidget->setSelectionMode ( QAbstractItemView::SingleSelection );

mLayersTreeWidget->setSelectionMode( QAbstractItemView::SingleSelection );
}

QgsWCSSourceSelect::~QgsWCSSourceSelect()
{
}

void QgsWCSSourceSelect::populateLayerList( )
void QgsWCSSourceSelect::populateLayerList( )
{
QgsDebugMsg( "entered" );

mCapabilities.setUri ( mUri );
mLayersTreeWidget->clear();

mCapabilities.setUri( mUri );

if ( !mCapabilities.lastError().isEmpty() )
{
Expand All @@ -69,13 +71,12 @@ void QgsWCSSourceSelect::populateLayerList( )
QVector<QgsWcsCoverageSummary> coverages;
if ( !mCapabilities.supportedCoverages( coverages ) )
return;

QMap<int, QgsNumericSortTreeWidgetItem *> items;
QMap<int, int> coverageParents;
QMap<int, QStringList> coverageParentNames;
mCapabilities.coverageParents( coverageParents, coverageParentNames );

mLayersTreeWidget->clear();
mLayersTreeWidget->setSortingEnabled( true );

int coverageAndStyleCount = -1;
Expand All @@ -84,7 +85,7 @@ void QgsWCSSourceSelect::populateLayerList( )
coverage != coverages.end();
coverage++ )
{
QgsDebugMsg( QString( "coverage orderId = %1 identifier = %2").arg(coverage->orderId).arg(coverage->identifier) );
QgsDebugMsg( QString( "coverage orderId = %1 identifier = %2" ).arg( coverage->orderId ).arg( coverage->identifier ) );

QgsNumericSortTreeWidgetItem *lItem = createItem( coverage->orderId, QStringList() << coverage->identifier << coverage->title << coverage->abstract, items, coverageAndStyleCount, coverageParents, coverageParentNames );

Expand All @@ -109,37 +110,45 @@ void QgsWCSSourceSelect::populateLayerList( )

void QgsWCSSourceSelect::addClicked( )
{
QgsDebugMsg ( "entered");
QgsDataSourceURI uri = mUri;
QgsDebugMsg( "entered" );
QgsDataSourceURI uri = mUri;

QList<QTreeWidgetItem *> selectionList = mLayersTreeWidget->selectedItems();
if ( selectionList.size() < 1 ) return; // should not happen
QString identifier = selectionList.value(0)->data( 0, Qt::UserRole + 0 ).toString();
QgsDebugMsg ( " identifier = " + identifier );
QString identifier = selectionList.value( 0 )->data( 0, Qt::UserRole + 0 ).toString();
QgsDebugMsg( " identifier = " + identifier );

uri.setParam( "identifier", identifier );

uri.setParam( "crs", selectedCRS() );

QgsDebugMsg ( "selectedFormat = " + selectedFormat() );
uri.setParam( "format", selectedFormat() );
// Set crs only if necessary (multiple offered), so that we can decide in the
// provider if WCS 1.0 with RESPONSE_CRS has to be used. Not perfect, they can
// add more CRS in future and URI will be saved in project without any.
if ( selectedLayersCRSs().size() > 1 )
{
uri.setParam( "crs", selectedCRS() );
}

QgsDebugMsg( "selectedFormat = " + selectedFormat() );
uri.setParam( "format", selectedFormat() );

emit addRasterLayer( uri.encodedUri(), identifier, "gdal" );
}

void QgsWCSSourceSelect::on_mLayersTreeWidget_itemSelectionChanged()
{
QgsDebugMsg ( "entered");
QgsDebugMsg( "entered" );
populateFormats();

populateCRS();

mAddButton->setEnabled(true);
updateButtons();

mAddButton->setEnabled( true );
}

void QgsWCSSourceSelect::updateButtons()
{
QgsDebugMsg ( "entered");
QgsDebugMsg( "entered" );

if ( mLayersTreeWidget->selectedItems().isEmpty() )
{
Expand All @@ -158,16 +167,16 @@ void QgsWCSSourceSelect::updateButtons()

QList<QgsOWSSupportedFormat> QgsWCSSourceSelect::providerFormats()
{
QgsDebugMsg ( "entered");
QgsDebugMsg( "entered" );
QList<QgsOWSSupportedFormat> formats;
GDALAllRegister();

QgsDebugMsg ( QString( "GDAL drivers cont %1").arg(GDALGetDriverCount()) );
QgsDebugMsg( QString( "GDAL drivers cont %1" ).arg( GDALGetDriverCount() ) );
for ( int i = 0; i < GDALGetDriverCount(); ++i )
{
GDALDriverH driver = GDALGetDriver( i );
Q_CHECK_PTR( driver );

if ( !driver )
{
QgsLogger::warning( "unable to get driver " + QString::number( i ) );
Expand All @@ -176,23 +185,23 @@ QList<QgsOWSSupportedFormat> QgsWCSSourceSelect::providerFormats()

QString desc = GDALGetDescription( driver );

QString mimeType = GDALGetMetadataItem ( driver, "DMD_MIMETYPE", "" );
QString mimeType = GDALGetMetadataItem( driver, "DMD_MIMETYPE", "" );

if ( mimeType.isEmpty() ) continue;

desc = desc.isEmpty() ? mimeType : desc;

QgsOWSSupportedFormat format = { mimeType, desc };

QgsDebugMsg ( "add GDAL format " + mimeType + " " + desc );
QgsDebugMsg( "add GDAL format " + mimeType + " " + desc );

if ( mimeType == "image/tiff" )
{
formats.prepend ( format );
formats.prepend( format );
}
else
{
formats.append ( format );
formats.append( format );
}
}

Expand All @@ -201,27 +210,27 @@ QList<QgsOWSSupportedFormat> QgsWCSSourceSelect::providerFormats()

QStringList QgsWCSSourceSelect::selectedLayersFormats()
{
QgsDebugMsg ( "entered");
QgsDebugMsg( "entered" );

QList<QTreeWidgetItem *> selectionList = mLayersTreeWidget->selectedItems();
if ( selectionList.size() < 1 ) return QStringList();
QString identifier = selectionList.value(0)->data( 0, Qt::UserRole + 0 ).toString();
QgsDebugMsg ( " identifier = " + identifier );
QgsWcsCoverageSummary c = mCapabilities.coverageSummary(identifier);
return c.supportedFormat;
QString identifier = selectionList.value( 0 )->data( 0, Qt::UserRole + 0 ).toString();
QgsDebugMsg( " identifier = " + identifier );

QgsWcsCoverageSummary c = mCapabilities.coverageSummary( identifier );
return c.supportedFormat;
}

QStringList QgsWCSSourceSelect::selectedLayersCRSs()
{
QgsDebugMsg ( "entered");
QgsDebugMsg( "entered" );

QList<QTreeWidgetItem *> selectionList = mLayersTreeWidget->selectedItems();
if ( selectionList.size() < 1 ) return QStringList();
QString identifier = selectionList.value(0)->data( 0, Qt::UserRole + 0 ).toString();
QgsDebugMsg ( " identifier = " + identifier );
QString identifier = selectionList.value( 0 )->data( 0, Qt::UserRole + 0 ).toString();
QgsDebugMsg( " identifier = " + identifier );

QgsWcsCoverageSummary c = mCapabilities.coverageSummary(identifier);
QgsWcsCoverageSummary c = mCapabilities.coverageSummary( identifier );

return c.supportedCrs;
}
Expand Down