QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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_core.h"
22#include "qgis.h"
23#include <QtGlobal>
24#include <QColor>
25#include <QVector>
26
27class QgsLayout;
29
36class CORE_EXPORT QgsLayoutRenderContext : public QObject
37{
38
39 Q_OBJECT
40
41 public:
42
44 enum Flag
45 {
46 FlagDebug = 1 << 1,
47 FlagOutlineOnly = 1 << 2,
48 FlagAntialiasing = 1 << 3,
49 FlagUseAdvancedEffects = 1 << 4,
50 FlagForceVectorOutput = 1 << 5,
51 FlagHideCoverageLayer = 1 << 6,
52 FlagDrawSelection = 1 << 7,
53 FlagDisableTiledRasterLayerRenders = 1 << 8,
54 FlagRenderLabelsByMapLayer = 1 << 9,
55 FlagLosslessImageRendering = 1 << 10,
56 FlagSynchronousLegendGraphics = 1 << 11
57 };
58 Q_DECLARE_FLAGS( Flags, Flag )
59
60
64
71 void setFlags( QgsLayoutRenderContext::Flags flags );
72
80 void setFlag( QgsLayoutRenderContext::Flag flag, bool on = true );
81
88 QgsLayoutRenderContext::Flags flags() const;
89
96 bool testFlag( Flag flag ) const;
97
101 Qgis::RenderContextFlags renderContextFlags() const;
102
108 void setDpi( double dpi );
109
114 double dpi() const;
115
121 void setSelectionColor( const QColor &color ) { mSelectionColor = color; }
122
128 QColor selectionColor() const { return mSelectionColor; }
129
134 SIP_SKIP const QgsLayoutMeasurementConverter &measurementConverter() const { return mMeasurementConverter; }
135
140 QgsLayoutMeasurementConverter &measurementConverter() { return mMeasurementConverter; }
141
147 bool isPreviewRender() const { return mIsPreviewRender; }
148
153 bool gridVisible() const;
154
159 void setGridVisible( bool visible );
160
165 bool boundingBoxesVisible() const;
166
171 void setBoundingBoxesVisible( bool visible );
172
179 void setPagesVisible( bool visible );
180
187 bool pagesVisible() const { return mPagesVisible; }
188
199 Q_DECL_DEPRECATED void setCurrentExportLayer( int layer = -1 ) SIP_DEPRECATED { mCurrentExportLayer = layer; }
200
211 Q_DECL_DEPRECATED int currentExportLayer() const SIP_DEPRECATED { return mCurrentExportLayer; }
212
220 {
221 return mTextRenderFormat;
222 }
223
231 {
232 mTextRenderFormat = format;
233 }
234
252 void setSimplifyMethod( const QgsVectorSimplifyMethod &method ) { mSimplifyMethod = method; }
253
266 const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
267
277 QStringList exportThemes() const;
278
288 void setExportThemes( const QStringList &themes );
289
296 void setPredefinedScales( const QVector<qreal> &scales );
297
303 QVector<qreal> predefinedScales() const { return mPredefinedScales; }
304
313 QgsFeatureFilterProvider *featureFilterProvider() const;
314
323 void setFeatureFilterProvider( QgsFeatureFilterProvider *featureFilterProvider );
324
325 signals:
326
331 void flagsChanged( QgsLayoutRenderContext::Flags flags );
332
337
344
345 private:
346
347 Flags mFlags = Flags();
348
349 QgsLayout *mLayout = nullptr;
350
351 int mCurrentExportLayer = -1;
352
353 QColor mSelectionColor = Qt::yellow;
354
355 QgsLayoutMeasurementConverter mMeasurementConverter;
356
357 bool mIsPreviewRender = true;
358 bool mGridVisible = false;
359 bool mBoundingBoxesVisible = true;
360 bool mPagesVisible = true;
361
363
364 QStringList mExportThemes;
365
366 QgsVectorSimplifyMethod mSimplifyMethod;
367
368 QVector<qreal> mPredefinedScales;
369
370 QgsFeatureFilterProvider *mFeatureFilterProvider = nullptr;
371
372 friend class QgsLayoutExporter;
373 friend class TestQgsLayout;
374 friend class LayoutContextPreviewSettingRestorer;
375 friend class TestQgsLayoutMap;
376 friend class TestQgsLayoutLabel;
377
378};
379
380Q_DECLARE_METATYPE( QgsLayoutRenderContext::Flags )
381
382#endif //QGSLAYOUTRENDERCONTEXT_H
383
384
385
TextRenderFormat
Flags which control how map layer renderers behave.
Definition qgis.h:2055
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
Abstract interface for use by classes that filter the features or attributes of a layer.
Handles rendering and exports of layouts to various formats.
This class provides a method of converting QgsLayoutMeasurements from one unit to another.
Stores information relating to the current rendering settings for a 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::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.
QVector< qreal > predefinedScales() const
Returns the current list of predefined scales for use with the layout.
void flagsChanged(QgsLayoutRenderContext::Flags flags)
Emitted whenever the context's flags change.
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.
QColor selectionColor() const
Gets color that is used for drawing of selected vector features.
Flag
Flags for controlling how a layout is rendered.
Q_DECL_DEPRECATED void setCurrentExportLayer(int layer=-1)
Sets the current item layer to draw while exporting.
const QgsLayoutMeasurementConverter & measurementConverter() const
Returns the layout measurement converter to be used in 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
This class contains information how to simplify geometries fetched from a vector layer.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)