mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-28 00:04:04 -04:00
pull metadata link from wcs capabilities
This commit is contained in:
parent
77497b9492
commit
02cf6f3bb6
@ -736,6 +736,8 @@ void QgsWcsCapabilities::parseCoverageOfferingBrief( QDomElement const &e, QgsWc
|
||||
coverageSummary.title = firstChildText( e, QStringLiteral( "label" ) );
|
||||
coverageSummary.abstract = firstChildText( e, QStringLiteral( "description" ) );
|
||||
|
||||
parseMetadataLink( e, coverageSummary.metadataLink );
|
||||
|
||||
QList<QDomElement> posElements = domElements( e, QStringLiteral( "lonLatEnvelope.pos" ) );
|
||||
if ( posElements.size() != 2 )
|
||||
{
|
||||
@ -765,6 +767,28 @@ void QgsWcsCapabilities::parseCoverageOfferingBrief( QDomElement const &e, QgsWc
|
||||
QgsDebugMsg( QStringLiteral( "coverage orderId = %1 identifier = %2" ).arg( coverageSummary.orderId ).arg( coverageSummary.identifier ) );
|
||||
}
|
||||
|
||||
void QgsWcsCapabilities::parseMetadataLink( QDomElement const &e, QgsWcsMetadataLinkProperty &metadataLink )
|
||||
{
|
||||
QDomElement metadataElement = firstChild( e, QStringLiteral( "metadataLink" ) );
|
||||
|
||||
if ( !metadataElement.isNull() )
|
||||
{
|
||||
metadataLink.metadataType = metadataElement.attribute( QStringLiteral( "metadataType" ) );
|
||||
metadataLink.xlinkHref = elementLink( metadataElement );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QString QgsWcsCapabilities::elementLink( QDomElement const &e )
|
||||
{
|
||||
if ( !e.isNull() )
|
||||
{
|
||||
return QUrl::fromEncoded( e.attribute( QStringLiteral( "xlink:href" ) ).toUtf8() ).toString();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool QgsWcsCapabilities::convertToDom( QByteArray const &xml )
|
||||
{
|
||||
QgsDebugMsgLevel( QStringLiteral( "Entered." ), 4 );
|
||||
|
@ -34,6 +34,13 @@
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
|
||||
//! Metadata Link Property structure
|
||||
struct QgsWcsMetadataLinkProperty
|
||||
{
|
||||
QString metadataType;
|
||||
QString xlinkHref;
|
||||
};
|
||||
|
||||
//! CoverageSummary structure
|
||||
struct QgsWcsCoverageSummary
|
||||
{
|
||||
@ -48,6 +55,8 @@ struct QgsWcsCoverageSummary
|
||||
QList<double> nullValues;
|
||||
QgsRectangle wgs84BoundingBox; // almost useless, we need the native
|
||||
QString nativeCrs;
|
||||
//Optional metadataLink
|
||||
QgsWcsMetadataLinkProperty metadataLink;
|
||||
// Map of bounding boxes, key is CRS name (srsName), e.g. EPSG:4326
|
||||
QMap<QString, QgsRectangle> boundingBoxes;
|
||||
QgsRectangle nativeBoundingBox;
|
||||
@ -114,6 +123,9 @@ class QgsWcsCapabilities : public QObject
|
||||
*/
|
||||
void coverageParents( QMap<int, int> &parents, QMap<int, QStringList> &parentNames ) const;
|
||||
|
||||
// Parse metadata element from the document
|
||||
void parseMetadataLink( QDomElement const &e, QgsWcsMetadataLinkProperty &metadataLink );
|
||||
|
||||
//! Gets coverage summary for identifier
|
||||
QgsWcsCoverageSummary coverage( QString const &identifier );
|
||||
|
||||
@ -212,6 +224,9 @@ class QgsWcsCapabilities : public QObject
|
||||
//! Gets sub elements texts by path
|
||||
static QStringList domElementsTexts( const QDomElement &element, const QString &path );
|
||||
|
||||
//! Gets given element link tag value
|
||||
static QString elementLink( QDomElement const &e );
|
||||
|
||||
signals:
|
||||
//! \brief emit a signal to notify of a progress event
|
||||
void progressChanged( int progress, int totalSteps );
|
||||
|
@ -1244,6 +1244,14 @@ QString QgsWcsProvider::coverageMetadata( const QgsWcsCoverageSummary &coverage
|
||||
metadata += htmlRow( tr( "Name (identifier)" ), coverage.identifier );
|
||||
metadata += htmlRow( tr( "Title" ), coverage.title );
|
||||
metadata += htmlRow( tr( "Abstract" ), coverage.abstract );
|
||||
|
||||
if ( !coverage.metadataLink.metadataType.isNull() &&
|
||||
!coverage.metadataLink.xlinkHref.isNull() )
|
||||
{
|
||||
metadata += htmlRow( tr( "Metadata Type" ), coverage.metadataLink.metadataType );
|
||||
metadata += htmlRow( tr( "Metadata Link" ), coverage.metadataLink.xlinkHref );
|
||||
}
|
||||
|
||||
#if 0
|
||||
// We don't have size, nativeCrs, nativeBoundingBox etc. until describe coverage which would be heavy for all coverages
|
||||
metadata += htmlRow( tr( "Fixed Width" ), QString::number( coverage.width ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user