@@ -696,10 +696,11 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
696
696
.arg ( vres, 0 , ' f' )
697
697
);
698
698
699
- QgsDebugMsg ( QString ( " tile matrix %1,%2 res:%3 tilesize:%4x%5 matrixsize:%6x%7" )
699
+ QgsDebugMsg ( QString ( " tile matrix %1,%2 res:%3 tilesize:%4x%5 matrixsize:%6x%7 id:%8 " )
700
700
.arg ( tm ->topLeft .x () ).arg ( tm ->topLeft .y () ).arg ( tres )
701
701
.arg ( tm ->tileWidth ).arg ( tm ->tileHeight )
702
702
.arg ( tm ->matrixWidth ).arg ( tm ->matrixHeight )
703
+ .arg ( tm ->identifier )
703
704
);
704
705
705
706
// calculate tile coordinates
@@ -712,23 +713,26 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
712
713
int minTileRow = 0 ;
713
714
int maxTileRow = tm ->matrixHeight - 1 ;
714
715
715
- if ( mTileLayer ->setLinks .contains ( tm ->identifier ) &&
716
- mTileLayer ->setLinks [ tm ->identifier ].limits .contains ( mTileMatrixSet ->identifier ) )
716
+ if ( mTileLayer ->setLinks .contains ( mTileMatrixSet ->identifier ) &&
717
+ mTileLayer ->setLinks [ mTileMatrixSet ->identifier ].limits .contains ( tm ->identifier ) )
717
718
{
718
- const QgsWmtsTileMatrixLimits &tml = mTileLayer ->setLinks [ tm ->identifier ].limits [ mTileMatrixSet ->identifier ];
719
+ const QgsWmtsTileMatrixLimits &tml = mTileLayer ->setLinks [ mTileMatrixSet ->identifier ].limits [ tm ->identifier ];
719
720
minTileCol = tml.minTileCol ;
720
721
maxTileCol = tml.maxTileCol ;
721
722
minTileRow = tml.minTileRow ;
722
723
maxTileRow = tml.maxTileRow ;
724
+ QgsDebugMsg ( QString ( " %1 %2: TileMatrixLimits col %3-%4 row %5-%6" )
725
+ .arg ( mTileMatrixSet ->identifier )
726
+ .arg ( tm ->identifier )
727
+ .arg ( minTileCol ).arg ( maxTileCol )
728
+ .arg ( minTileRow ).arg ( maxTileRow ) );
723
729
}
724
730
725
731
int col0 = qBound ( minTileCol, ( int ) floor (( viewExtent.xMinimum () - tm ->topLeft .x () ) / twMap ), maxTileCol );
726
732
int row0 = qBound ( minTileRow, ( int ) floor (( tm ->topLeft .y () - viewExtent.yMaximum () ) / thMap ), maxTileRow );
727
733
int col1 = qBound ( minTileCol, ( int ) ceil (( viewExtent.xMaximum () - tm ->topLeft .x () ) / twMap ), maxTileCol );
728
734
int row1 = qBound ( minTileRow, ( int ) ceil (( tm ->topLeft .y () - viewExtent.yMinimum () ) / thMap ), maxTileRow );
729
735
730
- QgsDebugMsg ( QString ( " rows: %1-%2 cols: %3-%4" ).arg ( row0 ).arg ( row1 ).arg ( col0 ).arg ( col1 ) );
731
-
732
736
#if QGISDEBUG
733
737
int n = ( col1 - col0 + 1 ) * ( row1 - row0 + 1 );
734
738
QgsDebugMsg ( QString ( " tile number: %1x%2 = %3" ).arg ( col1 - col0 + 1 ).arg ( row1 - row0 + 1 ).arg ( n ) );
@@ -2621,36 +2625,39 @@ void QgsWmsProvider::parseWMTSContents( QDomElement const &e )
2621
2625
2622
2626
for ( QDomElement e1 = e0 .firstChildElement ( " TileMatrixSetLink" ); !e1 .isNull (); e1 = e1 .nextSiblingElement ( " TileMatrixSetLink" ) )
2623
2627
{
2624
- for ( QDomElement e2 = e1 .firstChildElement ( " TileMatrixSet" ); !e2 .isNull (); e2 = e2 .nextSiblingElement ( " TileMatrixSet" ) )
2625
- {
2626
- QgsWmtsTileMatrixSetLink sl;
2628
+ QgsWmtsTileMatrixSetLink sl;
2627
2629
2628
- sl.tileMatrixSet = e2 .text ();
2629
- if ( !mTileMatrixSets .contains ( sl.tileMatrixSet ) )
2630
- {
2631
- QgsDebugMsg ( QString ( " tileMatrixSet %1 not found." ).arg ( id ) );
2632
- continue ;
2633
- }
2630
+ sl.tileMatrixSet = e1 .firstChildElement ( " TileMatrixSet" ).text ();
2634
2631
2635
- for ( QDomElement e3 = e2 .firstChildElement ( " TileMatrixSetLimits" ); !e3 .isNull (); e3 = e3 .nextSiblingElement ( " TileMatrixSetLimits" ) )
2632
+ if ( !mTileMatrixSets .contains ( sl.tileMatrixSet ) )
2633
+ {
2634
+ QgsDebugMsg ( QString ( " TileMatrixSet %1 not found." ).arg ( sl.tileMatrixSet ) );
2635
+ continue ;
2636
+ }
2637
+
2638
+ for ( QDomElement e2 = e1 .firstChildElement ( " TileMatrixSetLimits" ); !e2 .isNull (); e2 = e2 .nextSiblingElement ( " TileMatrixSetLimits" ) )
2639
+ {
2640
+ for ( QDomElement e3 = e2 .firstChildElement ( " TileMatrixLimits" ); !e3 .isNull (); e3 = e3 .nextSiblingElement ( " TileMatrixLimits" ) )
2636
2641
{
2637
- for ( QDomElement e4 = e3 .firstChildElement ( " TileMatrixLimits" ); !e4 .isNull (); e4 = e4 .nextSiblingElement ( " TileMatrixLimits" ) )
2638
- {
2639
- QgsWmtsTileMatrixLimits limit;
2642
+ QgsWmtsTileMatrixLimits limit;
2640
2643
2641
- QString id = e4 .firstChildElement ( " TileMatrix" ).text ();
2644
+ QString id = e3 .firstChildElement ( " TileMatrix" ).text ();
2642
2645
2643
- limit.minTileRow = e4 .firstChildElement ( " MinTileRow" ).text ().toInt ();
2644
- limit.maxTileRow = e4 .firstChildElement ( " MaxTileRow" ).text ().toInt ();
2645
- limit.minTileCol = e4 .firstChildElement ( " MinTileCol" ).text ().toInt ();
2646
- limit.maxTileCol = e4 .firstChildElement ( " MaxTileCol" ).text ().toInt ();
2646
+ limit.minTileRow = e3 .firstChildElement ( " MinTileRow" ).text ().toInt ();
2647
+ limit.maxTileRow = e3 .firstChildElement ( " MaxTileRow" ).text ().toInt ();
2648
+ limit.minTileCol = e3 .firstChildElement ( " MinTileCol" ).text ().toInt ();
2649
+ limit.maxTileCol = e3 .firstChildElement ( " MaxTileCol" ).text ().toInt ();
2647
2650
2648
- sl.limits .insert ( id, limit );
2649
- }
2651
+ QgsDebugMsg ( QString ( " TileMatrix id:%1 row:%2-%3 col:%4-%5" )
2652
+ .arg ( id )
2653
+ .arg ( limit.minTileRow ).arg ( limit.maxTileRow )
2654
+ .arg ( limit.minTileCol ).arg ( limit.maxTileCol )
2655
+ );
2656
+ sl.limits .insert ( id, limit );
2650
2657
}
2651
-
2652
- l.setLinks .insert ( sl.tileMatrixSet , sl );
2653
2658
}
2659
+
2660
+ l.setLinks .insert ( sl.tileMatrixSet , sl );
2654
2661
}
2655
2662
2656
2663
for ( QDomElement e1 = e0 .firstChildElement ( " ResourceURL" ); !e1 .isNull (); e1 = e1 .nextSiblingElement ( " ResourceURL" ) )
0 commit comments