@@ -196,15 +196,15 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( )
196
196
197
197
if ( !preferredVersion.isEmpty () )
198
198
{
199
- // This is not
200
- if ( preferredVersion.startsWith ( " 1.0" ) )
199
+ // This is not
200
+ if ( preferredVersion.startsWith ( " 1.0" ) )
201
201
{
202
202
versions << " VERSION=" + preferredVersion;
203
203
}
204
- else if ( preferredVersion.startsWith ( " 1.1" ) )
204
+ else if ( preferredVersion.startsWith ( " 1.1" ) )
205
205
{
206
- // Ignored by UMN Mapserver 6.0.3, see below
207
- versions << " AcceptVersions=" + preferredVersion;
206
+ // Ignored by UMN Mapserver 6.0.3, see below
207
+ versions << " AcceptVersions=" + preferredVersion;
208
208
}
209
209
}
210
210
else
@@ -214,7 +214,7 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( )
214
214
versions << " AcceptVersions=1.1,1.0" << " VERSION=1.0" ;
215
215
}
216
216
217
- foreach ( QString v, versions )
217
+ foreach ( QString v, versions )
218
218
{
219
219
if ( retrieveServerCapabilities ( v ) )
220
220
{
@@ -427,7 +427,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
427
427
capabilities.abstract = domElementText ( docElem, " ServiceIdentification.Abstract" );
428
428
429
429
QList<QDomElement> operationElements = domElements ( docElem, " OperationsMetadata.Operation" );
430
- foreach ( QDomElement el, operationElements )
430
+ foreach ( QDomElement el, operationElements )
431
431
{
432
432
if ( el.attribute ( " name" ) == " GetCoverage" )
433
433
{
@@ -509,7 +509,7 @@ QStringList QgsWcsCapabilities::domElementsTexts( const QDomElement &element, co
509
509
QStringList list;
510
510
QList<QDomElement> elems = domElements ( element, path );
511
511
512
- foreach ( QDomElement el, elems )
512
+ foreach ( QDomElement el, elems )
513
513
{
514
514
list << el.text ();
515
515
}
@@ -539,9 +539,8 @@ QString QgsWcsCapabilities::domElementText( const QDomElement &element, const QS
539
539
QList<int > QgsWcsCapabilities::parseInts ( const QString &text )
540
540
{
541
541
QList<int > list;
542
- foreach ( QString s, text.split ( " " ) )
542
+ foreach ( QString s, text.split ( " " ) )
543
543
{
544
- int i;
545
544
bool ok;
546
545
list.append ( s.toInt ( &ok ) );
547
546
if ( !ok )
@@ -556,9 +555,8 @@ QList<int> QgsWcsCapabilities::parseInts( const QString &text )
556
555
QList<double > QgsWcsCapabilities::parseDoubles ( const QString &text )
557
556
{
558
557
QList<double > list;
559
- foreach ( QString s, text.split ( " " ) )
558
+ foreach ( QString s, text.split ( " " ) )
560
559
{
561
- int i;
562
560
bool ok;
563
561
list.append ( s.toDouble ( &ok ) );
564
562
if ( !ok )
@@ -758,7 +756,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
758
756
759
757
QgsDebugMsg ( QString ( " %1 envelopeElements found" ).arg ( envelopeElements.size () ) );
760
758
761
- foreach ( QDomElement el, envelopeElements )
759
+ foreach ( QDomElement el, envelopeElements )
762
760
{
763
761
QString srsName = el.attribute ( " srsName" );
764
762
@@ -779,10 +777,30 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
779
777
}
780
778
}
781
779
780
+ coverage->times = domElementsTexts ( coverageOfferingElement, " domainSet.temporalDomain.timePosition" );
781
+
782
+ QList<QDomElement> timePeriodElements = domElements ( coverageOfferingElement, " domainSet.temporalDomain.timePeriod" );
783
+
784
+ QgsDebugMsg ( QString ( " %1 timePeriod found" ).arg ( timePeriodElements.size () ) );
785
+
786
+ foreach ( QDomElement el, timePeriodElements )
787
+ {
788
+ QString beginPosition = domElementText ( el, " beginPosition" );
789
+ QString endPosition = domElementText ( el, " endPosition" );
790
+ QString timeResolution = domElementText ( el, " timeResolution" );
791
+ // Format used in request
792
+ QString time = beginPosition + " /" + endPosition;
793
+ if ( !timeResolution.isEmpty () )
794
+ {
795
+ time += " /" + timeResolution;
796
+ }
797
+ coverage->times << time ;
798
+ }
799
+
782
800
// Find native bounding box
783
801
if ( !coverage->nativeCrs .isEmpty () )
784
802
{
785
- foreach ( QString srsName, coverage->boundingBoxes .keys () )
803
+ foreach ( QString srsName, coverage->boundingBoxes .keys () )
786
804
{
787
805
if ( srsName == coverage->nativeCrs )
788
806
{
@@ -793,7 +811,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
793
811
794
812
// NULL / no data values
795
813
// TODO: handle multiple range sets
796
- foreach ( QString text, domElementsTexts ( coverageOfferingElement, " rangeSet.RangeSet.nullValue.singleValue" ) )
814
+ foreach ( QString text, domElementsTexts ( coverageOfferingElement, " rangeSet.RangeSet.nullValue.singleValue" ) )
797
815
{
798
816
bool ok;
799
817
double val = text.toDouble ( &ok );
@@ -840,7 +858,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom11( QByteArray const &xml, QgsW
840
858
841
859
QgsDebugMsg ( QString ( " %1 BoundingBox found" ).arg ( boundingBoxElements.size () ) );
842
860
843
- foreach ( QDomElement el, boundingBoxElements )
861
+ foreach ( QDomElement el, boundingBoxElements )
844
862
{
845
863
QString authid = crsUrnToAuthId ( el.attribute ( " crs" ) );
846
864
QList<double > low = parseDoubles ( domElementText ( el, " LowerCorner" ) );
@@ -876,9 +894,29 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom11( QByteArray const &xml, QgsW
876
894
// if urn:ogc:def:crs:OGC::imageCRS BoundingBox was not found
877
895
}
878
896
897
+ coverage->times = domElementsTexts ( docElem, " CoverageDescription.Domain.TemporalDomain.timePosition" );
898
+
899
+ QList<QDomElement> timePeriodElements = domElements ( docElem, " CoverageDescription.Domain.TemporalDomain.timePeriod" );
900
+
901
+ QgsDebugMsg ( QString ( " %1 timePeriod found" ).arg ( timePeriodElements.size () ) );
902
+
903
+ foreach ( QDomElement el, timePeriodElements )
904
+ {
905
+ QString beginPosition = domElementText ( el, " beginTime" );
906
+ QString endPosition = domElementText ( el, " endTime" );
907
+ QString timeResolution = domElementText ( el, " timeResolution" );
908
+ // Format used in request
909
+ QString time = beginPosition + " /" + endPosition;
910
+ if ( !timeResolution.isEmpty () )
911
+ {
912
+ time += " /" + timeResolution;
913
+ }
914
+ coverage->times << time ;
915
+ }
916
+
879
917
// NULL / no data values
880
918
// TODO: handle multiple fields / ranges (?)
881
- foreach ( QString text, domElementsTexts ( docElem, " CoverageDescription.Range.Field.NullValue" ) )
919
+ foreach ( QString text, domElementsTexts ( docElem, " CoverageDescription.Range.Field.NullValue" ) )
882
920
{
883
921
bool ok;
884
922
double val = text.toDouble ( &ok );
0 commit comments