QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsMapSettings Class Reference

The QgsMapSettings class contains configuration for rendering of the map. More...

#include <qgsmapsettings.h>

Public Types

enum  Flag {
  Antialiasing = 0x01, DrawEditingInfo = 0x02, ForceVectorOutput = 0x04, UseAdvancedEffects = 0x08,
  DrawLabeling = 0x10, UseRenderingOptimization = 0x20, DrawSelection = 0x40, DrawSymbolBounds = 0x80,
  RenderMapTile = 0x100, RenderPartialOutput = 0x200, RenderPreviewJob = 0x400
}
 Enumeration of flags that adjust the way the map is rendered. More...
 

Public Member Functions

 QgsMapSettings ()
 
QColor backgroundColor () const
 Gets the background color of the map. More...
 
QString customRenderFlags () const
 Gets custom rendering flags. More...
 
QgsCoordinateReferenceSystem destinationCrs () const
 returns CRS of destination coordinate reference system More...
 
QSize deviceOutputSize () const
 Returns the device output size of the map canvas This is equivalent to the output size multiplicated by the device pixel ratio. More...
 
float devicePixelRatio () const
 Returns device pixel ratio Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays. More...
 
QString ellipsoid () const
 Returns ellipsoid's acronym. More...
 
const QgsExpressionContextexpressionContext () const
 Gets the expression context. More...
 
QgsRectangle extent () const
 Returns geographical coordinates of the rectangle that should be rendered. More...
 
Flags flags () const
 Returns combination of flags used for rendering. More...
 
QgsRectangle fullExtent () const
 returns current extent of layer set More...
 
bool hasValidSettings () const
 Check whether the map settings are valid and can be used for rendering. More...
 
const QgsLabelingEngineSettingslabelingEngineSettings () const
 Returns the global configuration of the labeling engine. More...
 
QgsRectangle layerExtentToOutputExtent (const QgsMapLayer *layer, QgsRectangle extent) const
 transform bounding box from layer's CRS to output CRS More...
 
QStringList layerIds () const
 Gets list of layer IDs for map rendering The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top) More...
 
QList< QgsMapLayer * > layers () const
 Gets list of layers for map rendering The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top) More...
 
QMap< QString, QString > layerStyleOverrides () const
 Gets map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one. More...
 
QgsPointXY layerToMapCoordinates (const QgsMapLayer *layer, QgsPointXY point) const
 transform point coordinates from layer's CRS to output CRS More...
 
QgsRectangle layerToMapCoordinates (const QgsMapLayer *layer, QgsRectangle rect) const
 transform rectangle from layer's CRS to output CRS More...
 
double layerToMapUnits (const QgsMapLayer *layer, const QgsRectangle &referenceExtent=QgsRectangle()) const
 Computes an estimated conversion factor between layer and map units: layerUnits * layerToMapUnits = mapUnits. More...
 
QgsCoordinateTransform layerTransform (const QgsMapLayer *layer) const
 Returns the coordinate transform from layer's CRS to destination CRS. More...
 
double magnificationFactor () const
 Returns the magnification factor. More...
 
QgsPointXY mapToLayerCoordinates (const QgsMapLayer *layer, QgsPointXY point) const
 transform point coordinates from output CRS to layer's CRS More...
 
QgsRectangle mapToLayerCoordinates (const QgsMapLayer *layer, QgsRectangle rect) const
 transform rectangle from output CRS to layer's CRS More...
 
const QgsMapToPixelmapToPixel () const
 
QgsUnitTypes::DistanceUnit mapUnits () const
 Gets units of map's geographical coordinates - used for scale calculation. More...
 
double mapUnitsPerPixel () const
 Returns the distance in geographical coordinates that equals to one pixel in the map. More...
 
