QGIS API Documentation 4.1.0-Master (60fea48833c)
Loading...
Searching...
No Matches
qgslayoutrendercontext.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutrendercontext.h
3 -------------------
4 begin : July 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSLAYOUTRENDERCONTEXT_H
17#define QGSLAYOUTRENDERCONTEXT_H
18
19#include "qgis.h"
20#include "qgis_core.h"
24
25#include <QColor>
26#include <QVector>
27#include <QtGlobal>
28
29class QgsLayout;
31
37class CORE_EXPORT QgsLayoutRenderContext : public QObject
38{
39 Q_OBJECT
40
41 public:
46
54
62 void setFlag( Qgis::LayoutRenderFlag flag, bool on = true );
63
71
78 bool testFlag( Qgis::LayoutRenderFlag flag ) const;
79
84
92
100
106 void setDpi( double dpi );
107
112 double dpi() const;
113
119 void setSelectionColor( const QColor &color ) { mSelectionColor = color; }
120
126 QColor selectionColor() const { return mSelectionColor; }
127
132 SIP_SKIP const QgsLayoutMeasurementConverter &measurementConverter() const { return mMeasurementConverter; }
133
138 QgsLayoutMeasurementConverter &measurementConverter() { return mMeasurementConverter; }
139
145 bool isPreviewRender() const { return mIsPreviewRender; }
146
151 bool gridVisible() const;
152
157 void setGridVisible( bool visible );
158
163 bool boundingBoxesVisible() const;
164
169 void setBoundingBoxesVisible( bool visible );
170
177 void setPagesVisible( bool visible );
178
185 bool pagesVisible() const { return mPagesVisible; }
186
197 Q_DECL_DEPRECATED void setCurrentExportLayer( int layer = -1 ) SIP_DEPRECATED { mCurrentExportLayer = layer; }
198
209 Q_DECL_DEPRECATED int currentExportLayer() const SIP_DEPRECATED { return mCurrentExportLayer; }
210
217 Qgis::TextRenderFormat textRenderFormat() const { return mTextRenderFormat; }
218
225 void setTextRenderFormat( Qgis::TextRenderFormat format ) { mTextRenderFormat = format; }
226
244 void setSimplifyMethod( const QgsVectorSimplifyMethod &method ) { mSimplifyMethod = method; }
245
258 const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
259
267 const QgsMaskRenderSettings &maskSettings() const SIP_SKIP { return mMaskRenderSettings; }
268
276 QgsMaskRenderSettings &maskSettings() { return mMaskRenderSettings; }
277
285 void setMaskSettings( const QgsMaskRenderSettings &settings );
286
296 QStringList exportThemes() const;
297
307 void setExportThemes( const QStringList &themes );
308
315 void setPredefinedScales( const QVector<qreal> &scales );
316
322 QVector<qreal> predefinedScales() const { return mPredefinedScales; }
323
332 QgsFeatureFilterProvider *featureFilterProvider() const;
333
342 void setFeatureFilterProvider( QgsFeatureFilterProvider *featureFilterProvider );
343
344 signals:
345
351
356
363
364 private:
365 void matchRasterizedRenderingPolicyToFlags();
366
369
370 QgsLayout *mLayout = nullptr;
371
372 int mCurrentExportLayer = -1;
373
374 QColor mSelectionColor = Qt::yellow;
375
376 QgsLayoutMeasurementConverter mMeasurementConverter;
377
378 bool mIsPreviewRender = true;
379 bool mGridVisible = false;
380 bool mBoundingBoxesVisible = true;
381 bool mPagesVisible = true;
382
384
385 QStringList mExportThemes;
386
387 QgsVectorSimplifyMethod mSimplifyMethod;
388
389 QVector<qreal> mPredefinedScales;
390
391 QgsFeatureFilterProvider *mFeatureFilterProvider = nullptr;
392
393 QgsMaskRenderSettings mMaskRenderSettings;
394
395 friend class QgsLayoutExporter;
396 friend class TestQgsLayout;
398 friend class TestQgsLayoutMap;
399 friend class TestQgsLayoutLabel;
400};
401
402
403#endif //QGSLAYOUTRENDERCONTEXT_H
RasterizedRenderingPolicy
Policies controlling when rasterisation of content during renders is permitted.
Definition qgis.h:2798
@ PreferVector
Prefer vector-based rendering, when the result will still be visually near-identical to a raster-base...
Definition qgis.h:2800
QFlags< RenderContextFlag > RenderContextFlags
Render context flags.
Definition qgis.h:2871
QFlags< LayoutRenderFlag > LayoutRenderFlags
Flags for controlling how a layout is rendered.
Definition qgis.h:5423
TextRenderFormat
Options for rendering text.
Definition qgis.h:2923
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
Definition qgis.h:2924
LayoutRenderFlag
Flags for controlling how a layout is rendered.
Definition qgis.h:5394
Abstract interface for use by classes that filter the features or attributes of a layer.
Provides a method of converting QgsLayoutMeasurements from one unit to another.
void setDpi(double dpi)
Sets the dpi for outputting the layout.
void setSimplifyMethod(const QgsVectorSimplifyMethod &method)
Sets the simplification setting to use when rendering vector layers.
void setSelectionColor(const QColor &color)
Sets color that is used for drawing of selected vector features.
void dpiChanged()
Emitted when the context's DPI is changed.
void setTextRenderFormat(Qgis::TextRenderFormat format)
Sets the text render format, which dictates how text is rendered (e.g.
void predefinedScalesChanged()
Emitted when the list of predefined scales changes.
bool pagesVisible() const
Returns whether the page items are be visible in the layout.
Qgis::LayoutRenderFlags flags() const
Returns the current combination of flags used for rendering the layout.
Qgis::TextRenderFormat textRenderFormat() const
Returns the text render format, which dictates how text is rendered (e.g.
bool isPreviewRender() const
Returns true if the render current being conducted is a preview render, i.e.
QgsMaskRenderSettings & maskSettings()
Returns a reference to the mask render settings, which control how masks are drawn and behave during ...
QVector< qreal > predefinedScales() const
Returns the current list of predefined scales for use with the layout.
void flagsChanged(Qgis::LayoutRenderFlags flags)
Emitted whenever the context's flags change.
friend class LayoutContextPreviewSettingRestorer
void setRasterizedRenderingPolicy(Qgis::RasterizedRenderingPolicy policy)
Sets the policy controlling when rasterization of content during renders is permitted.
QgsLayoutMeasurementConverter & measurementConverter()
Returns the layout measurement converter to be used in the layout.
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings to use when rendering vector layers.
QgsLayoutRenderContext(QgsLayout *layout)
Constructor for QgsLayoutRenderContext.
double dpi() const
Returns the dpi for outputting the layout.
QColor selectionColor() const
Gets color that is used for drawing of selected vector features.
Qgis::RasterizedRenderingPolicy rasterizedRenderingPolicy() const
Returns the policy controlling when rasterization of content during renders is permitted.
Qgis::RenderContextFlags renderContextFlags() const
Returns the combination of render context flags matched to the layout context's settings.
Q_DECL_DEPRECATED void setCurrentExportLayer(int layer=-1)
Sets the current item layer to draw while exporting.
void setFlags(Qgis::LayoutRenderFlags flags)
Sets the combination of flags that will be used for rendering the layout.
const QgsLayoutMeasurementConverter & measurementConverter() const
Returns the layout measurement converter to be used in the layout.
bool testFlag(Qgis::LayoutRenderFlag flag) const
Check whether a particular rendering flag is enabled for the layout.
const QgsMaskRenderSettings & maskSettings() const
Returns a reference to the mask render settings, which control how masks are drawn and behave during ...
void setFlag(Qgis::LayoutRenderFlag flag, bool on=true)
Enables or disables a particular rendering flag for the layout.
Q_DECL_DEPRECATED int currentExportLayer() const
Returns the current item layer to draw while exporting.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition qgslayout.h:50
Contains settings regarding how masks are calculated and handled during a map render.
Contains settings for simplifying geometries fetched from a vector layer.
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_SKIP
Definition qgis_sip.h:133