Skip to content

Class QgsQuickMapCanvasMap

ClassList > QgsQuickMapCanvasMap

More...

  • #include <qgsquickmapcanvasmap.h>

Inherits the following classes: QQuickItem

Public Slots

Type Name
slot void pan (const QPointF oldPos, const QPointF newPos)
slot void refresh (bool ignoreFreeze=false)
slot void rotate (double degrees)
slot void schedulePreviewJob (int number)
slot void startPreviewJobs
slot void stopPreviewJobs
slot void stopRendering
Stop map rendering.
slot void zoomByFactor (const QPointF center, qreal factor, bool handleMargins=false)
slot void zoomScale (const QPointF center, qreal scale, bool handleMargins=false)

Public Properties

Type Name
property double bottomMargin
property double forceDeferredLayersRepaint
property bool freeze
property bool incrementalRendering
property bool isRendering
property QgsQuickMapSettings * mapSettings
property int mapUpdateInterval
property bool previewJobsEnabled
property QList< int > previewJobsQuadrants
property double quality
property double rightMargin
property bool smooth

Public Signals

Type Name
signal void bottomMarginChanged
signal void forceDeferredLayersRepaintChanged
signal void freezeChanged
signal void incrementalRenderingChanged
signal void isRenderingChanged
signal void mapCanvasRefreshed
signal void mapUpdateIntervalChanged
signal void previewJobsEnabledChanged
signal void previewJobsQuadrantsChanged
signal void qualityChanged
signal void renderStarting
signal void rightMarginChanged
signal void smoothChanged

Public Functions

Type Name
QgsQuickMapCanvasMap (QQuickItem * parent=nullptr)
Create map canvas map.
double bottomMargin () const
bool forceDeferredLayersRepaint () const
bool freeze () const
QImage image () const
bool incrementalRendering () const
bool isRendering () const
QgsQuickMapSettings * mapSettings () const
int mapUpdateInterval () const
bool previewJobsEnabled () const
QList< int > previewJobsQuadrants () const
double quality () const
double rightMargin () const
void setBottomMargin (double bottomMargin)
void setForceDeferredLayersRepaint (bool deferred)
void setFreeze (bool freeze)
void setIncrementalRendering (bool incrementalRendering)
void setMapUpdateInterval (int mapUpdateInterval)
void setPreviewJobsEnabled (bool enabled)
void setPreviewJobsQuadrants (const QList< int > & quadrants)
void setQuality (double quality)
void setRightMargin (double rightMargin)
void setSmooth (bool smooth)
bool smooth () const
QSGNode * updatePaintNode (QSGNode * oldNode, QQuickItem::UpdatePaintNodeData *) override
~QgsQuickMapCanvasMap ()

Protected Functions

Type Name
void geometryChange (const QRectF & newGeometry, const QRectF & oldGeometry) override

Detailed Description

This class implements a visual Qt Quick Item that does map rendering according to the current map settings. Client code is expected to use MapCanvas item rather than using this class directly.

QgsQuickMapCanvasMap instance internally creates QgsQuickMapSettings in constructor. The QgsProject should be attached to the QgsQuickMapSettings. The map settings for other QgsQuick components should be initialized from QgsQuickMapCanvasMap's mapSettings

Note:

QML Type: MapCanvasMap

Public Properties Documentation

property bottomMargin [1/2]

double QgsQuickMapCanvasMap::bottomMargin;

The bottom margin used by the map settings when calculating map extent or center.


property forceDeferredLayersRepaint [1/2]

double QgsQuickMapCanvasMap::forceDeferredLayersRepaint;

When the forceDeferredLayersRepaint property is set to true, all layer repaint signals will be deferred.


property freeze [1/2]

bool QgsQuickMapCanvasMap::freeze;

When freeze property is set to true, the map canvas does not refresh. The value temporary changes during the rendering process.


property incrementalRendering [1/2]

bool QgsQuickMapCanvasMap::incrementalRendering;