double outputDpi () const
 Returns DPI used for conversion between real world units (e.g. More...
 
QgsRectangle outputExtentToLayerExtent (const QgsMapLayer *layer, QgsRectangle extent) const
 transform bounding box from output CRS to layer's CRS More...
 
QImage::Format outputImageFormat () const
 format of internal QImage, default QImage::Format_ARGB32_Premultiplied More...
 
QSize outputSize () const
 Returns the size of the resulting map image. More...
 
const QgsPathResolverpathResolver () const
 Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g. More...
 
void readXml (QDomNode &node)
 
double rotation () const
 Returns the rotation of the resulting map image, in degrees clockwise. More...
 
double scale () const
 Returns the calculated map scale. More...
 
double segmentationTolerance () const
 Gets the segmentation tolerance applied when rendering curved geometries. More...
 
QgsAbstractGeometry::SegmentationToleranceType segmentationToleranceType () const
 Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation) More...
 
QColor selectionColor () const
 Gets color that is used for drawing of selected vector features. More...
 
void setBackgroundColor (const QColor &color)
 Sets the background color of the map. More...
 
void setCustomRenderFlags (const QString &customRenderFlags)
 Sets the custom rendering flags. More...
 
void setDestinationCrs (const QgsCoordinateReferenceSystem &crs)
 sets destination coordinate reference system More...
 
void setDevicePixelRatio (float dpr)
 Sets the device pixel ratio Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays. More...
 
bool setEllipsoid (const QString &ellipsoid)
 Sets the ellipsoid by its acronym. More...
 
void setExpressionContext (const QgsExpressionContext &context)
 Sets the expression context. More...
 
void setExtent (const QgsRectangle &rect, bool magnified=true)
 Set coordinates of the rectangle which should be rendered. More...
 
void setFlag (Flag flag, bool on=true)
 Enable or disable a particular flag (other flags are not affected) More...
 
void setFlags (QgsMapSettings::Flags flags)
 Sets combination of flags that will be used for rendering. More...
 
void setLabelingEngineSettings (const QgsLabelingEngineSettings &settings)
 Sets the global configuration of the labeling engine. More...
 
void setLayers (const QList< QgsMapLayer * > &layers)
 Set list of layers for map rendering. More...
 
void setLayerStyleOverrides (const QMap< QString, QString > &overrides)
 Set map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one. More...
 
void setMagnificationFactor (double factor)
 Set the magnification factor. More...
 
void setOutputDpi (double dpi)
 Sets DPI used for conversion between real world units (e.g. mm) and pixels. More...
 
void setOutputImageFormat (QImage::Format format)
 sets format of internal QImage More...
 
void setOutputSize (QSize size)
 Sets the size of the resulting map image. More...
 
void setPathResolver (const QgsPathResolver &resolver)
 Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g. More...
 
void setRotation (double rotation)
 Sets the rotation of the resulting map image, in degrees clockwise. More...
 
void setSegmentationTolerance (double tolerance)
 Sets the segmentation tolerance applied when rendering curved geometries. More...
 
void setSegmentationToleranceType (QgsAbstractGeometry::SegmentationToleranceType type)
 Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation) More...
 
void setSelectionColor (const QColor &color)
 Sets color that is used for drawing of selected vector features. More...
 
