44 QgsDebugMsgLevel( QStringLiteral(
"Preparing list of layer jobs for rendering" ), 5 );
45 QElapsedTimer prepareTime;
48 mLabelingEngineV2.reset();
56 mLabelingEngineV2->setMapSettings(
mSettings );
59 mLayerJobs =
prepareJobs(
nullptr, mLabelingEngineV2.get(),
true );
62 mJobIt = mLayerJobs.begin();
89 if ( mLabelingEngineV2 )
90 return mLabelingEngineV2->takeResults();
102 if ( mJobIt != mLayerJobs.end() )
104 LayerRenderJob &job = *mJobIt;
105 job.renderer->renderContext()->setPainter( painter );
107 if ( job.context.useAdvancedEffects() )
111 painter->setCompositionMode( job.blendMode );
117 job.imageInitialized =
true;
120 job.renderer->render();
125 painter->setOpacity( job.opacity );
126 painter->drawImage( 0, 0, *job.img );
127 painter->setOpacity( 1.0 );
129 job.context.setPainter(
nullptr );
133 if ( !mLabelingEngineV2 )
138 if ( !mPreparedStagedLabelJob || mLabelLayerIt == mLabelingLayers.end() )
141 mLabelJob.context.setPainter( painter );
144 painter->setCompositionMode( QPainter::CompositionMode_SourceOver );
149 mLabelJob.context.setPainter(
nullptr );
153 mLabelJob.context.setPainter( painter );
154 drawLabeling( mLabelJob.context, mLabelingEngineV2.get(), painter );
155 mLabelJob.complete =
true;
156 mLabelJob.participatingLayers = _qgis_listRawToQPointer( mLabelingEngineV2->participatingLayers() );
157 mLabelJob.context.setPainter(
nullptr );
168 if ( mJobIt != mLayerJobs.end() )
171 if ( mJobIt != mLayerJobs.end() )
175 if ( mLabelingEngineV2 )
179 if ( !mPreparedStagedLabelJob )
181 mLabelingEngineV2->run( mLabelJob.context );
182 mPreparedStagedLabelJob =
true;
183 mLabelingLayers = mLabelingEngineV2->participatingLayerIds();
184 mLabelLayerIt = mLabelingLayers.begin();
185 if ( mLabelLayerIt == mLabelingLayers.end() )
195 if ( mLabelLayerIt != mLabelingLayers.end() )
198 if ( mLabelLayerIt != mLabelingLayers.end() )
208 mExportedLabels =
true;
210 else if ( !mExportedLabels )
227 if ( mJobIt != mLayerJobs.end() )
229 LayerRenderJob &job = *mJobIt;
234 if ( mLabelLayerIt != mLabelingLayers.end() )
235 return *mLabelLayerIt;
242 if ( mJobIt != mLayerJobs.end() )
244 LayerRenderJob &job = *mJobIt;
252 if ( mJobIt != mLayerJobs.end() )
254 LayerRenderJob &job = *mJobIt;
255 return job.blendMode;
257 return QPainter::CompositionMode_SourceOver;
262 if ( mJobIt != mLayerJobs.end() )
266 if ( !mPreparedStagedLabelJob )
268 if ( mLabelLayerIt != mLabelingLayers.end() )
271 else if ( mNextIsLabel && !mExportedLabels )