27 , mLabelingEngine( 0 )
29 , mRenderSynchronously( false )
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() );
83 QgsDebugMsg(
"Rendering prepared in (seconds): " + QString(
"%1" ).arg( prepareTime.elapsed() / 1000.0 ) );
114 it->context.setRenderingStopped(
true );
122 QgsDebugMsg( QString(
"QPAINER cancel waited %1 ms" ).arg( t.elapsed() / 1000.0 ) );
141 QgsDebugMsg( QString(
"waitForFinished: %1 ms" ).arg( t.elapsed() / 1000.0 ) );
198 catch ( std::exception & e )
200 QgsDebugMsg(
"Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
204 QgsDebugMsg(
"Caught unhandled unknown exception" );
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 )
QgsMapRendererCustomPainterJob(const QgsMapSettings &settings, QPainter *painter)
void finished()
emitted when asynchronous rendering is finished (or canceled).
static void drawNewLabeling(const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsPalLabeling *labelingEngine)
void setRenderingStopped(bool stopped)
A rectangle specified with double values.
Base class for all map layer types.
Job implementation that renders everything sequentially using a custom painter.
QgsMapLayer::LayerType type() const
Get the type of the layer.
Abstract base class for map rendering implementations.
virtual void drawLabels(QgsRenderContext &rendererContext)
Draw labels.
double scale() const
Return the calculated scale of the map.
void cleanupJobs(LayerRenderJobs &jobs)
QgsLabelingResults * takeResults()
Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to ...
void updateLayerGeometryCaches()
called when rendering has finished to update all layers' geometry caches
void loadEngineSettings()
load/save engine settings to project file
QMap< QString, QgsGeometryCache > mGeometryCaches
map of geometry caches
bool mRenderSynchronously
float minimumScale() const
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
virtual void exit()
called when we're done with rendering
LayerRenderJobs mLayerJobs
virtual QgsLabelingResults * takeLabelingResults()
Get pointer to internal labeling engine (in order to get access to the results)
Enable layer transparency and blending effects.
void setExtent(const QgsRectangle &extent)
LayerRenderJobs prepareJobs(QPainter *painter, QgsPalLabeling *labelingEngine)
void waitForFinishedWithEventLoop(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Wait for the job to be finished - and keep the thread's event loop running while waiting.
Enable drawing of labels on top of the map.
The QgsMapSettings class contains configuration for rendering of the map.
void setCoordinateTransform(const QgsCoordinateTransform *t)
Sets coordinate transformation.
bool useAdvancedEffects() const
Returns true if advanced effects such as blend modes such be used.
virtual void cancel()
Stop the rendering job - does not return until the job has terminated.
int outputDpi() const
Return DPI used for conversion between real world units (e.g.
QPainter::CompositionMode blendMode() const
Read blend mode for layer.
virtual void drawLabeling(QgsRenderContext &context)
called when the map is drawn and labels should be placed
QPainter::CompositionMode featureBlendMode() const
Read blend mode for layer.
bool hasScaleBasedVisibility() const
QSize outputSize() const
Return the size of the resulting map image.
bool renderingStopped() const
virtual void waitForFinished()
Block until the job has finished.
float maximumScale() const
static void staticRender(QgsMapRendererCustomPainterJob *self)
Enable anti-aliasin for map rendering.
void setPainter(QPainter *p)
virtual void start()
Start the rendering job and immediately return.
~QgsMapRendererCustomPainterJob()
QColor backgroundColor() const
Get the background color of the map.
bool testFlag(Flag flag) const
Check whether a particular flag is enabled.
int layerTransparency() const
Read transparency for layer.
static void drawOldLabeling(const QgsMapSettings &settings, QgsRenderContext &renderContext)
QgsPalLabeling * mLabelingEngine
Contains information about the context of a rendering operation.
QgsRenderContext mLabelingRenderContext
virtual bool render()=0
Do the rendering (based on data stored in the class)
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
void setLabelingEngine(QgsLabelingEngineInterface *iface)
Added in QGIS v1.4.
static void drawLabeling(const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsPalLabeling *labelingEngine, QPainter *painter)
QgsMapLayerRenderer * renderer
virtual bool isActive() const
Tell whether the rendering job is currently running in background.
const QgsCoordinateReferenceSystem & crs() const
Returns layer's spatial reference system.
QStringList layers() const
Get list of layer IDs for map rendering The layers are stored in the reverse order of how they are re...
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
Class that stores computed placement from labeling engine.
static bool reprojectToLayerExtent(const QgsCoordinateTransform *ct, bool layerCrsGeographic, QgsRectangle &extent, QgsRectangle &r2)
Convenience function to project an extent into the layer source CRS, but also split it into two exten...
QPainter::CompositionMode blendMode
const QgsCoordinateTransform * layerTransfrom(QgsMapLayer *layer) const
Return coordinate transform from layer's CRS to destination CRS.
Represents a vector layer which manages a vector based data sets.
bool geographicFlag() const
bool needTemporaryImage(QgsMapLayer *ml)
Defines a qgis exception class.
void renderSynchronously()
Render the map synchronously in this thread.
QFutureWatcher< void > mFutureWatcher
Structure keeping low-level rendering job information.