void setTextRenderFormat (QgsRenderContext::TextRenderFormat format)
 Sets the text render format, which dictates how text is rendered (e.g. More...
 
void setTransformContext (const QgsCoordinateTransformContext &context)
 Sets the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system. More...
 
bool testFlag (Flag flag) const
 Check whether a particular flag is enabled. More...
 
QgsRenderContext::TextRenderFormat textRenderFormat () const
 Returns the text render format, which dictates how text is rendered (e.g. More...
 
QgsCoordinateTransformContext transformContext () const
 Returns the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system. More...
 
QgsRectangle visibleExtent () const
 Returns the actual extent derived from requested extent that takes takes output image size into account. More...
 
QPolygonF visiblePolygon () const
 Returns the visible area as a polygon (may be rotated) More...
 
void writeXml (QDomNode &node, QDomDocument &doc)
 

Protected Member Functions

void updateDerived ()
 

Protected Attributes

QColor mBackgroundColor
 
QString mCustomRenderFlags
 
QgsCoordinateReferenceSystem mDestCRS
 
float mDevicePixelRatio = 1.0
 
double mDpi
 
QString mEllipsoid
 ellipsoid acronym (from table tbl_ellipsoids) More...
 
QgsExpressionContext mExpressionContext
 
QgsRectangle mExtent
 
Flags mFlags
 
QImage::Format mImageFormat = QImage::Format_ARGB32_Premultiplied
 
QgsLabelingEngineSettings mLabelingEngineSettings
 
QgsWeakMapLayerPointerList mLayers
 list of layers to be rendered (stored as weak pointers) More...
 
QMap< QString, QString > mLayerStyleOverrides
 
double mMagnificationFactor = 1.0
 
QgsMapToPixel mMapToPixel
 
double mMapUnitsPerPixel = 1
 
QgsPathResolver mPathResolver
 
double mRotation = 0.0
 
double mScale = 1
 
QgsScaleCalculator mScaleCalculator
 
double mSegmentationTolerance
 
QgsAbstractGeometry::SegmentationToleranceType mSegmentationToleranceType = QgsAbstractGeometry::MaximumAngle
 
QColor mSelectionColor
 
QSize mSize
 
QgsRenderContext::TextRenderFormat mTextRenderFormat = QgsRenderContext::TextFormatAlwaysOutlines
 
QgsCoordinateTransformContext mTransformContext
 
bool mValid = false
 Whether the actual settings are valid (set in updateDerived()) More...
 
QgsRectangle mVisibleExtent
 Extent with some additional white space that matches the output aspect ratio. More...
 

Detailed Description

The QgsMapSettings class contains configuration for rendering of the map.

The rendering itself is done by QgsMapRendererJob subclasses.

In order to set up QgsMapSettings instance, it is necessary to set at least few members: extent, output size and layers.

Some systems use high DPI scaling that is an alternative to the traditional DPI scaling. The operating system provides Qt with a scaling ratio and it scales window, event, and desktop geometry. The Cocoa platform plugin sets the scaling ratio as QWindow::devicePixelRatio(). To properly render the map on such systems, the map settings device pixel ratio shall be set accordingly.

Since
QGIS 2.4

Definition at line 60 of file qgsmapsettings.h.

Member Enumeration Documentation

Enumeration of flags that adjust the way the map is rendered.

Enumerator
Antialiasing 

Enable anti-aliasing for map rendering.

DrawEditingInfo 

Enable drawing of vertex markers for layers in editing mode.

ForceVectorOutput 

Vector graphics should not be cached and drawn as raster images.

UseAdvancedEffects 

Enable layer opacity and blending effects.

DrawLabeling 

Enable drawing of labels on top of the map.

UseRenderingOptimization 

Enable vector simplification and other rendering optimizations.

DrawSelection 

Whether vector selections should be shown in the rendered map.

DrawSymbolBounds 

Draw bounds of symbols (for debugging/testing)

RenderMapTile 

Draw map such that there are no problems between adjacent tiles.

RenderPartialOutput 

Whether to make extra effort to update map image with partially rendered layers (better for interactive map canvas). Added in QGIS 3.0.

RenderPreviewJob 

Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering.

Definition at line 230 of file qgsmapsettings.h.

Constructor & Destructor Documentation

QgsMapSettings::QgsMapSettings ( )

Definition at line 34 of file qgsmapsettings.cpp.

Member Function Documentation

QColor QgsMapSettings::backgroundColor ( ) const
inline

Gets the background color of the map.

Definition at line 222 of file qgsmapsettings.h.

QString QgsMapSettings::customRenderFlags ( ) const
inline

Gets custom rendering flags.

Layers might honour these to alter their rendering.

Returns
custom flags strings, separated by ';'
See also
setCustomRenderFlags()
Since
QGIS 2.16

Definition at line 183 of file qgsmapsettings.h.

QgsCoordinateReferenceSystem QgsMapSettings::destinationCrs ( ) const

returns CRS of destination coordinate reference system

Definition at line 304 of file qgsmapsettings.cpp.

QSize QgsMapSettings::deviceOutputSize ( ) const

Returns the device output size of the map canvas This is equivalent to the output size multiplicated by the device pixel ratio.

Since
QGIS 3.4

Definition at line 244 of file qgsmapsettings.cpp.

float QgsMapSettings::devicePixelRatio ( ) const

Returns device pixel ratio Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.

Since
QGIS 3.4

Definition at line 233 of file qgsmapsettings.cpp.

QString QgsMapSettings::ellipsoid ( ) const
inline

Returns ellipsoid's acronym.

Calculations will only use the ellipsoid if a valid ellipsoid has been set.

See also
setEllipsoid()
Since
QGIS 3.0

Definition at line 217 of file qgsmapsettings.h.

const QgsExpressionContext& QgsMapSettings::expressionContext ( ) const
inline

Gets the expression context.

This context should be used for all expression evaluation associated with this map settings.

See also
setExpressionContext()
Since
QGIS 2.12

Definition at line 322 of file qgsmapsettings.h.

QgsRectangle QgsMapSettings::extent ( ) const

Returns geographical coordinates of the rectangle that should be rendered.

The actual visible extent used for rendering could be slightly different since the given extent may be expanded in order to fit the aspect ratio of output size. Use visibleExtent() to get the resulting extent.

Definition at line 73 of file qgsmapsettings.cpp.

QgsMapSettings::Flags QgsMapSettings::flags ( ) const

Returns combination of flags used for rendering.

Definition at line 336 of file qgsmapsettings.cpp.

QgsRectangle QgsMapSettings::fullExtent ( ) const

returns current extent of layer set

Definition at line 536 of file qgsmapsettings.cpp.

bool QgsMapSettings::hasValidSettings ( ) const

Check whether the map settings are valid and can be used for rendering.

Definition at line 352 of file qgsmapsettings.cpp.

const QgsLabelingEngineSettings& QgsMapSettings::labelingEngineSettings ( ) const
inline

Returns the global configuration of the labeling engine.

See also
setLabelingEngineSettings()
Since
QGIS 3.0

Definition at line 464 of file qgsmapsettings.h.

QgsRectangle QgsMapSettings::layerExtentToOutputExtent ( const QgsMapLayer layer,
QgsRectangle  extent 
) const

transform bounding box from layer's CRS to output CRS

See also
layerToMapCoordinates( const QgsMapLayer *, QgsRectangle ) const if you want to transform a rectangle
Returns
a bounding box (aligned rectangle) containing the transformed extent

Definition at line 419 of file qgsmapsettings.cpp.

QStringList QgsMapSettings::layerIds ( ) const

Gets list of layer IDs for map rendering The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)

Definition at line 262 of file qgsmapsettings.cpp.

QList< QgsMapLayer * > QgsMapSettings::layers ( ) const

Gets list of layers for map rendering The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)

