18 #ifndef QGSRENDERCONTEXT_H 19 #define QGSRENDERCONTEXT_H 21 #include "qgis_core.h" 69 DrawEditingInfo = 0x01,
70 ForceVectorOutput = 0x02,
71 UseAdvancedEffects = 0x04,
72 UseRenderingOptimization = 0x08,
74 DrawSymbolBounds = 0x20,
77 RenderPartialOutput = 0x100,
78 RenderPreviewJob = 0x200,
79 RenderBlocking = 0x400,
81 Q_DECLARE_FLAGS( Flags,
Flag )
131 void setFlags( QgsRenderContext::Flags flags );
137 void setFlag(
Flag flag,
bool on =
true );
149 bool testFlag(
Flag flag )
const;
180 const QPainter *
painter()
const {
return mPainter; }
192 QPainter *
maskPainter(
int id = 0 ) {
return mMaskPainter.value(
id,
nullptr ); }
330 bool forceVectorOutput()
const;
337 bool useAdvancedEffects()
const;
344 void setUseAdvancedEffects(
bool enabled );
351 bool drawEditingInformation()
const;
380 bool showSelection()
const;
434 void setDrawEditingInformation(
bool b );
500 void setForceVectorOutput(
bool force );
522 void setShowSelection(
bool showSelection );
529 bool useRenderingOptimization()
const;
536 void setUseRenderingOptimization(
bool enabled );
668 double convertMetersToMapUnits(
double meters )
const;
678 return mTextRenderFormat;
689 mTextRenderFormat = format;
697 QList<QgsRenderedFeatureHandlerInterface *> renderedFeatureHandlers()
const;
791 QPainter *mPainter =
nullptr;
799 QMap<int, QPainter *> mMaskPainter;
812 int mCurrentMaskId = -1;
818 bool mIsGuiPreview =
false;
836 bool mRenderingStopped =
false;
839 double mScaleFactor = 1.0;
842 double mRendererScale = 1.0;
848 QColor mSelectionColor;
860 std::unique_ptr< QgsFeatureFilterProvider > mFeatureFilterProvider;
862 double mSegmentationTolerance = M_PI_2 / 90;
871 QList< QgsRenderedFeatureHandlerInterface * > mRenderedFeatureHandlers;
872 bool mHasRenderedFeatureHandlers =
false;
873 QVariantMap mCustomRenderingFlags;
875 QSet<const QgsSymbolLayer *> mDisabledSymbolLayers;
878 bool mHasTransformContext =
false;
882 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsRenderContext::Flags )
Some rendering operations may need multiple mask images.
void setRenderingStopped(bool stopped)
Sets whether the rendering operation has been stopped and any ongoing rendering should be canceled im...
A rectangle specified with double values.
double rendererScale() const
Returns the renderer map scale.
const QgsPathResolver & pathResolver() const
Returns the path resolver for conversion between relative and absolute paths during rendering operati...
QSet< const QgsSymbolLayer * > disabledSymbolLayers() const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
const QgsVectorSimplifyMethod & vectorSimplifyMethod() const
Returns the simplification settings to use when rendering vector layers.
Maximum angle between generating radii (lines from arc center to output vertices) ...
QgsLabelingEngine * labelingEngine() const
Gets access to new labeling engine (may be nullptr)
Always render text as text objects.
void setRendererScale(double scale)
Sets the renderer map scale.
void setPathResolver(const QgsPathResolver &resolver)
Sets the path resolver for conversion between relative and absolute paths during rendering operations...
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
void setIsGuiPreview(bool preview)
Sets GUI preview mode.
void setVectorSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Sets the simplification setting to use when rendering vector layers.
QgsRectangle mapExtent() const
Returns the original extent of the map being rendered.
TextRenderFormat textRenderFormat() const
Returns the text render format, which dictates how text is rendered (e.g.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle...
QgsAbstractGeometry::SegmentationToleranceType segmentationToleranceType() const
Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation...
void setTextRenderFormat(TextRenderFormat format)
Sets the text render format, which dictates how text is rendered (e.g.
void setExtent(const QgsRectangle &extent)
When rendering a map layer, calling this method sets the "clipping" extent for the layer (in the laye...
void setMapExtent(const QgsRectangle &extent)
Sets the original extent of the map being rendered.
bool hasRenderedFeatureHandlers() const
Returns true if the context has any rendered feature handlers.
The QgsMapSettings class contains configuration for rendering of the map.
void setCurrentMaskId(int id)
Stores a mask id as the "current" one.
Perform transforms between map coordinates and device coordinates.
void setSelectionColor(const QColor &color)
Sets the color to use when rendering selected features.
void setScaleFactor(double factor)
Sets the scaling factor for the render to convert painter units to physical sizes.
bool isGuiPreview() const
Returns the Gui preview mode.
void setGeometry(const QgsAbstractGeometry *geometry)
Sets pointer to original (unsegmentized) geometry.
const QgsRectangle & extent() const
When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the l...
const QPainter * painter() const
Returns the const destination QPainter for the render operation.
const QgsAbstractGeometry * geometry() const
Returns pointer to the unsegmentized geometry.
Always render text using path objects (AKA outlines/curves).
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
An interface for classes which provider custom handlers for features rendered as part of a map render...
QColor selectionColor() const
Returns the color to use when rendering selected features.
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation.
void setMaskPainter(QPainter *p, int id=0)
Sets a mask QPainter for the render operation.
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
Abstract interface for use by classes that filter the features of a layer.
void setSegmentationToleranceType(QgsAbstractGeometry::SegmentationToleranceType type)
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation...
Abstract base class for all geometries.
Contains information about the context in which a coordinate transform is executed.
QPainter * maskPainter(int id=0)
Returns a mask QPainter for the render operation.
TextRenderFormat
Options for rendering text.
QgsExpressionContext & expressionContext()
Gets the expression context.
void setSegmentationTolerance(double tolerance)
Sets the segmentation tolerance applied when rendering curved geometries.
void setLabelingEngine(QgsLabelingEngine *engine)
Assign new labeling engine.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations...
The QgsLabelingEngine class provides map labeling functionality.
bool isSymbolLayerEnabled(const QgsSymbolLayer *layer) const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
double segmentationTolerance() const
Gets the segmentation tolerance applied when rendering curved geometries.
QPainter * painter()
Returns the destination QPainter for the render operation.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
void clearCustomRenderingFlag(const QString &flag)
Clears the specified custom rendering flag.
Struct for storing maximum and minimum scales for measurements in map units.
const QgsDistanceArea & distanceArea() const
A general purpose distance and area calculator, capable of performing ellipsoid based calculations...
void setMaskIdProvider(QgsMaskIdProvider *provider)
Attaches a mask id provider to the context.
void setMapToPixel(const QgsMapToPixel &mtp)
Sets the context's map to pixel transform, which transforms between map coordinates and device coordi...
void setCustomRenderingFlag(const QString &flag, const QVariant &value)
Sets a custom rendering flag.
QVariantMap customRenderingFlags() const
Gets custom rendering flags.
void setDistanceArea(const QgsDistanceArea &distanceArea)
A general purpose distance and area calculator, capable of performing ellipsoid based calculations...
Resolves relative paths into absolute paths and vice versa.
Flag
Enumeration of flags that affect rendering operations.
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
const QgsExpressionContext & expressionContext() const
Gets the expression context (const version).
void setDisabledSymbolLayers(const QSet< const QgsSymbolLayer *> &symbolLayers)
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
RenderUnit
Rendering size units.
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
const QgsMaskIdProvider * maskIdProvider() const
Returns the mask id provider attached to the context.
int currentMaskId() const
Returns the current mask id, which can be used with maskPainter()