/usr/include/qgis/qgsmaprenderercustompainterjob.h is in libqgis-dev 2.8.6+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | /***************************************************************************
qgsmaprenderercustompainterjob.h
--------------------------------------
Date : December 2013
Copyright : (C) 2013 by Martin Dobias
Email : wonder dot sk at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSMAPRENDERERCUSTOMPAINTERJOB_H
#define QGSMAPRENDERERCUSTOMPAINTERJOB_H
#include "qgsmaprendererjob.h"
#include <QEventLoop>
/** Job implementation that renders everything sequentially using a custom painter.
*
* Also supports synchronous rendering in main thread for cases when rendering in background
* is not an option because of some technical limitations (e.g. printing to printer on some
* platforms).
*
* @note added in 2.4
*/
class CORE_EXPORT QgsMapRendererCustomPainterJob : public QgsMapRendererJob
{
Q_OBJECT
public:
QgsMapRendererCustomPainterJob( const QgsMapSettings& settings, QPainter* painter );
~QgsMapRendererCustomPainterJob();
virtual void start() override;
virtual void cancel() override;
virtual void waitForFinished() override;
virtual bool isActive() const override;
virtual QgsLabelingResults* takeLabelingResults() override;
//! @note not available in python bindings
const LayerRenderJobs& jobs() const { return mLayerJobs; }
/**
* Wait for the job to be finished - and keep the thread's event loop running while waiting.
*
* With a call to waitForFinished(), the waiting is done with a synchronization primitive
* and does not involve processing of messages. That may cause issues to code which requires
* some events to be handled in the main thread. Some plugins hooking into the rendering
* pipeline may require this in order to work properly - for example, OpenLayers plugin
* which uses a QWebPage in the main thread.
*
* Ideally the "wait for finished" method should not be used at all. The code triggering
* rendering should not need to actively wait for rendering to finish.
*/
void waitForFinishedWithEventLoop( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents );
/**
* Render the map synchronously in this thread. The function does not return until the map
* is completely rendered.
*
* This is an alternative to ordinary API (using start() + waiting for finished() signal).
* Users are discouraged to use this method unless they have a strong reason for doing it.
* The synchronous rendering blocks the main thread, making the application unresponsive.
* Also, it is not possible to cancel rendering while it is in progress.
*/
void renderSynchronously();
protected slots:
void futureFinished();
protected:
static void staticRender( QgsMapRendererCustomPainterJob* self ); // function to be used within the thread
// these methods are called within worker thread
void doRender();
private:
QPainter* mPainter;
QFuture<void> mFuture;
QFutureWatcher<void> mFutureWatcher;
QgsRenderContext mLabelingRenderContext;
QgsPalLabeling* mLabelingEngine;
bool mActive;
LayerRenderJobs mLayerJobs;
bool mRenderSynchronously;
};
#endif // QGSMAPRENDERERCUSTOMPAINTERJOB_H
|