Definition at line 268 of file qgsmapsettings.cpp.

QMap< QString, QString > QgsMapSettings::layerStyleOverrides ( ) const

Gets map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one.

Since
QGIS 2.8

Definition at line 286 of file qgsmapsettings.cpp.

QgsPointXY QgsMapSettings::layerToMapCoordinates ( const QgsMapLayer layer,
QgsPointXY  point 
) const

transform point coordinates from layer's CRS to output CRS

Returns
the transformed point

Definition at line 467 of file qgsmapsettings.cpp.

QgsRectangle QgsMapSettings::layerToMapCoordinates ( const QgsMapLayer layer,
QgsRectangle  rect 
) const

transform rectangle from layer's CRS to output CRS

See also
layerExtentToOutputExtent() if you want to transform a bounding box
Returns
the transformed rectangle

Definition at line 484 of file qgsmapsettings.cpp.

double QgsMapSettings::layerToMapUnits ( const QgsMapLayer layer,
const QgsRectangle referenceExtent = QgsRectangle() 
) const

Computes an estimated conversion factor between layer and map units: layerUnits * layerToMapUnits = mapUnits.

Parameters
layerThe layer
referenceExtentA reference extent based on which to perform the computation. If not specified, the layer extent is used
Since
QGIS 2.12

Definition at line 413 of file qgsmapsettings.cpp.

