File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,7 @@ Current time stamp of data source
380
380
.. versionadded:: 3.0
381
381
%End
382
382
383
+
383
384
signals:
384
385
385
386
void fullExtentCalculated();
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ void QgsDataProvider::setListening( bool isListening )
42
42
Q_UNUSED ( isListening );
43
43
}
44
44
45
- bool QgsDataProvider::renderInPreview ( double lastRenderingTimeMS, double maxRenderingTimeMS )
45
+ bool QgsDataProvider::renderInPreview ( QgsDataProvider::PreviewContext context )
46
46
{
47
- return lastRenderingTimeMS <= maxRenderingTimeMS ;
47
+ return context. lastRenderingTimeMs <= context. maxRenderingTimeMs ;
48
48
}
Original file line number Diff line number Diff line change @@ -461,6 +461,23 @@ class CORE_EXPORT QgsDataProvider : public QObject
461
461
*/
462
462
virtual void setListening ( bool isListening );
463
463
464
+ #ifndef SIP_RUN
465
+
466
+ /* *
467
+ * Stores settings related to the context in which a preview job runs.
468
+ * \note Not available in Python bindings
469
+ * \since QGIS 3.0
470
+ */
471
+ struct PreviewContext
472
+ {
473
+ // ! Previous rendering time for the layer, in ms
474
+ double lastRenderingTimeMs = -1 ;
475
+
476
+ // ! Default maximum allowable render time, in ms
477
+ double maxRenderingTimeMs = MAXIMUM_LAYER_PREVIEW_TIME_MS;
478
+ };
479
+ #endif
480
+
464
481
/* *
465
482
* Returns whether the layer must be rendered in preview jobs.
466
483
*
@@ -474,7 +491,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
474
491
*
475
492
* \note not available in Python bindings
476
493
*/
477
- virtual bool renderInPreview ( double lastRenderingTimeMS, double maxRenderingTimeMS ); // SIP_SKIP
494
+ virtual bool renderInPreview ( QgsDataProvider::PreviewContext context ); // SIP_SKIP
478
495
479
496
signals:
480
497
Original file line number Diff line number Diff line change @@ -2273,9 +2273,12 @@ void QgsMapCanvas::startPreviewJob( int number )
2273
2273
// truncate preview layers to fast layers
2274
2274
const QList<QgsMapLayer *> layers = jobSettings.layers ();
2275
2275
QList< QgsMapLayer * > previewLayers;
2276
+ QgsDataProvider::PreviewContext context;
2277
+ context.maxRenderingTimeMs = MAXIMUM_LAYER_PREVIEW_TIME_MS;
2276
2278
for ( QgsMapLayer *layer : layers )
2277
2279
{
2278
- if ( !layer->dataProvider ()->renderInPreview ( mLastLayerRenderTime .value ( layer->id () ), MAXIMUM_LAYER_PREVIEW_TIME_MS ) )
2280
+ context.lastRenderingTimeMs = mLastLayerRenderTime .value ( layer->id () );
2281
+ if ( !layer->dataProvider ()->renderInPreview ( context ) )
2279
2282
{
2280
2283
QgsDebugMsgLevel ( QString ( " Layer %1 not rendered because it does not match the renderInPreview criterion %2" ).arg ( layer->id () ).arg ( mLastLayerRenderTime .value ( layer->id () ) ), 3 );
2281
2284
continue ;
You can’t perform that action at this time.
0 commit comments