40 void QgsMapRendererStagedRenderJob::startPrivate()
45 QgsDebugMsgLevel( QStringLiteral(
"Preparing list of layer jobs for rendering" ), 5 );
46 QElapsedTimer prepareTime;
49 mLabelingEngineV2.reset();
57 mLabelingEngineV2->setMapSettings(
mSettings );
60 mLayerJobs =
prepareJobs(
nullptr, mLabelingEngineV2.get(),
true );
63 mJobIt = mLayerJobs.begin();
90 if ( mLabelingEngineV2 )
91 return mLabelingEngineV2->takeResults();
103 if ( mJobIt != mLayerJobs.end() )
105 LayerRenderJob &job = *mJobIt;
107 job.renderer->renderContext()->setPainter( painter );
109 if ( job.context()->useAdvancedEffects() )
113 painter->setCompositionMode( job.blendMode );
119 job.imageInitialized =
true;
122 job.completed = job.renderer->render();
127 painter->setOpacity( job.opacity );
128 painter->drawImage( 0, 0, *job.img );
129 painter->setOpacity( 1.0 );
131 job.context()->setPainter(
nullptr );
137 if ( !mLabelingEngineV2 )
142 if ( !mPreparedStagedLabelJob || mLabelLayerIt == mLabelingLayers.end() )
145 mLabelJob.context.setPainter( painter );
148 painter->setCompositionMode( QPainter::CompositionMode_SourceOver );
153 mLabelJob.context.setPainter(
nullptr );
157 mLabelJob.context.setPainter( painter );
158 drawLabeling( mLabelJob.context, mLabelingEngineV2.get(), painter );
159 mLabelJob.complete =
true;
160 mLabelJob.participatingLayers = _qgis_listRawToQPointer( mLabelingEngineV2->participatingLayers() );
161 mLabelJob.context.setPainter(
nullptr );
172 if ( mJobIt != mLayerJobs.end() )
175 if ( mJobIt != mLayerJobs.end() )
179 if ( mLabelingEngineV2 )
183 if ( !mPreparedStagedLabelJob )
185 mLabelingEngineV2->run( mLabelJob.context );
186 mPreparedStagedLabelJob =
true;
187 mLabelingLayers = mLabelingEngineV2->participatingLayerIds();
188 mLabelLayerIt = mLabelingLayers.begin();
189 if ( mLabelLayerIt == mLabelingLayers.end() )
199 if ( mLabelLayerIt != mLabelingLayers.end() )
202 if ( mLabelLayerIt != mLabelingLayers.end() )
212 mExportedLabels =
true;
214 else if ( !mExportedLabels )
231 if ( mJobIt != mLayerJobs.end() )
233 const LayerRenderJob &job = *mJobIt;
238 if ( mLabelLayerIt != mLabelingLayers.end() )
239 return *mLabelLayerIt;
246 if ( mJobIt != mLayerJobs.end() )
248 const LayerRenderJob &job = *mJobIt;
256 if ( mJobIt != mLayerJobs.end() )
258 const LayerRenderJob &job = *mJobIt;
259 return job.blendMode;
261 return QPainter::CompositionMode_SourceOver;
266 if ( mJobIt != mLayerJobs.end() )
270 if ( !mPreparedStagedLabelJob )
272 if ( mLabelLayerIt != mLabelingLayers.end() )
275 else if ( mNextIsLabel && !mExportedLabels )