QgsCoordinateTransform QgsMapSettings::layerTransform ( const QgsMapLayer layer) const

Returns the coordinate transform from layer's CRS to destination CRS.

Returns
transform - may be invalid if the transform is not needed

Definition at line 405 of file qgsmapsettings.cpp.

double QgsMapSettings::magnificationFactor ( ) const

Returns the magnification factor.

See also
setMagnificationFactor()
Since
QGIS 2.16

Definition at line 68 of file qgsmapsettings.cpp.

QgsPointXY QgsMapSettings::mapToLayerCoordinates ( const QgsMapLayer layer,
QgsPointXY  point 
) const

transform point coordinates from output CRS to layer's CRS

Returns
the transformed point

Definition at line 501 of file qgsmapsettings.cpp.

QgsRectangle QgsMapSettings::mapToLayerCoordinates ( const QgsMapLayer layer,
QgsRectangle  rect 
) const

transform rectangle from output CRS to layer's CRS

See also
outputExtentToLayerExtent() if you want to transform a bounding box
Returns
the transformed rectangle

Definition at line 518 of file qgsmapsettings.cpp.

const QgsMapToPixel& QgsMapSettings::mapToPixel ( ) const
inline

Definition at line 362 of file qgsmapsettings.h.

QgsUnitTypes::DistanceUnit QgsMapSettings::mapUnits ( ) const

Gets units of map's geographical coordinates - used for scale calculation.

Definition at line 346 of file qgsmapsettings.cpp.

double QgsMapSettings::mapUnitsPerPixel ( ) const

Returns the distance in geographical coordinates that equals to one pixel in the map.

Definition at line 377 of file qgsmapsettings.cpp.

double QgsMapSettings::outputDpi ( ) const

Returns DPI used for conversion between real world units (e.g.

mm) and pixels Default value is 96

Definition at line 249 of file qgsmapsettings.cpp.

QgsRectangle QgsMapSettings::outputExtentToLayerExtent ( const QgsMapLayer layer,
QgsRectangle  extent 
) const

transform bounding box from output CRS to layer's CRS

See also
mapToLayerCoordinates( const QgsMapLayer *, QgsRectangle ) const if you want to transform a rectangle
Returns
a bounding box (aligned rectangle) containing the transformed extent

Definition at line 443 of file qgsmapsettings.cpp.

QImage::Format QgsMapSettings::outputImageFormat ( ) const
inline

format of internal QImage, default QImage::Format_ARGB32_Premultiplied

Definition at line 287 of file qgsmapsettings.h.

QSize QgsMapSettings::outputSize ( ) const

Returns the size of the resulting map image.

Definition at line 221 of file qgsmapsettings.cpp.

const QgsPathResolver& QgsMapSettings::pathResolver ( ) const
inline

Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g.

for resolving relative symbol paths.

See also
setPathResolver()
Since
QGIS 3.0

Definition at line 351 of file qgsmapsettings.h.

void QgsMapSettings::readXml ( QDomNode &  node)

Definition at line 594 of file qgsmapsettings.cpp.

double QgsMapSettings::rotation ( ) const

Returns the rotation of the resulting map image, in degrees clockwise.

See also
setRotation()
Since
QGIS 2.8

Definition at line 90 of file qgsmapsettings.cpp.

double QgsMapSettings::scale ( ) const

