65
65
#include < QDir>
66
66
#endif
67
67
68
- /*
69
- QgsWcsCapabilities::QgsWcsCapabilities( QString const &theUri )
70
- {
71
- mUri.setEncodedUri( theUri );
72
-
73
- QgsDebugMsg( "theUri = " + theUri );
74
- }
75
- */
76
-
77
68
QgsWcsCapabilities::QgsWcsCapabilities ( QgsDataSourceURI const &theUri ):
78
69
mUri( theUri ),
79
70
mCoverageCount( 0 )
@@ -140,7 +131,7 @@ bool QgsWcsCapabilities::supportedCoverages( QVector<QgsWcsCoverageSummary> &cov
140
131
141
132
QString QgsWcsCapabilities::getCoverageUrl () const
142
133
{
143
- QString url = mCapabilities .operationsMetadata .getCoverage .dcp . http . get . xlinkHref ;
134
+ QString url = mCapabilities .operationsMetadata .getCoverage .getUrl ;
144
135
if ( url.isEmpty () )
145
136
{
146
137
url = mUri .param ( " url" );
@@ -404,44 +395,31 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
404
395
return false ;
405
396
}
406
397
407
- // Start walking through XML.
408
- QDomNode n = docElem.firstChild ();
398
+ if ( mVersion .startsWith ( " 1.0" ) )
399
+ {
400
+ capabilities.title = domElementText ( docElem, " Service.name" );
401
+ capabilities.abstract = domElementText ( docElem, " Service.description" );
402
+ // There is also "label" in 1.0
403
+
404
+ capabilities.operationsMetadata .getCoverage .getUrl = domElement ( docElem, " Capability.Request.GetCoverage.DCPType.HTTP.Get.OnlineResource" ).attribute ( " xlink:href" );
409
405
410
- while ( !n.isNull () )
406
+ parseContentMetadata ( domElement ( docElem, " ContentMetadata" ), capabilities.contents );
407
+ }
408
+ else if ( mVersion .startsWith ( " 1.1" ) )
411
409
{
412
- QDomElement e = n.toElement ();
413
- if ( !e.isNull () )
410
+ capabilities.title = domElementText ( docElem, " ServiceIdentification.Title" );
411
+ capabilities.abstract = domElementText ( docElem, " ServiceIdentification.Abstract" );
412
+
413
+ QList<QDomElement> operationElements = domElements ( docElem, " OperationsMetadata.Operation" );
414
+ foreach ( QDomElement el, operationElements )
414
415
{
415
- // Version 1.0
416
- QString tagName = stripNS ( e.tagName () );
417
- QgsDebugMsg ( tagName );
418
- if ( tagName == " Service" )
419
- {
420
- parseService ( e, capabilities.serviceIdentification );
421
- }
422
- else if ( tagName == " Capability" )
423
- {
424
- parseCapability ( e, capabilities.operationsMetadata );
425
- }
426
- else if ( tagName == " ContentMetadata" )
416
+ if ( el.attribute ( " name" ) == " GetCoverage" )
427
417
{
428
- parseContentMetadata ( e, capabilities.contents );
429
- }
430
- // Version 1.1
431
- else if ( tagName == " ServiceIdentification" )
432
- {
433
- parseServiceIdentification ( e, capabilities.serviceIdentification );
434
- }
435
- else if ( tagName == " OperationsMetadata" )
436
- {
437
- parseOperationsMetadata ( e, capabilities.operationsMetadata );
438
- }
439
- else if ( tagName == " Contents" )
440
- {
441
- parseCoverageSummary ( e, capabilities.contents );
418
+ capabilities.operationsMetadata .getCoverage .getUrl = domElement ( el, " DCP.HTTP.Get" ).attribute ( " xlink:href" );
442
419
}
443
420
}
444
- n = n.nextSibling ();
421
+
422
+ parseCoverageSummary ( domElement ( docElem, " Contents" ), capabilities.contents );
445
423
}
446
424
447
425
return true ;
@@ -458,13 +436,11 @@ QDomElement QgsWcsCapabilities::firstChild( const QDomElement &element, const QS
458
436
QString tagName = stripNS ( el.tagName () );
459
437
if ( tagName == name )
460
438
{
461
- // QgsDebugMsg( name + " found" );
462
439
return el;
463
440
}
464
441
}
465
442
n1 = n1.nextSibling ();
466
443
}
467
- // QgsDebugMsg( name + " not found" );
468
444
return QDomElement ();
469
445
}
470
446
@@ -473,7 +449,6 @@ QString QgsWcsCapabilities::firstChildText( const QDomElement &element, const QS
473
449
QDomElement el = firstChild ( element, name );
474
450
if ( !el.isNull () )
475
451
{
476
- // QgsDebugMsg( name + " : " + el.text() );
477
452
return el.text ();
478
453
}
479
454
return QString ();
@@ -497,7 +472,6 @@ QList<QDomElement> QgsWcsCapabilities::domElements( const QDomElement &element,
497
472
QString tagName = stripNS ( el.tagName () );
498
473
if ( tagName == name )
499
474
{
500
- // QgsDebugMsg( name + " found" );
501
475
if ( names.size () == 0 )
502
476
{
503
477
list.append ( el );
@@ -514,6 +488,18 @@ QList<QDomElement> QgsWcsCapabilities::domElements( const QDomElement &element,
514
488
return list;
515
489
}
516
490
491
+ QStringList QgsWcsCapabilities::domElementsTexts ( const QDomElement &element, const QString &path )
492
+ {
493
+ QStringList list;
494
+ QList<QDomElement> elems = domElements ( element, path );
495
+
496
+ foreach ( QDomElement el, elems )
497
+ {
498
+ list << el.text ();
499
+ }
500
+ return list;
501
+ }
502
+
517
503
QDomElement QgsWcsCapabilities::domElement ( const QDomElement &element, const QString & path )
518
504
{
519
505
QStringList names = path.split ( " ." );
@@ -568,42 +554,23 @@ QList<double> QgsWcsCapabilities::parseDoubles( const QString &text )
568
554
return list;
569
555
}
570
556
571
- QString QgsWcsCapabilities::crsUrnToAuthId ( const QString &text )
557
+ QString QgsWcsCapabilities::crsUrnToAuthId ( const QString &text )
572
558
{
573
- QString urnCrs = text;
574
-
575
559
QString authid;
576
560
577
- // example: urn:ogc:def:crs:EPSG::4326
578
- QStringList split = urnCrs.remove (" urn:ogc:def:crs:" ).split (" :" );
579
- if ( split.size () == 3 )
561
+ // URN format: urn:ogc:def:objectType:authority:version:code
562
+ // URN example: urn:ogc:def:crs:EPSG::4326
563
+ QStringList urn = text.split ( " :" );
564
+ if ( urn.size () == 7 )
580
565
{
581
- authid = QString ( " %1:%2 " ). arg ( split. value ( 0 ) ). arg (split. value (2 ) );
566
+ authid = urn. value ( 4 ) + " : " + urn. value ( 6 );
582
567
}
568
+
583
569
return authid;
584
570
}
585
571
586
572
// ------------------------ 1.0 ----------------------------------------------
587
- void QgsWcsCapabilities::parseService ( const QDomElement &e, QgsWcsServiceIdentification &serviceIdentification ) // 1.0
588
- {
589
- serviceIdentification.title = firstChildText ( e, " name" );
590
- serviceIdentification.abstract = firstChildText ( e, " description" );
591
- // 1.0 has also "label"
592
- }
593
-
594
- void QgsWcsCapabilities::parseCapability ( QDomElement const & e, QgsWcsOperationsMetadata &operationsMetadata )
595
- {
596
- QDomElement requestElement = firstChild ( e, " Request" );
597
- QDomElement getCoverageElement = firstChild ( requestElement, " GetCoverage" );
598
- QDomElement dcpTypeElement = firstChild ( getCoverageElement, " DCPType" );
599
- QDomElement httpElement = firstChild ( dcpTypeElement, " HTTP" );
600
- QDomElement getElement = firstChild ( httpElement, " Get" );
601
- QDomElement onlineResourceElement = firstChild ( getElement, " OnlineResource" );
602
-
603
- operationsMetadata.getCoverage .dcp .http .get .xlinkHref = onlineResourceElement.attribute ( " xlink:href" );
604
573
605
- QgsDebugMsg ( " getCoverage.dcp.http.get.xlinkHref = " + operationsMetadata.getCoverage .dcp .http .get .xlinkHref );
606
- }
607
574
608
575
void QgsWcsCapabilities::parseContentMetadata ( QDomElement const & e, QgsWcsCoverageSummary &coverageSummary )
609
576
{
@@ -619,13 +586,12 @@ void QgsWcsCapabilities::parseContentMetadata( QDomElement const & e, QgsWcsCove
619
586
{
620
587
QgsWcsCoverageSummary subCoverageSummary;
621
588
622
- subCoverageSummary.described = false ;
623
- subCoverageSummary.width = 0 ;
624
- subCoverageSummary.height = 0 ;
625
- subCoverageSummary.hasSize = false ;
589
+ initCoverageSummary ( subCoverageSummary );
626
590
627
591
parseCoverageOfferingBrief ( el, subCoverageSummary, &coverageSummary );
628
592
593
+ subCoverageSummary.valid = true ;
594
+
629
595
coverageSummary.coverageSummary .push_back ( subCoverageSummary );
630
596
}
631
597
}
@@ -643,44 +609,20 @@ void QgsWcsCapabilities::parseCoverageOfferingBrief( QDomElement const & e, QgsW
643
609
coverageSummary.title = firstChildText ( e, " label" );
644
610
coverageSummary.abstract = firstChildText ( e, " description" );
645
611
646
- QDomElement lonLatEnvelopeElement = firstChild ( e, " lonLatEnvelope" );
647
-
648
- QDomNodeList posNodes = lonLatEnvelopeElement.elementsByTagName ( " gml:pos" );
649
- QList<double > lon, lat;
650
- for ( int i = 0 ; i < posNodes.size (); i++ )
612
+ QList<QDomElement> posElements = domElements ( e, " lonLatEnvelope.pos" );
613
+ if ( posElements.size () != 2 )
651
614
{
652
- QDomNode posNode = posNodes.at ( i );
653
- QString lonLatText = posNode.toElement ().text ();
654
- QStringList lonLat = lonLatText.split ( QRegExp ( " +" ) );
655
- if ( lonLat.size () != 2 )
656
- {
657
- QgsDebugMsg ( " Cannot parse lonLatEnvelope: " + lonLatText );
658
- continue ;
659
- }
660
- double lo, la;
661
- bool loOk, laOk;
662
- lo = lonLat.value ( 0 ).toDouble ( &loOk );
663
- la = lonLat.value ( 1 ).toDouble ( &laOk );
664
- if ( loOk && laOk )
665
- {
666
- lon << lo;
667
- lat << la;
668
- }
669
- else
670
- {
671
- QgsDebugMsg ( " Cannot parse lonLatEnvelope: " + lonLatText );
672
- }
615
+ QgsDebugMsg ( " Wrong number of pos elements" );
673
616
}
674
- if ( lon. size () == 2 )
617
+ else
675
618
{
676
- double w, e, s, n;
677
- w = qMin ( lon[0 ], lon[1 ] );
678
- e = qMax ( lon[0 ], lon[1 ] );
679
- n = qMax ( lat[0 ], lat[1 ] );
680
- s = qMin ( lat[0 ], lat[1 ] );
681
-
682
- coverageSummary.wgs84BoundingBox = QgsRectangle ( w, s, e, n );
683
- QgsDebugMsg ( " wgs84BoundingBox = " + coverageSummary.wgs84BoundingBox .toString () );
619
+ QList<double > low = parseDoubles ( posElements.value ( 0 ).text () );
620
+ QList<double > high = parseDoubles ( posElements.value ( 1 ).text () );
621
+ if ( low.size () == 2 && high.size () == 2 )
622
+ {
623
+ coverageSummary.wgs84BoundingBox = QgsRectangle ( low[0 ], low[1 ], high[0 ], high[1 ] ) ;
624
+ QgsDebugMsg ( " wgs84BoundingBox = " + coverageSummary.wgs84BoundingBox .toString () );
625
+ }
684
626
}
685
627
686
628
if ( !coverageSummary.identifier .isEmpty () )
@@ -751,46 +693,15 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
751
693
if ( coverageOfferingElement.isNull () ) return false ;
752
694
QDomElement supportedCRSsElement = firstChild ( coverageOfferingElement, " supportedCRSs" );
753
695
754
- QDomNode n1 = supportedCRSsElement.firstChild ();
755
- while ( !n1.isNull () )
756
- {
757
- QDomElement el = n1.toElement ();
758
- if ( !el.isNull () )
759
- {
760
- QString tagName = stripNS ( el.tagName () );
761
-
762
- if ( tagName == " requestResponseCRSs" ) // requestCRSs + responseCRSs alternative
763
- {
764
- coverage->supportedCrs << el.text ();
765
- }
766
- else if ( tagName == " nativeCRSs" ) // optional
767
- {
768
- coverage->nativeCrs = el.text ();
769
- }
770
- // TODO: requestCRSs, responseCRSs - must be then implemented also in provider
771
- }
772
- n1 = n1.nextSibling ();
773
- }
696
+ // requestResponseCRSs and requestCRSs + responseCRSs are alternatives
697
+ coverage->supportedCrs = domElementsTexts ( coverageOfferingElement, " supportedCRSs.requestResponseCRSs" );
698
+ // TODO: requestCRSs, responseCRSs - must be then implemented also in provider
774
699
QgsDebugMsg ( " supportedCrs = " + coverage->supportedCrs .join ( " ," ) );
775
700
776
- QDomElement supportedFormatsElement = firstChild ( coverageOfferingElement, " supportedFormats" );
777
-
778
- n1 = supportedFormatsElement.firstChild ();
779
- while ( !n1.isNull () )
780
- {
781
- QDomElement el = n1.toElement ();
782
- if ( !el.isNull () )
783
- {
784
- QString tagName = stripNS ( el.tagName () );
701
+ coverage->nativeCrs = domElementText ( coverageOfferingElement, " supportedCRSs.nativeCRSs" );
785
702
786
- if ( tagName == " formats" )
787
- {
788
- // may be GTiff, GeoTIFF, TIFF, GIF, ....
789
- coverage->supportedFormat << el.text ();
790
- }
791
- }
792
- n1 = n1.nextSibling ();
793
- }
703
+ // may be GTiff, GeoTIFF, TIFF, GIF, ....
704
+ coverage->supportedFormat = domElementsTexts ( coverageOfferingElement, " supportedFormats.formats" );
794
705
QgsDebugMsg ( " supportedFormat = " + coverage->supportedFormat .join ( " ," ) );
795
706
796
707
// spatialDomain and Grid/RectifiedGrid are optional according to specificationi.
@@ -822,7 +733,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
822
733
// it should contain gml:Point but mapserver 6.0.3 / WCS 1.0.0 is using gml:pos instead)
823
734
// RectifiedGrid also contains 2 gml:offsetVector which could be used to get resolution
824
735
// but it should be sufficient to calc resolution from size
825
-
736
+
826
737
// TODO: check if coverage is rotated, in that case probably treat as without size
827
738
// or recalc resolution from rotated grid to base CRS
828
739
}
@@ -836,28 +747,28 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
836
747
QString srsName = el.attribute ( " srsName" );
837
748
838
749
QList<QDomElement> posElements = domElements ( el, " pos" );
839
- if ( posElements.size () != 2 )
750
+ if ( posElements.size () != 2 )
840
751
{
841
- QgsDebugMsg ( " Wrong number of pos elements" );
752
+ QgsDebugMsg ( " Wrong number of pos elements" );
842
753
continue ;
843
754
}
844
755
845
- QList<double > low = parseDoubles ( posElements.value (0 ).text () );
846
- QList<double > high = parseDoubles ( posElements.value (1 ).text () );
756
+ QList<double > low = parseDoubles ( posElements.value ( 0 ).text () );
757
+ QList<double > high = parseDoubles ( posElements.value ( 1 ).text () );
847
758
if ( low.size () == 2 && high.size () == 2 )
848
759
{
849
- QgsRectangle box ( low[0 ], low[1 ], high[0 ], high[1 ] ) ;
760
+ QgsRectangle box ( low[0 ], low[1 ], high[0 ], high[1 ] ) ;
850
761
coverage->boundingBoxes .insert ( srsName, box );
851
- QgsDebugMsg ( " Envelope: " + srsName + " : " + box.toString () );
762
+ QgsDebugMsg ( " Envelope: " + srsName + " : " + box.toString () );
852
763
}
853
764
}
854
765
855
766
// Find native bounding box
856
767
if ( !coverage->nativeCrs .isEmpty () )
857
768
{
858
- foreach ( QString srsName, coverage->boundingBoxes .keys () )
769
+ foreach ( QString srsName, coverage->boundingBoxes .keys () )
859
770
{
860
- if ( srsName == coverage->nativeCrs )
771
+ if ( srsName == coverage->nativeCrs )
861
772
{
862
773
coverage->nativeBoundingBox = coverage->boundingBoxes .value ( srsName );
863
774
}
@@ -903,23 +814,23 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom11( QByteArray const &xml, QgsW
903
814
904
815
foreach ( QDomElement el, boundingBoxElements )
905
816
{
906
- QString authid = crsUrnToAuthId ( el.attribute ( " crs" ) );
817
+ QString authid = crsUrnToAuthId ( el.attribute ( " crs" ) );
907
818
QList<double > low = parseDoubles ( domElementText ( el, " LowerCorner" ) );
908
819
QList<double > high = parseDoubles ( domElementText ( el, " UpperCorner" ) );
909
820
910
821
if ( low.size () != 2 && high.size () != 2 ) continue ;
911
822
912
823
if ( el.attribute ( " crs" ) == " urn:ogc:def:crs:OGC::imageCRS" )
913
824
{
914
- coverage->width = (int ) ( high[0 ] - low[0 ] + 1 );
915
- coverage->height = (int ) ( high[1 ] - low[1 ] + 1 );
825
+ coverage->width = ( int ) ( high[0 ] - low[0 ] + 1 );
826
+ coverage->height = ( int ) ( high[1 ] - low[1 ] + 1 );
916
827
coverage->hasSize = true ;
917
828
}
918
829
else
919
830
{
920
- QgsRectangle box ( low[0 ], low[1 ], high[0 ], high[1 ] ) ;
831
+ QgsRectangle box ( low[0 ], low[1 ], high[0 ], high[1 ] ) ;
921
832
coverage->boundingBoxes .insert ( authid, box );
922
- QgsDebugMsg ( " BoundingBox: " + authid + " : " + box.toString () );
833
+ QgsDebugMsg ( " BoundingBox: " + authid + " : " + box.toString () );
923
834
}
924
835
}
925
836
QgsDebugMsg ( QString ( " width = %1 height = %2" ).arg ( coverage->width ).arg ( coverage->height ) );
@@ -929,7 +840,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom11( QByteArray const &xml, QgsW
929
840
930
841
if ( !gridCRSElement.isNull () )
931
842
{
932
- QString crsUrn = firstChildText ( gridCRSElement, " GridBaseCRS" );
843
+ QString crsUrn = firstChildText ( gridCRSElement, " GridBaseCRS" );
933
844
coverage->nativeCrs = crsUrnToAuthId ( crsUrn );
934
845
QgsDebugMsg ( " nativeCrs = " + coverage->nativeCrs );
935
846
@@ -941,48 +852,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom11( QByteArray const &xml, QgsW
941
852
942
853
return true ;
943
854
}
944
- void QgsWcsCapabilities::parseServiceIdentification ( const QDomElement &e, QgsWcsServiceIdentification &serviceIdentification ) // 1.1
945
- {
946
- serviceIdentification.title = firstChildText ( e, " Title" );
947
- serviceIdentification.abstract = firstChildText ( e, " Abstract" );
948
- }
949
-
950
- void QgsWcsCapabilities::parseHttp ( QDomElement const & e, QgsWcsHTTP& http )
951
- {
952
- http.get .xlinkHref = firstChild ( e, " Get" ).attribute ( " xlink:href" );
953
- QgsDebugMsg ( " http.get.xlinkHref = " + http.get .xlinkHref );
954
- }
955
-
956
- void QgsWcsCapabilities::parseDcp ( QDomElement const & e, QgsWcsDCP& dcp )
957
- {
958
- QDomElement el = firstChild ( e, " HTTP" );
959
- parseHttp ( el, dcp.http );
960
- }
961
-
962
- void QgsWcsCapabilities::parseOperation ( QDomElement const & e, QgsWcsOperation& operation )
963
- {
964
- QDomElement el = firstChild ( e, " DCP" );
965
- parseDcp ( el, operation.dcp );
966
- }
967
-
968
- void QgsWcsCapabilities::parseOperationsMetadata ( QDomElement const & e, QgsWcsOperationsMetadata &operationsMetadata )
969
- {
970
- QDomNode n1 = e.firstChild ();
971
- while ( !n1.isNull () )
972
- {
973
- QDomElement el = n1.toElement ();
974
- if ( !el.isNull () )
975
- {
976
- QString tagName = stripNS ( el.tagName () );
977
855
978
- if ( tagName == " Operation" && el.attribute ( " name" ) == " GetCoverage" )
979
- {
980
- parseOperation ( el, operationsMetadata.getCoverage );
981
- }
982
- }
983
- n1 = n1.nextSibling ();
984
- }
985
- }
986
856
987
857
void QgsWcsCapabilities::parseCoverageSummary ( QDomElement const & e, QgsWcsCoverageSummary &coverageSummary, QgsWcsCoverageSummary *parent )
988
858
{
@@ -1009,35 +879,22 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove
1009
879
else if ( tagName == " SupportedCRS" )
1010
880
{
1011
881
// TODO: SupportedCRS may be URL referencing a document
1012
- // URN format: urn:ogc:def:objectType:authority:version:code
1013
- // URN example: urn:ogc:def:crs:EPSG::4326
1014
- QStringList urn = el.text ().split ( " :" );
1015
- if ( urn.size () == 7 )
1016
- {
1017
- coverageSummary.supportedCrs << urn.value ( 4 ) + " :" + urn.value ( 6 );
1018
- }
882
+ coverageSummary.supportedCrs << crsUrnToAuthId ( el.text () );
1019
883
}
1020
884
else if ( tagName == " WGS84BoundingBox" )
1021
885
{
1022
- QDomElement wBoundLongitudeElem, eBoundLongitudeElem, sBoundLatitudeElem , nBoundLatitudeElem;
1023
-
1024
- QStringList lower = n1.namedItem ( " ows:LowerCorner" ).toElement ().text ().split ( QRegExp ( " +" ) );
1025
- QStringList upper = n1.namedItem ( " ows:UpperCorner" ).toElement ().text ().split ( QRegExp ( " +" ) );
1026
-
1027
- double w, e, s, n;
1028
- bool wOk, eOk, sOk , nOk;
1029
- w = lower.value ( 0 ).toDouble ( &wOk );
1030
- s = lower.value ( 1 ).toDouble ( &sOk );
1031
- e = upper.value ( 0 ).toDouble ( &eOk );
1032
- n = upper.value ( 1 ).toDouble ( &nOk );
1033
- if ( wOk && eOk && sOk && nOk )
886
+ QList<double > low = parseDoubles ( domElementText ( el, " LowerCorner" ) );
887
+ QList<double > high = parseDoubles ( domElementText ( el, " UpperCorner" ) );
888
+
889
+ if ( low.size () == 2 && high.size () == 2 )
1034
890
{
1035
- coverageSummary.wgs84BoundingBox = QgsRectangle ( w, s, e, n );
891
+ coverageSummary.wgs84BoundingBox = QgsRectangle ( low[ 0 ], low[ 1 ], high[ 0 ], high[ 1 ] );
1036
892
}
1037
893
}
1038
894
}
1039
895
n1 = n1.nextSibling ();
1040
896
}
897
+ QgsDebugMsg ( " supportedFormat = " + coverageSummary.supportedFormat .join ( " ," ) );
1041
898
1042
899
// We collected params to be inherited, do children
1043
900
n1 = e.firstChild ();
@@ -1054,16 +911,14 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove
1054
911
1055
912
QgsWcsCoverageSummary subCoverageSummary;
1056
913
1057
- subCoverageSummary.described = false ;
1058
- subCoverageSummary.width = 0 ;
1059
- subCoverageSummary.height = 0 ;
1060
- subCoverageSummary.hasSize = false ;
914
+ initCoverageSummary ( subCoverageSummary );
1061
915
1062
916
// Inherit
1063
917
subCoverageSummary.supportedCrs = coverageSummary.supportedCrs ;
1064
918
subCoverageSummary.supportedFormat = coverageSummary.supportedFormat ;
1065
919
1066
920
parseCoverageSummary ( el, subCoverageSummary, &coverageSummary );
921
+ subCoverageSummary.valid = true ;
1067
922
1068
923
coverageSummary.coverageSummary .push_back ( subCoverageSummary );
1069
924
}
@@ -1097,6 +952,15 @@ void QgsWcsCapabilities::coverageParents( QMap<int, int> &parents, QMap<int, QSt
1097
952
parentNames = mCoverageParentIdentifiers ;
1098
953
}
1099
954
955
+ void QgsWcsCapabilities::initCoverageSummary ( QgsWcsCoverageSummary &coverageSummary )
956
+ {
957
+ coverageSummary.valid = false ;
958
+ coverageSummary.described = false ;
959
+ coverageSummary.width = 0 ;
960
+ coverageSummary.height = 0 ;
961
+ coverageSummary.hasSize = false ;
962
+ }
963
+
1100
964
QString QgsWcsCapabilities::lastErrorTitle ()
1101
965
{
1102
966
return mErrorTitle ;
@@ -1131,18 +995,28 @@ void QgsWcsCapabilities::showMessageBox( const QString& title, const QString& te
1131
995
message->showMessage ();
1132
996
}
1133
997
998
+ QgsWcsCoverageSummary QgsWcsCapabilities::coverage ( QString const & theIdentifier )
999
+ {
1000
+ QgsWcsCoverageSummary * cp = coverageSummary ( theIdentifier );
1001
+ QgsDebugMsg ( " supportedFormat = " + ( *cp ).supportedFormat .join ( " ," ) );
1002
+ if ( cp ) return *cp;
1003
+
1004
+ QgsWcsCoverageSummary c;
1005
+ initCoverageSummary ( c );
1006
+ QgsDebugMsg ( " supportedFormat = " + c.supportedFormat .join ( " ," ) );
1007
+ return c;
1008
+ }
1009
+
1134
1010
QgsWcsCoverageSummary* QgsWcsCapabilities::coverageSummary ( QString const & theIdentifier, QgsWcsCoverageSummary* parent )
1135
1011
{
1136
- // QgsDebugMsg ( "theIdentifier = " + theIdentifier );
1012
+ QgsDebugMsgLevel ( " theIdentifier = " + theIdentifier, 5 );
1137
1013
if ( !parent )
1138
1014
{
1139
1015
parent = &( mCapabilities .contents );
1140
1016
}
1141
1017
1142
- // foreach( const QgsWcsCoverageSummary &c, parent->coverageSummary )
1143
1018
for ( QVector<QgsWcsCoverageSummary>::iterator c = parent->coverageSummary .begin (); c != parent->coverageSummary .end (); ++c )
1144
1019
{
1145
- // QgsDebugMsg( "c->identifier = " + c->identifier );
1146
1020
if ( c->identifier == theIdentifier )
1147
1021
{
1148
1022
return c;
0 commit comments