27 , mLabelingEngine( 0 )
29 , mRenderSynchronously( false )
37 Q_ASSERT( !mFutureWatcher.isRunning() );
40 delete mLabelingEngine;
57 QgsDebugMsg(
"Preparing list of layer jobs for rendering" );
66 QPaintDevice* thePaintDevice = mPainter->device();
68 QString errMsg = QString(
"pre-set DPI not equal to painter's DPI (%1 vs %2)" ).arg( thePaintDevice->logicalDpiX() ).arg(
mSettings.
outputDpi() );
69 Q_ASSERT_X( thePaintDevice->logicalDpiX() ==
mSettings.
outputDpi(),
"Job::startRender()", errMsg.toAscii().data() );
71 delete mLabelingEngine;
81 mLayerJobs =
prepareJobs( mPainter, mLabelingEngine );
83 QgsDebugMsg(
"Rendering prepared in (seconds): " + QString(
"%1" ).arg( prepareTime.elapsed() / 1000.0 ) );
85 if ( mRenderSynchronously )
96 mFutureWatcher.setFuture( mFuture );
112 for ( LayerRenderJobs::iterator it = mLayerJobs.begin(); it != mLayerJobs.end(); ++it )
114 it->context.setRenderingStopped(
true );
120 mFutureWatcher.waitForFinished();
122 QgsDebugMsg( QString(
"QPAINER cancel waited %1 ms" ).arg( t.elapsed() / 1000.0 ) );
139 mFutureWatcher.waitForFinished();
141 QgsDebugMsg( QString(
"waitForFinished: %1 ms" ).arg( t.elapsed() / 1000.0 ) );
154 return mLabelingEngine ? mLabelingEngine->
takeResults() : 0;
161 connect( &mFutureWatcher, SIGNAL(
finished() ), &loop, SLOT( quit() ) );
168 mRenderSynchronously =
true;
171 mRenderSynchronously =
false;
198 catch ( std::exception & e )
200 QgsDebugMsg(
"Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
204 QgsDebugMsg(
"Caught unhandled unknown exception" );
214 for ( LayerRenderJobs::iterator it = mLayerJobs.begin(); it != mLayerJobs.end(); ++it )
225 mPainter->setCompositionMode( job.
blendMode );
234 mPainter->drawImage( 0, 0, *job.
img );
244 QgsDebugMsg(
"Rendering completed in (seconds): " + QString(
"%1" ).arg( renderTime.elapsed() / 1000.0 ) );
256 painter->setCompositionMode( QPainter::CompositionMode_SourceOver );
268 QgsDebugMsg( QString(
"Draw labeling took (seconds): %1" ).arg( t.elapsed() / 1000. ) );
275 QListIterator<QString> li( settings.
layers() );
277 while ( li.hasPrevious() )
284 QString layerId = li.previous();
323 labelingEngine->
exit();
333 * vl->cache() = cache;
344 if ((( vl->
blendMode() != QPainter::CompositionMode_SourceOver )