Returns the calculated map scale.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

Definition at line 382 of file qgsmapsettings.cpp.

double QgsMapSettings::segmentationTolerance ( ) const
inline

Gets the segmentation tolerance applied when rendering curved geometries.

Definition at line 432 of file qgsmapsettings.h.

QgsAbstractGeometry::SegmentationToleranceType QgsMapSettings::segmentationToleranceType ( ) const
inline

Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)

Definition at line 439 of file qgsmapsettings.h.

QColor QgsMapSettings::selectionColor ( ) const
inline

Gets color that is used for drawing of selected vector features.

Definition at line 227 of file qgsmapsettings.h.

void QgsMapSettings::setBackgroundColor ( const QColor &  color)
inline

Sets the background color of the map.

Definition at line 220 of file qgsmapsettings.h.

void QgsMapSettings::setCustomRenderFlags ( const QString &  customRenderFlags)
inline

Sets the custom rendering flags.

Layers might honour these to alter their rendering.

Parameters
customRenderFlagscustom flags strings, separated by ';'
See also
customRenderFlags()
Since
QGIS 2.16

Definition at line 191 of file qgsmapsettings.h.

void QgsMapSettings::setDestinationCrs ( const QgsCoordinateReferenceSystem crs)

sets destination coordinate reference system

Definition at line 296 of file qgsmapsettings.cpp.

void QgsMapSettings::setDevicePixelRatio ( float  dpr)

Sets the device pixel ratio Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.

Since
QGIS 3.4

Definition at line 238 of file qgsmapsettings.cpp.

bool QgsMapSettings::setEllipsoid ( const QString &  ellipsoid)

Sets the ellipsoid by its acronym.

Known ellipsoid acronyms can be retrieved using QgsEllipsoidUtils::acronyms(). Calculations will only use the ellipsoid if a valid ellipsoid has been set.

Returns
true if ellipsoid was successfully set
See also
ellipsoid()
Since
QGIS 3.0

Definition at line 309 of file qgsmapsettings.cpp.

void QgsMapSettings::setExpressionContext ( const QgsExpressionContext context)
inline

Sets the expression context.

This context is used for all expression evaluation associated with this map settings.

See also
expressionContext()
Since
QGIS 2.12

Definition at line 314 of file qgsmapsettings.h.

void QgsMapSettings::setExtent ( const QgsRectangle rect,
bool  magnified = true 
)

Set coordinates of the rectangle which should be rendered.

The actual visible extent used for rendering could be slightly different since the given extent may be expanded in order to fit the aspect ratio of output size. Use visibleExtent() to get the resulting extent.

Definition at line 78 of file qgsmapsettings.cpp.

void QgsMapSettings::setFlag ( QgsMapSettings::Flag  flag,
bool  on = true 
)

Enable or disable a particular flag (other flags are not affected)

Definition at line 328 of file qgsmapsettings.cpp.

void QgsMapSettings::setFlags ( QgsMapSettings::Flags  flags)

Sets combination of flags that will be used for rendering.

Definition at line 323 of file qgsmapsettings.cpp.

void QgsMapSettings::setLabelingEngineSettings ( const QgsLabelingEngineSettings settings)
inline

Sets the global configuration of the labeling engine.

Note
Calling this method will reset the textRenderFormat() to match the default text render format from the label engine settings.
See also
labelingEngineSettings()
Since
QGIS 3.0

Definition at line 451 of file qgsmapsettings.h.

void QgsMapSettings::setLayers ( const QList< QgsMapLayer * > &  layers)

Set list of layers for map rendering.

The layers must be registered in QgsProject. The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)

Note
Any non-spatial layers will be automatically stripped from the list (since they cannot be rendered!).

Definition at line 273 of file qgsmapsettings.cpp.

void QgsMapSettings::setLayerStyleOverrides ( const QMap< QString, QString > &  overrides)

Set map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one.

Since
QGIS 2.8

