@@ -556,8 +556,8 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
556
556
double ymax = std::min ( viewExtent.yMaximum (), layerExtent.yMaximum () );
557
557
558
558
// snap to tile coordinates
559
- double x0 = floor (( xmin - layerExtent.xMinimum () ) / mTileWidth / tres ) * mTileWidth * tres + layerExtent.xMinimum ();
560
- double y0 = floor (( ymin - layerExtent.yMinimum () ) / mTileHeight / tres ) * mTileHeight * tres + layerExtent.yMinimum ();
559
+ double x0 = floor (( xmin - layerExtent.xMinimum () ) / mTileWidth / tres ) * mTileWidth * tres + layerExtent.xMinimum () + mTileWidth * tres * 0.001 ;
560
+ double y0 = floor (( ymin - layerExtent.yMinimum () ) / mTileHeight / tres ) * mTileHeight * tres + layerExtent.yMinimum () + mTileHeight * tres * 0.001 ;
561
561
562
562
#ifdef QGISDEBUG
563
563
// calculate number of tiles
@@ -633,17 +633,17 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
633
633
request.setAttribute ( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
634
634
request.setAttribute ( QNetworkRequest::CacheSaveControlAttribute, true );
635
635
request.setAttribute ( static_cast <QNetworkRequest::Attribute>( QNetworkRequest::User + 0 ), mTileReqNo );
636
- request.setAttribute ( static_cast <QNetworkRequest::Attribute>( QNetworkRequest::User + 1 ), j );
636
+ request.setAttribute ( static_cast <QNetworkRequest::Attribute>( QNetworkRequest::User + 1 ), i );
637
637
request.setAttribute ( static_cast <QNetworkRequest::Attribute>( QNetworkRequest::User + 2 ), QRectF ( x, y, mTileWidth * tres, mTileHeight * tres ) );
638
638
639
639
QgsDebugMsg ( QString ( " gettile: %1" ).arg ( turl ) );
640
640
QNetworkReply *reply = QgsNetworkAccessManager::instance ()->get ( request );
641
641
tileReplies << reply;
642
642
connect ( reply, SIGNAL ( finished () ), this , SLOT ( tileReplyFinished () ) );
643
643
644
- x = x0 + k++* mTileWidth * tres;
644
+ x = x0 + ++k * mTileWidth * tres;
645
645
}
646
- y = y0 + j++* mTileHeight * tres;
646
+ y = y0 + ++j * mTileHeight * tres;
647
647
}
648
648
649
649
mWaiting = true ;
@@ -750,8 +750,14 @@ void QgsWmsProvider::tileReplyFinished()
750
750
QPainter p ( cachedImage );
751
751
p.drawImage ( dst, myLocalImage );
752
752
753
- // p.drawRect( dst ); // show tile bounds
754
- // p.drawText( dst.center(), QString( "(%1)\n%2,%3\n%4x%5" ).arg( tileNo ).arg( r.left() ).arg( r.bottom() ).arg( r.width() ).arg( r.height() ) );
753
+ #if 0
754
+ p.drawRect( dst ); // show tile bounds
755
+ p.drawText( dst, Qt::AlignCenter, QString( "(%1)\n%2,%3\n%4,%5\n%6x%7" )
756
+ .arg( tileNo )
757
+ .arg( r.left() ).arg( r.bottom() )
758
+ .arg( r.right() ).arg( r.top() )
759
+ .arg( r.width() ).arg( r.height() ) );
760
+ #endif
755
761
}
756
762
757
763
tileReplies.removeOne ( reply );
@@ -770,7 +776,7 @@ void QgsWmsProvider::tileReplyFinished()
770
776
mErrors ++;
771
777
}
772
778
773
- #if QGISDEBUG
779
+ #ifdef QGISDEBUG
774
780
emit statusChanged ( tr ( " %n tile requests in background" , " tile request count" , tileReplies.count () )
775
781
+ tr ( " , %n cache hits" , " tile cache hits" , mCacheHits )
776
782
+ tr ( " , %n cache misses." , " tile cache missed" , mCacheMisses )
0 commit comments