When the incrementalRendering property is set to true, the automatic refresh of map canvas during rendering is allowed.


property isRendering [1/2]

bool QgsQuickMapCanvasMap::isRendering;

The isRendering property is set to true while a rendering job is pending for this map canvas map. It can be used to show a notification icon about an ongoing rendering job. This is a readonly property.


property mapSettings [1/2]

QgsQuickMapSettings * QgsQuickMapCanvasMap::mapSettings;

The mapSettings property contains configuration for rendering of the map.

It should be used as a primary source of map settings (and project) for all other components in the application.

This is a readonly property.


property mapUpdateInterval [1/2]

int QgsQuickMapCanvasMap::mapUpdateInterval;

Interval in milliseconds after which the map canvas will be updated while a rendering job is ongoing. This only has an effect if incrementalRendering is activated. Default is 250 [ms].


property previewJobsEnabled [1/2]

bool QgsQuickMapCanvasMap::previewJobsEnabled;

When the previewJobsEnabled property is set to true, canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) while be rendered.


property previewJobsQuadrants [1/2]

QList<int> QgsQuickMapCanvasMap::previewJobsQuadrants;

The previewJobsQuadrants property is used to customize the preview jobs ordering. The possible quadrant integer values are:

0 (top left) | 1 (top) | 2 (top right) 3 (left) | canvas | 5 (right) 6 (bottom left) | 7 (bottom) | 8 (bottom right)


property quality [1/2]

double QgsQuickMapCanvasMap::quality;

The quality property allows for an increase in rendering speed and memory usage reduction at the cost of rendering quality.

By default, the value is set to 1.0, providing for the best rendering. The lowest quality value is 0.5.


property rightMargin [1/2]

double QgsQuickMapCanvasMap::rightMargin;

The right margin used by the map settings when calculating map extent or center.


property smooth [1/2]

bool QgsQuickMapCanvasMap::smooth;

When the smooth property is set to true, canvas map panning, zooming, and rotation changes while be interpolated to create a smoother transition.


Public Slots Documentation

slot pan

void QgsQuickMapCanvasMap::pan;

Set map setting's extent (pan the map) based on the difference of positions


slot refresh

void QgsQuickMapCanvasMap::refresh;

Refresh the map canvas. Does nothing when output size of map settings is not set


slot rotate

void QgsQuickMapCanvasMap::rotate;

Change the map rotation by degrees.


slot schedulePreviewJob

void QgsQuickMapCanvasMap::schedulePreviewJob;

slot startPreviewJobs

void QgsQuickMapCanvasMap::startPreviewJobs;

slot stopPreviewJobs

void QgsQuickMapCanvasMap::stopPreviewJobs;

slot stopRendering

Stop map rendering.

void QgsQuickMapCanvasMap::stopRendering;

slot zoomByFactor

void QgsQuickMapCanvasMap::zoomByFactor;

Set map setting's extent (zoom the map) on the center by given factor


slot zoomScale

void QgsQuickMapCanvasMap::zoomScale;

Set map setting's extent (zoom the map) on the center at a given scale


Public Signals Documentation

signal bottomMarginChanged

void QgsQuickMapCanvasMap::bottomMarginChanged;

The bottom margin used by the map settings when calculating map extent or center.


signal forceDeferredLayersRepaintChanged

void QgsQuickMapCanvasMap::forceDeferredLayersRepaintChanged;

When the forceDeferredLayersRepaint property is set to true, all layer repaint signals will be deferred.


signal freezeChanged

void QgsQuickMapCanvasMap::freezeChanged;

When freeze property is set to true, the map canvas does not refresh. The value temporary changes during the rendering process.


signal incrementalRenderingChanged

void QgsQuickMapCanvasMap::incrementalRenderingChanged;

When the incrementalRendering property is set to true, the automatic refresh of map canvas during rendering is allowed.


signal isRenderingChanged

void QgsQuickMapCanvasMap::isRenderingChanged;