Definition at line 291 of file qgsmapsettings.cpp.

void QgsMapSettings::setMagnificationFactor ( double  factor)

Set the magnification factor.

Parameters
factorthe factor of magnification
See also
magnificationFactor()
Since
QGIS 2.16

Definition at line 47 of file qgsmapsettings.cpp.

void QgsMapSettings::setOutputDpi ( double  dpi)

Sets DPI used for conversion between real world units (e.g. mm) and pixels.

Definition at line 254 of file qgsmapsettings.cpp.

void QgsMapSettings::setOutputImageFormat ( QImage::Format  format)
inline

sets format of internal QImage

Definition at line 285 of file qgsmapsettings.h.

void QgsMapSettings::setOutputSize ( QSize  size)

Sets the size of the resulting map image.

Definition at line 226 of file qgsmapsettings.cpp.

void QgsMapSettings::setPathResolver ( const QgsPathResolver resolver)
inline

Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g.

for resolving relative symbol paths.

See also
pathResolver()
Since
QGIS 3.0

Definition at line 360 of file qgsmapsettings.h.

void QgsMapSettings::setRotation ( double  rotation)

Sets the rotation of the resulting map image, in degrees clockwise.

See also
rotation()
Since
QGIS 2.8

Definition at line 95 of file qgsmapsettings.cpp.

void QgsMapSettings::setSegmentationTolerance ( double  tolerance)
inline

Sets the segmentation tolerance applied when rendering curved geometries.

Parameters
tolerancethe segmentation tolerance

Definition at line 430 of file qgsmapsettings.h.

void QgsMapSettings::setSegmentationToleranceType ( QgsAbstractGeometry::SegmentationToleranceType  type)
inline

Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)

Parameters
typethe segmentation tolerance typename

Definition at line 437 of file qgsmapsettings.h.

void QgsMapSettings::setSelectionColor ( const QColor &  color)
inline

Sets color that is used for drawing of selected vector features.

Definition at line 225 of file qgsmapsettings.h.

void QgsMapSettings::setTextRenderFormat ( QgsRenderContext::TextRenderFormat  format)
inline

Sets the text render format, which dictates how text is rendered (e.g.

as paths or real text objects).

Warning
Calling the setLabelingEngineSettings() method will reset the text render format to match the default text render format from the label engine settings.
See also
textRenderFormat()
Since
QGIS 3.4.3

Definition at line 276 of file qgsmapsettings.h.

void QgsMapSettings::setTransformContext ( const QgsCoordinateTransformContext context)

Sets the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.

See also
transformContext()
Since
QGIS 3.0

Definition at line 397 of file qgsmapsettings.cpp.

bool QgsMapSettings::testFlag ( QgsMapSettings::Flag  flag) const

Check whether a particular flag is enabled.

Definition at line 341 of file qgsmapsettings.cpp.

QgsRenderContext::TextRenderFormat QgsMapSettings::textRenderFormat ( ) const
inline

Returns the text render format, which dictates how text is rendered (e.g.

as paths or real text objects).

See also
setTextRenderFormat()
Since
QGIS 3.4.3

Definition at line 262 of file qgsmapsettings.h.

QgsCoordinateTransformContext QgsMapSettings::transformContext ( ) const

Returns the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.

See also
setTransformContext()
Since
QGIS 3.0

Definition at line 387 of file qgsmapsettings.cpp.

void QgsMapSettings::updateDerived ( )
protected

Definition at line 107 of file qgsmapsettings.cpp.

QgsRectangle QgsMapSettings::visibleExtent ( ) const

Returns the actual extent derived from requested extent that takes takes output image size into account.

Definition at line 357 of file qgsmapsettings.cpp.

QPolygonF QgsMapSettings::visiblePolygon ( ) const

Returns the visible area as a polygon (may be rotated)

Since
QGIS 2.8

Definition at line 362 of file qgsmapsettings.cpp.

