@@ -568,26 +568,32 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
568568 double ymax = std::min ( viewExtent.yMaximum (), layerExtent.yMaximum () );
569569
570570 // snap to tile coordinates
571- double x0 = floor ( xmin / dx ) * dx;
572- double y0 = floor ( ymin / dy ) * dy;
571+ double x0 = floor (( xmin - layerExtent. xMinimum () ) / dx ) * dx + layerExtent. xMinimum () ;
572+ double y0 = floor (( ymin - layerExtent. yMinimum () ) / dy ) * dy + layerExtent. yMinimum () ;
573573
574574#ifdef QGISDEBUG
575575 // calculate number of tiles
576576 int n = ceil (( xmax - xmin ) / dx ) * ceil (( ymax - ymin ) / dy );
577577#endif
578578
579+ QgsDebugMsg ( QString ( " layer extent: %1,%2 %3x%4" )
580+ .arg ( layerExtent.xMinimum (), 0 , ' f' )
581+ .arg ( layerExtent.yMinimum (), 0 , ' f' )
582+ .arg ( layerExtent.width () )
583+ .arg ( layerExtent.height () )
584+ );
579585 QgsDebugMsg ( QString ( " view extent: %1,%2 %3x%4 res:%5" )
580- .arg ( viewExtent.xMinimum () )
581- .arg ( viewExtent.yMinimum () )
586+ .arg ( viewExtent.xMinimum (), 0 , ' f ' )
587+ .arg ( viewExtent.yMinimum (), 0 , ' f ' )
582588 .arg ( viewExtent.width () )
583589 .arg ( viewExtent.height () )
584- .arg ( vres )
590+ .arg ( vres, 0 , ' f ' )
585591 );
586592 QgsDebugMsg ( QString ( " tile extent: %1,%2 %3x%4 pixel:%5x%6 res:%7" )
587- .arg ( x0 ).arg ( y0 )
588- .arg ( dx ).arg ( dy )
593+ .arg ( x0, 0 , ' f ' ).arg ( y0, 0 , ' f ' )
594+ .arg ( dx, 0 , ' f ' ).arg ( dy, 0 , ' f ' )
589595 .arg ( mTileWidth ).arg ( mTileHeight )
590- .arg ( tres )
596+ .arg ( tres, 0 , ' f ' )
591597 );
592598 QgsDebugMsg ( QString ( " tile number: %1x%2 = %3" )
593599 .arg ( ceil (( xmax - xmin ) / dx ) )
@@ -643,29 +649,29 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
643649 tileReplies << reply;
644650 connect ( reply, SIGNAL ( finished () ), this , SLOT ( tileReplyFinished () ) );
645651 }
652+ }
646653
647- mWaiting = true ;
654+ mWaiting = true ;
648655
649- QTime t;
650- t.start ();
656+ QTime t;
657+ t.start ();
651658
652- // draw everything that is retrieved within a second
653- // and the rest asynchronously
654- while ( !tileReplies.isEmpty () && t.elapsed () < WMS_THRESHOLD )
655- {
656- QCoreApplication::processEvents ( QEventLoop::ExcludeUserInputEvents, WMS_THRESHOLD );
657- }
659+ // draw everything that is retrieved within a second
660+ // and the rest asynchronously
661+ while ( !tileReplies.isEmpty () && t.elapsed () < WMS_THRESHOLD )
662+ {
663+ QCoreApplication::processEvents ( QEventLoop::ExcludeUserInputEvents, WMS_THRESHOLD );
664+ }
658665
659- mWaiting = false ;
666+ mWaiting = false ;
660667
661668#ifdef QGISDEBUG
662- emit statusChanged ( tr ( " %n tile requests in background" , " tile request count" , tileReplies.count () )
663- + tr ( " , %n cache hits" , " tile cache hits" , mCacheHits )
664- + tr ( " , %n cache misses." , " tile cache missed" , mCacheMisses )
665- + tr ( " , %n errors." , " errors" , mErrors )
666- );
669+ emit statusChanged ( tr ( " %n tile requests in background" , " tile request count" , tileReplies.count () )
670+ + tr ( " , %n cache hits" , " tile cache hits" , mCacheHits )
671+ + tr ( " , %n cache misses." , " tile cache missed" , mCacheMisses )
672+ + tr ( " , %n errors." , " errors" , mErrors )
673+ );
667674#endif
668- }
669675 }
670676
671677 return cachedImage;
@@ -688,7 +694,7 @@ void QgsWmsProvider::tileReplyFinished()
688694
689695 QgsDebugMsg ( QString ( " tile reply %1 (%2) tile:%3 rect:%4,%5 %6x%7) fromcache:%8 error:%9" )
690696 .arg ( tileReqNo ).arg ( mTileReqNo ).arg ( tileNo )
691- .arg ( r.left () ).arg ( r.bottom () ).arg ( r.width () ).arg ( r.height () )
697+ .arg ( r.left (), 0 , ' f ' ).arg ( r.bottom (), 0 , ' f ' ).arg ( r.width (), 0 , ' f ' ).arg ( r.height (), 0 , ' f ' )
692698 .arg ( fromCache )
693699 .arg ( reply->errorString () )
694700 );
@@ -2109,9 +2115,34 @@ QString QgsWmsProvider::metadata()
21092115{
21102116 QString myMetadataQString = " " ;
21112117
2118+ myMetadataQString += " <tr><td>" ;
2119+
2120+ myMetadataQString += " <a href=\" #serverproperties\" >" ;
2121+ myMetadataQString += tr ( " Server Properties" );
2122+ myMetadataQString += " </a> " ;
2123+
2124+ myMetadataQString += " <a href=\" #layerproperties\" >" ;
2125+ myMetadataQString += tr ( " Layer Properties" );
2126+ myMetadataQString += " </a> " ;
2127+
2128+ if ( tilesetsSupported.size () > 0 )
2129+ {
2130+ myMetadataQString += " <a href=\" #tilesetproperties\" >" ;
2131+ myMetadataQString += tr ( " Tileset Properties" );
2132+ myMetadataQString += " </a> " ;
2133+
2134+ #if QT_VERSION >= 0x40500
2135+ myMetadataQString += " <a href=\" #cachestats\" >" ;
2136+ myMetadataQString += tr ( " Cache Stats" );
2137+ myMetadataQString += " </a> " ;
2138+ #endif
2139+ }
2140+
2141+ myMetadataQString += " </td></tr>" ;
2142+
21122143 // Server Properties section
2113- myMetadataQString += " <tr><td bgcolor=\" gray\" >" ;
2114- myMetadataQString += tr ( " Server Properties: " );
2144+ myMetadataQString += " <tr><td bgcolor=\" gray\" ><a name= \" serverproperties \" ></a> " ;
2145+ myMetadataQString += tr ( " Server Properties" );
21152146 myMetadataQString += " </td></tr>" ;
21162147
21172148 // Use a nested table
@@ -2242,7 +2273,7 @@ QString QgsWmsProvider::metadata()
22422273 myMetadataQString += " </td></tr>" ;
22432274
22442275 // Layer properties
2245- myMetadataQString += " <tr><td bgcolor=\" gray\" >" ;
2276+ myMetadataQString += " <tr><td bgcolor=\" gray\" ><a name= \" layerproperties \" ></a> " ;
22462277 myMetadataQString += tr ( " Layer Properties:" );
22472278 myMetadataQString += " </td></tr>" ;
22482279
@@ -2436,8 +2467,8 @@ QString QgsWmsProvider::metadata()
24362467 // Tileset properties
24372468 if ( tilesetsSupported.size () > 0 )
24382469 {
2439- myMetadataQString += " <tr><td bgcolor=\" gray\" >" ;
2440- myMetadataQString += tr ( " Tileset Properties: " );
2470+ myMetadataQString += " <tr><td bgcolor=\" gray\" ><a name= \" tilesetproperties \" ></a> " ;
2471+ myMetadataQString += tr ( " Tileset Properties" );
24412472 myMetadataQString += " </td></tr>" ;
24422473
24432474 // Iterate through tilesets
@@ -2501,10 +2532,13 @@ QString QgsWmsProvider::metadata()
25012532 myMetadataQString += " </td></tr>" ;
25022533 }
25032534
2535+ myMetadataQString += " </table></td></tr>" ;
2536+
2537+ #if QT_VERSION >= 0x40500
25042538 if ( mTiled )
25052539 {
2506- myMetadataQString += " <tr><td bgcolor=\" gray\" >" ;
2507- myMetadataQString += tr ( " Cache stats: " );
2540+ myMetadataQString += " <tr><td bgcolor=\" gray\" ><a name= \" cachestats \" ></a> " ;
2541+ myMetadataQString += tr ( " Cache stats" );
25082542 myMetadataQString += " </td></tr>" ;
25092543
25102544 // Iterate through tilesets
@@ -2536,8 +2570,9 @@ QString QgsWmsProvider::metadata()
25362570 myMetadataQString += QString::number ( mErrors );
25372571 myMetadataQString += " </td></tr>" ;
25382572
2539- myMetadataQString += " </table>" ;
2573+ myMetadataQString += " </table></td></tr> " ;
25402574 }
2575+ #endif
25412576 }
25422577
25432578 myMetadataQString += " </table>" ;
0 commit comments