The isRendering property is set to true while a rendering job is pending for this map canvas map. It can be used to show a notification icon about an ongoing rendering job. This is a readonly property.


signal mapCanvasRefreshed

void QgsQuickMapCanvasMap::mapCanvasRefreshed;

Signal is emitted when a canvas is refreshed


signal mapUpdateIntervalChanged

void QgsQuickMapCanvasMap::mapUpdateIntervalChanged;

Interval in milliseconds after which the map canvas will be updated while a rendering job is ongoing. This only has an effect if incrementalRendering is activated. Default is 250 [ms].


signal previewJobsEnabledChanged

void QgsQuickMapCanvasMap::previewJobsEnabledChanged;

When the previewJobsEnabled property is set to true, canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) while be rendered.


signal previewJobsQuadrantsChanged

void QgsQuickMapCanvasMap::previewJobsQuadrantsChanged;

The previewJobsQuadrants property is used to customize the preview jobs ordering. The possible quadrant integer values are:

0 (top left) | 1 (top) | 2 (top right) 3 (left) | canvas | 5 (right) 6 (bottom left) | 7 (bottom) | 8 (bottom right)


signal qualityChanged

void QgsQuickMapCanvasMap::qualityChanged;

The quality property allows for an increase in rendering speed and memory usage reduction at the cost of rendering quality.

By default, the value is set to 1.0, providing for the best rendering. The lowest quality value is 0.5.


signal renderStarting

void QgsQuickMapCanvasMap::renderStarting;

Signal is emitted when a rendering is starting


signal rightMarginChanged

void QgsQuickMapCanvasMap::rightMarginChanged;

The right margin used by the map settings when calculating map extent or center.


signal smoothChanged

void QgsQuickMapCanvasMap::smoothChanged;

The previewJobsQuadrants property is used to customize the preview jobs ordering. The possible quadrant integer values are:

0 (top left) | 1 (top) | 2 (top right) 3 (left) | canvas | 5 (right) 6 (bottom left) | 7 (bottom) | 8 (bottom right)


Public Functions Documentation

function QgsQuickMapCanvasMap

Create map canvas map.

explicit QgsQuickMapCanvasMap::QgsQuickMapCanvasMap (
    QQuickItem * parent=nullptr
) 

function bottomMargin [2/2]

double QgsQuickMapCanvasMap::bottomMargin () const

The bottom margin used by the map settings when calculating map extent or center.


function forceDeferredLayersRepaint [2/2]

bool QgsQuickMapCanvasMap::forceDeferredLayersRepaint () const

When the forceDeferredLayersRepaint property is set to true, all layer repaint signals will be deferred.


function freeze [2/2]

bool QgsQuickMapCanvasMap::freeze () const

When freeze property is set to true, the map canvas does not refresh. The value temporary changes during the rendering process.


function image

inline QImage QgsQuickMapCanvasMap::image () const

Returns an image of the last successful map canvas rendering


function incrementalRendering [2/2]

bool QgsQuickMapCanvasMap::incrementalRendering () const

When the incrementalRendering property is set to true, the automatic refresh of map canvas during rendering is allowed.


function isRendering [2/2]

bool QgsQuickMapCanvasMap::isRendering () const

The isRendering property is set to true while a rendering job is pending for this map canvas map. It can be used to show a notification icon about an ongoing rendering job. This is a readonly property.


function mapSettings [2/2]

QgsQuickMapSettings * QgsQuickMapCanvasMap::mapSettings () const

The mapSettings property contains configuration for rendering of the map.

It should be used as a primary source of map settings (and project) for all other components in the application.

This is a readonly property.


function mapUpdateInterval [2/2]

int QgsQuickMapCanvasMap::mapUpdateInterval () const

Interval in milliseconds after which the map canvas will be updated while a rendering job is ongoing. This only has an effect if incrementalRendering is activated. Default is 250 [ms].


function previewJobsEnabled [2/2]

bool QgsQuickMapCanvasMap::previewJobsEnabled () const