void QgsMapSettings::writeXml ( QDomNode &  node,
QDomDocument &  doc 
)

Definition at line 629 of file qgsmapsettings.cpp.

Member Data Documentation

QColor QgsMapSettings::mBackgroundColor
protected

Definition at line 488 of file qgsmapsettings.h.

QString QgsMapSettings::mCustomRenderFlags
protected

Definition at line 481 of file qgsmapsettings.h.

QgsCoordinateReferenceSystem QgsMapSettings::mDestCRS
protected

Definition at line 484 of file qgsmapsettings.h.

float QgsMapSettings::mDevicePixelRatio = 1.0
protected

Definition at line 471 of file qgsmapsettings.h.

double QgsMapSettings::mDpi
protected

Definition at line 468 of file qgsmapsettings.h.

QString QgsMapSettings::mEllipsoid
protected

ellipsoid acronym (from table tbl_ellipsoids)

Definition at line 486 of file qgsmapsettings.h.

QgsExpressionContext QgsMapSettings::mExpressionContext
protected

Definition at line 482 of file qgsmapsettings.h.

QgsRectangle QgsMapSettings::mExtent
protected

Definition at line 473 of file qgsmapsettings.h.

Flags QgsMapSettings::mFlags
protected

Definition at line 491 of file qgsmapsettings.h.

QImage::Format QgsMapSettings::mImageFormat = QImage::Format_ARGB32_Premultiplied
protected

Definition at line 493 of file qgsmapsettings.h.

QgsLabelingEngineSettings QgsMapSettings::mLabelingEngineSettings
protected

Definition at line 498 of file qgsmapsettings.h.

QgsWeakMapLayerPointerList QgsMapSettings::mLayers
protected

list of layers to be rendered (stored as weak pointers)

Definition at line 479 of file qgsmapsettings.h.

QMap<QString, QString> QgsMapSettings::mLayerStyleOverrides
protected

Definition at line 480 of file qgsmapsettings.h.

double QgsMapSettings::mMagnificationFactor = 1.0
protected

Definition at line 476 of file qgsmapsettings.h.

QgsMapToPixel QgsMapSettings::mMapToPixel
protected

Definition at line 508 of file qgsmapsettings.h.

double QgsMapSettings::mMapUnitsPerPixel = 1
protected

Definition at line 503 of file qgsmapsettings.h.

QgsPathResolver QgsMapSettings::mPathResolver
protected

Definition at line 512 of file qgsmapsettings.h.

double QgsMapSettings::mRotation = 0.0
protected

Definition at line 475 of file qgsmapsettings.h.

double QgsMapSettings::mScale = 1
protected

Definition at line 504 of file qgsmapsettings.h.

QgsScaleCalculator QgsMapSettings::mScaleCalculator
protected

Definition at line 507 of file qgsmapsettings.h.

double QgsMapSettings::mSegmentationTolerance
protected

Definition at line 495 of file qgsmapsettings.h.

QgsAbstractGeometry::SegmentationToleranceType QgsMapSettings::mSegmentationToleranceType = QgsAbstractGeometry::MaximumAngle
protected

Definition at line 496 of file qgsmapsettings.h.

QColor QgsMapSettings::mSelectionColor
protected

Definition at line 489 of file qgsmapsettings.h.

QSize QgsMapSettings::mSize
protected

Definition at line 470 of file qgsmapsettings.h.

Definition at line 514 of file qgsmapsettings.h.

QgsCoordinateTransformContext QgsMapSettings::mTransformContext
protected

Definition at line 510 of file qgsmapsettings.h.

bool QgsMapSettings::mValid = false
protected

Whether the actual settings are valid (set in updateDerived())

Definition at line 501 of file qgsmapsettings.h.

QgsRectangle QgsMapSettings::mVisibleExtent
protected

Extent with some additional white space that matches the output aspect ratio.

Definition at line 502 of file qgsmapsettings.h.


The documentation for this class was generated from the following files: