mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-07 00:05:28 -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.title = firstChildText( e, QStringLiteral( "label" ) );
|
||||||
coverageSummary.abstract = firstChildText( e, QStringLiteral( "description" ) );
|
coverageSummary.abstract = firstChildText( e, QStringLiteral( "description" ) );
|
||||||
|
|
||||||
|
parseMetadataLink( e, coverageSummary.metadataLink );
|
||||||
|
|
||||||
QList<QDomElement> posElements = domElements( e, QStringLiteral( "lonLatEnvelope.pos" ) );
|
QList<QDomElement> posElements = domElements( e, QStringLiteral( "lonLatEnvelope.pos" ) );
|
||||||
if ( posElements.size() != 2 )
|
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 ) );
|
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 )
|
bool QgsWcsCapabilities::convertToDom( QByteArray const &xml )
|
||||||
{
|
{
|
||||||
QgsDebugMsgLevel( QStringLiteral( "Entered." ), 4 );
|
QgsDebugMsgLevel( QStringLiteral( "Entered." ), 4 );
|
||||||
|
@ -34,6 +34,13 @@
|
|||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
|
|
||||||
|
//! Metadata Link Property structure
|
||||||
|
struct QgsWcsMetadataLinkProperty
|
||||||
|
{
|
||||||
|
QString metadataType;
|
||||||
|
QString xlinkHref;
|
||||||
|
};
|
||||||
|
|
||||||
//! CoverageSummary structure
|
//! CoverageSummary structure
|
||||||
struct QgsWcsCoverageSummary
|
struct QgsWcsCoverageSummary
|
||||||
{
|
{
|
||||||
@ -48,6 +55,8 @@ struct QgsWcsCoverageSummary
|
|||||||
QList<double> nullValues;
|
QList<double> nullValues;
|
||||||
QgsRectangle wgs84BoundingBox; // almost useless, we need the native
|
QgsRectangle wgs84BoundingBox; // almost useless, we need the native
|
||||||
QString nativeCrs;
|
QString nativeCrs;
|
||||||
|
//Optional metadataLink
|
||||||
|
QgsWcsMetadataLinkProperty metadataLink;
|
||||||
// Map of bounding boxes, key is CRS name (srsName), e.g. EPSG:4326
|
// Map of bounding boxes, key is CRS name (srsName), e.g. EPSG:4326
|
||||||
QMap<QString, QgsRectangle> boundingBoxes;
|
QMap<QString, QgsRectangle> boundingBoxes;
|
||||||
QgsRectangle nativeBoundingBox;
|
QgsRectangle nativeBoundingBox;
|
||||||
@ -114,6 +123,9 @@ class QgsWcsCapabilities : public QObject
|
|||||||
*/
|
*/
|
||||||
void coverageParents( QMap<int, int> &parents, QMap<int, QStringList> &parentNames ) const;
|
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
|
//! Gets coverage summary for identifier
|
||||||
QgsWcsCoverageSummary coverage( QString const &identifier );
|
QgsWcsCoverageSummary coverage( QString const &identifier );
|
||||||
|
|
||||||
@ -212,6 +224,9 @@ class QgsWcsCapabilities : public QObject
|
|||||||
//! Gets sub elements texts by path
|
//! Gets sub elements texts by path
|
||||||
static QStringList domElementsTexts( const QDomElement &element, const QString &path );
|
static QStringList domElementsTexts( const QDomElement &element, const QString &path );
|
||||||
|
|
||||||
|
//! Gets given element link tag value
|
||||||
|
static QString elementLink( QDomElement const &e );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! \brief emit a signal to notify of a progress event
|
//! \brief emit a signal to notify of a progress event
|
||||||
void progressChanged( int progress, int totalSteps );
|
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( "Name (identifier)" ), coverage.identifier );
|
||||||
metadata += htmlRow( tr( "Title" ), coverage.title );
|
metadata += htmlRow( tr( "Title" ), coverage.title );
|
||||||
metadata += htmlRow( tr( "Abstract" ), coverage.abstract );
|
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
|
#if 0
|
||||||
// We don't have size, nativeCrs, nativeBoundingBox etc. until describe coverage which would be heavy for all coverages
|
// 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 ) );
|
metadata += htmlRow( tr( "Fixed Width" ), QString::number( coverage.width ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user