When the previewJobsEnabled property is set to true, canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) while be rendered.


function previewJobsQuadrants [2/2]

QList< int > QgsQuickMapCanvasMap::previewJobsQuadrants () const

The previewJobsQuadrants property is used to customize the preview jobs ordering. The possible quadrant integer values are:

0 (top left) | 1 (top) | 2 (top right) 3 (left) | canvas | 5 (right) 6 (bottom left) | 7 (bottom) | 8 (bottom right)


function quality [2/2]

double QgsQuickMapCanvasMap::quality () const

The quality property allows for an increase in rendering speed and memory usage reduction at the cost of rendering quality.

By default, the value is set to 1.0, providing for the best rendering. The lowest quality value is 0.5.


function rightMargin [2/2]

double QgsQuickMapCanvasMap::rightMargin () const

The right margin used by the map settings when calculating map extent or center.


function setBottomMargin

void QgsQuickMapCanvasMap::setBottomMargin (
    double bottomMargin
) 

The bottom margin used by the map settings when calculating map extent or center.


function setForceDeferredLayersRepaint

void QgsQuickMapCanvasMap::setForceDeferredLayersRepaint (
    bool deferred
) 

When the forceDeferredLayersRepaint property is set to true, all layer repaint signals will be deferred.


function setFreeze

void QgsQuickMapCanvasMap::setFreeze (
    bool freeze
) 

When freeze property is set to true, the map canvas does not refresh. The value temporary changes during the rendering process.


function setIncrementalRendering

void QgsQuickMapCanvasMap::setIncrementalRendering (
    bool incrementalRendering
) 

When the incrementalRendering property is set to true, the automatic refresh of map canvas during rendering is allowed.


function setMapUpdateInterval

void QgsQuickMapCanvasMap::setMapUpdateInterval (
    int mapUpdateInterval
) 

Interval in milliseconds after which the map canvas will be updated while a rendering job is ongoing. This only has an effect if incrementalRendering is activated. Default is 250 [ms].


function setPreviewJobsEnabled

void QgsQuickMapCanvasMap::setPreviewJobsEnabled (
    bool enabled
) 

When the previewJobsEnabled property is set to true, canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) while be rendered.


function setPreviewJobsQuadrants

void QgsQuickMapCanvasMap::setPreviewJobsQuadrants (
    const QList< int > & quadrants
) 

The previewJobsQuadrants property is used to customize the preview jobs ordering. The possible quadrant integer values are:

0 (top left) | 1 (top) | 2 (top right) 3 (left) | canvas | 5 (right) 6 (bottom left) | 7 (bottom) | 8 (bottom right)


function setQuality

void QgsQuickMapCanvasMap::setQuality (
    double quality
) 

When the incrementalRendering property is set to true, the automatic refresh of map canvas during rendering is allowed.


function setRightMargin

void QgsQuickMapCanvasMap::setRightMargin (
    double rightMargin
) 

The right margin used by the map settings when calculating map extent or center.


function setSmooth

void QgsQuickMapCanvasMap::setSmooth (
    bool smooth
) 

When the smooth property is set to true, canvas map panning, zooming, and rotation changes while be interpolated to create a smoother transition.


function smooth [2/2]

bool QgsQuickMapCanvasMap::smooth () const

When the smooth property is set to true, canvas map panning, zooming, and rotation changes while be interpolated to create a smoother transition.


function updatePaintNode

QSGNode * QgsQuickMapCanvasMap::updatePaintNode (
    QSGNode * oldNode,
    QQuickItem::UpdatePaintNodeData *
) override

function ~QgsQuickMapCanvasMap

QgsQuickMapCanvasMap::~QgsQuickMapCanvasMap () 

Protected Functions Documentation

function geometryChange

void QgsQuickMapCanvasMap::geometryChange (
    const QRectF & newGeometry,
    const QRectF & oldGeometry
) override


The documentation for this class was generated from the following file src/core/qgsquick/qgsquickmapcanvasmap.h