@@ -98,17 +98,20 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri )
98
98
if ( smNAM )
99
99
{
100
100
QNetworkProxy proxy = smNAM->proxy ();
101
+ #if QT_VERSION >= 0x40500
101
102
QgsDebugMsg ( QString ( " proxy host:%1:%2 type:%3 user:%4 password:%5 capabilities:%6" )
102
103
.arg ( proxy.hostName () ).arg ( proxy.port () )
103
104
.arg ( proxy.type () )
104
105
.arg ( proxy.user () ).arg ( proxy.password () )
105
- #if QT_VERSION >= 0x40500
106
106
.arg ( proxy.capabilities () )
107
+ );
107
108
#else
108
- .arg ( 0 )
109
- #endif
109
+ QgsDebugMsg ( QString ( " proxy host:%1:%2 type:%3 user:%4 password:%5" )
110
+ .arg ( proxy.hostName () ).arg ( proxy.port () )
111
+ .arg ( proxy.type () )
112
+ .arg ( proxy.user () ).arg ( proxy.password () )
110
113
);
111
-
114
+ # endif
112
115
}
113
116
}
114
117
@@ -433,6 +436,9 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
433
436
cachedViewWidth = pixelWidth;
434
437
cachedViewHeight = pixelHeight;
435
438
439
+ QSettings s;
440
+ bool bkLayerCaching = s.value ( " /qgis/enable_render_caching" , false ).toBool ();
441
+
436
442
if ( !mTiled )
437
443
{
438
444
// Calculate active layers that are also visible.
@@ -529,7 +535,9 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
529
535
}
530
536
531
537
QgsDebugMsg ( QString ( " getmap: %1" ).arg ( url ) );
532
- cacheReply = smNAM->get ( QNetworkRequest ( url ) );
538
+ QNetworkRequest request ( url );
539
+ request.setAttribute ( QNetworkRequest::CacheSaveControlAttribute, true );
540
+ cacheReply = smNAM->get ( request );
533
541
connect ( cacheReply, SIGNAL ( finished () ), this , SLOT ( cacheReplyFinished () ) );
534
542
connect ( cacheReply, SIGNAL ( downloadProgress ( qint64, qint64 ) ), this , SLOT ( cacheReplyProgress ( qint64, qint64 ) ) );
535
543
@@ -538,7 +546,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
538
546
QTime t;
539
547
t.start ();
540
548
541
- while ( cacheReply && t.elapsed () < WMS_THRESHOLD )
549
+ while ( cacheReply && ( !bkLayerCaching || t.elapsed () < WMS_THRESHOLD ) )
542
550
{
543
551
QCoreApplication::processEvents ( QEventLoop::ExcludeUserInputEvents, WMS_THRESHOLD );
544
552
}
@@ -663,7 +671,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
663
671
664
672
// draw everything that is retrieved within a second
665
673
// and the rest asynchronously
666
- while ( !tileReplies.isEmpty () && t.elapsed () < WMS_THRESHOLD )
674
+ while ( !tileReplies.isEmpty () && ( !bkLayerCaching || t.elapsed () < WMS_THRESHOLD ) )
667
675
{
668
676
QCoreApplication::processEvents ( QEventLoop::ExcludeUserInputEvents, WMS_THRESHOLD );
669
677
}
0 commit comments