QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of map rendering via QML properties. More...
#include <qgsquickmapsettings.h>
Signals | |
void | backgroundColorChanged () |
The background color used to render the map. | |
void | destinationCrsChanged () |
CRS of destination coordinate reference system. | |
void | devicePixelRatioChanged () |
Returns the ratio between physical pixels and device-independent pixels. | |
void | extentChanged () |
Geographical coordinates of the rectangle that should be rendered. | |
void | layersChanged () |
Set list of layers for map rendering. | |
void | mapUnitsPerPixelChanged () |
Returns the distance in geographical coordinates that equals to one pixel in the map. | |
void | mapUnitsPerPointChanged () |
Returns the distance in geographical coordinates that equals to one point unit in the map. | |
void | outputDpiChanged () |
Output DPI used for conversion between real world units (e.g. | |
void | outputSizeChanged () |
The size of the resulting map image. | |
void | projectChanged () |
A project property should be used as a primary source of project all other components in the application. | |
void | rotationChanged () |
The rotation of the resulting map image, in degrees clockwise. | |
void | temporalStateChanged () |
Emitted when the temporal state has changed. | |
void | visibleExtentChanged () |
Returns the actual extent derived from requested extent that takes output image size into account. | |
void | zRangeChanged () |
Emitted when the Z range has changed. | |
Public Member Functions | |
QgsQuickMapSettings (QObject *parent=nullptr) | |
Create new map settings. | |
~QgsQuickMapSettings ()=default | |
QColor | backgroundColor () const |
The background color used to render the map. | |
QgsPoint | center () const |
Returns the center point of the current map extent. | |
Q_INVOKABLE QPointF | coordinateToScreen (const QgsPoint &point) const |
Convert a map coordinate to screen pixel coordinates. | |
QgsCoordinateReferenceSystem | destinationCrs () const |
Returns the destination coordinate reference system for the map render. | |
qreal | devicePixelRatio () const |
Returns the ratio between physical pixels and device-independent pixels. | |
QgsRectangle | extent () const |
Returns geographical coordinates of the rectangle that should be rendered. | |
bool | isTemporal () const |
Returns true if a temporal filtering is enabled. | |
QList< QgsMapLayer * > | layers () const |
Returns the list of layers which will be rendered in the map. | |
QgsMapSettings | mapSettings () const |
Clone map settings. | |
double | mapUnitsPerPixel () const |
Returns the distance in geographical coordinates that equals to one pixel in the map. | |
double | mapUnitsPerPoint () const |
Returns the distance in geographical coordinates that equals to one point unit in the map. | |
double | outputDpi () const |
Returns the DPI (dots per inch) used for conversion between real world units (e.g. | |
QSize | outputSize () const |
Returns the size of the resulting map image, in pixels. | |
QgsProject * | project () const |
A project property should be used as a primary source of project all other components in the application. | |
double | rotation () const |
The rotation of the resulting map image, in degrees clockwise. | |
Q_INVOKABLE QgsPoint | screenToCoordinate (const QPointF &point) const |
Convert a screen coordinate to a map coordinate. | |
void | setBackgroundColor (const QColor &color) |
The background color used to render the map. | |
Q_INVOKABLE void | setCenter (const QgsPoint ¢er) |
Move current map extent to have center point defined by center. | |
Q_INVOKABLE void | setCenterToLayer (QgsMapLayer *layer, bool shouldZoom=true) |
Move current map extent to have center point defined by layer. Optionally only pan to the layer if shouldZoom is false. | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &destinationCrs) |
Sets the destination crs (coordinate reference system) for the map render. | |
void | setDevicePixelRatio (const qreal &devicePixelRatio) |
Sets the ratio between physical pixels and device-independent pixels. | |
void | setExtent (const QgsRectangle &extent) |
Sets the coordinates of the rectangle which should be rendered. | |
void | setIsTemporal (bool temporal) |
Returns true if a temporal filtering is enabled. | |
void | setLayers (const QList< QgsMapLayer * > &layers) |
Sets the list of layers to render in the map. | |
void | setOutputDpi (double outputDpi) |
Sets the dpi (dots per inch) used for conversion between real world units (e.g. | |
void | setOutputSize (QSize outputSize) |
Sets the size of the resulting map image, in pixels. | |
void | setProject (QgsProject *project) |
A project property should be used as a primary source of project all other components in the application. | |
void | setRotation (double rotation) |
The rotation of the resulting map image, in degrees clockwise. | |
void | setTemporalBegin (const QDateTime &begin) |
The temporal range's begin (i.e. | |
void | setTemporalEnd (const QDateTime &end) |
The temporal range's end (i.e. | |
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. | |
void | setZRangeLower (const double &lower) |
The Z range's lower value (since QGIS 3.38) | |
void | setZRangeUpper (const double &upper) |
The Z range's lower value (since QGIS 3.38) | |
QDateTime | temporalBegin () const |
The temporal range's begin (i.e. | |
QDateTime | temporalEnd () const |
The temporal range's end (i.e. | |
Q_INVOKABLE 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. | |
QgsRectangle | visibleExtent () const |
Returns the actual extent derived from requested extent that takes output image size into account. | |
double | zRangeLower () const |
The Z range's lower value (since QGIS 3.38) | |
double | zRangeUpper () const |
The Z range's lower value (since QGIS 3.38) | |
Properties | |
QColor | backgroundColor |
The background color used to render the map. | |
QgsPoint | center |
Geographical coordinate representing the center point of the current extent. | |
QgsCoordinateReferenceSystem | destinationCrs |
CRS of destination coordinate reference system. | |
QgsRectangle | extent |
Geographical coordinates of the rectangle that should be rendered. | |
bool | isTemporal |
Returns true if a temporal filtering is enabled. | |
QList< QgsMapLayer * > | layers |
Set list of layers for map rendering. | |
double | mapUnitsPerPixel |
Returns the distance in geographical coordinates that equals to one pixel in the map. | |
double | mapUnitsPerPoint |
Returns the distance in geographical coordinates that equals to one point unit in the map. | |
double | outputDpi |
Output DPI used for conversion between real world units (e.g. | |
QSize | outputSize |
The size of the resulting map image. | |
QgsProject * | project |
A project property should be used as a primary source of project all other components in the application. | |
double | rotation |
The rotation of the resulting map image, in degrees clockwise. | |
QDateTime | temporalBegin |
The temporal range's begin (i.e. | |
QDateTime | temporalEnd |
The temporal range's end (i.e. | |
QgsRectangle | visibleExtent |
Returns the actual extent derived from requested extent that takes output image size into account. | |
double | zRangeLower |
The Z range's lower value (since QGIS 3.38) | |
double | zRangeUpper |
The Z range's upper value (since QGIS 3.38) | |
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of map rendering via QML properties.
On top of QgsMapSettings functionality, when QgsProject is attached, it automatically loads its default settings from the project. QgsProject should be attached before it is read.
Definition at line 45 of file qgsquickmapsettings.h.
|
explicit |
Create new map settings.
Definition at line 25 of file qgsquickmapsettings.cpp.
|
default |
QColor QgsQuickMapSettings::backgroundColor | ( | ) | const |
The background color used to render the map.
The value is set to the project's background color setting on QgsProject::readProject
Definition at line 290 of file qgsquickmapsettings.cpp.
|
signal |
The background color used to render the map.
The value is set to the project's background color setting on QgsProject::readProject
QgsPoint QgsQuickMapSettings::center | ( | ) | const |
Returns the center point of the current map extent.
Definition at line 91 of file qgsquickmapsettings.cpp.
QPointF QgsQuickMapSettings::coordinateToScreen | ( | const QgsPoint & | point | ) | const |
Convert a map coordinate to screen pixel coordinates.
point | A coordinate in map coordinates |
Definition at line 139 of file qgsquickmapsettings.cpp.
QgsCoordinateReferenceSystem QgsQuickMapSettings::destinationCrs | ( | ) | const |
Returns the destination coordinate reference system for the map render.
Definition at line 195 of file qgsquickmapsettings.cpp.
|
signal |
CRS of destination coordinate reference system.
Automatically loaded from project on QgsProject::readProject
qreal QgsQuickMapSettings::devicePixelRatio | ( | ) | const |
Returns the ratio between physical pixels and device-independent pixels.
This value is dependent on the screen the window is on, and may change when the window is moved. Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
Definition at line 304 of file qgsquickmapsettings.cpp.
|
signal |
Returns the ratio between physical pixels and device-independent pixels.
This value is dependent on the screen the window is on, and may change when the window is moved. Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
QgsRectangle QgsQuickMapSettings::extent | ( | ) | const |
Returns geographical coordinates of the rectangle that should be rendered.
Definition at line 77 of file qgsquickmapsettings.cpp.
|
signal |
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 QgsQuickMapSettings::visibleExtent to get the resulting extent.
Automatically loaded from project on QgsProject::readProject
bool QgsQuickMapSettings::isTemporal | ( | ) | const |
Returns true
if a temporal filtering is enabled.
Definition at line 315 of file qgsquickmapsettings.cpp.
QList< QgsMapLayer * > QgsQuickMapSettings::layers | ( | ) | const |
Returns the list of layers which will be rendered in the map.
The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)
Definition at line 209 of file qgsquickmapsettings.cpp.
|
signal |
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)
Not loaded automatically from the associated project
QgsMapSettings QgsQuickMapSettings::mapSettings | ( | ) | const |
Clone map settings.
Definition at line 159 of file qgsquickmapsettings.cpp.
double QgsQuickMapSettings::mapUnitsPerPixel | ( | ) | const |
Returns the distance in geographical coordinates that equals to one pixel in the map.
Definition at line 109 of file qgsquickmapsettings.cpp.
|
signal |
Returns the distance in geographical coordinates that equals to one pixel in the map.
double QgsQuickMapSettings::mapUnitsPerPoint | ( | ) | const |
Returns the distance in geographical coordinates that equals to one point unit in the map.
Definition at line 129 of file qgsquickmapsettings.cpp.
|
signal |
Returns the distance in geographical coordinates that equals to one point unit in the map.
double QgsQuickMapSettings::outputDpi | ( | ) | const |
Returns the DPI (dots per inch) used for conversion between real world units (e.g.
mm) and pixels.
The default value is 96 dpi.
Definition at line 180 of file qgsquickmapsettings.cpp.
|
signal |
Output DPI used for conversion between real world units (e.g.
mm) and pixels
Automatically loaded from project on QgsProject::readProject
QSize QgsQuickMapSettings::outputSize | ( | ) | const |
Returns the size of the resulting map image, in pixels.
Definition at line 164 of file qgsquickmapsettings.cpp.
|
signal |
The size of the resulting map image.
Automatically loaded from project on QgsProject::readProject
QgsProject * QgsQuickMapSettings::project | ( | ) | const |
A project property should be used as a primary source of project all other components in the application.
QgsProject should be attached to QgsQuickMapSettings before it is read (QgsProject::read)
When project is read, map settings (CRS, extent, ...) are automatically set from its DOM.
Definition at line 67 of file qgsquickmapsettings.cpp.
|
signal |
A project property should be used as a primary source of project all other components in the application.
QgsProject should be attached to QgsQuickMapSettings before it is read (QgsProject::read)
When project is read, map settings (CRS, extent, ...) are automatically set from its DOM.
double QgsQuickMapSettings::rotation | ( | ) | const |
The rotation of the resulting map image, in degrees clockwise.
Map canvas rotation support is not implemented, 0 is used
Definition at line 279 of file qgsquickmapsettings.cpp.
|
signal |
The rotation of the resulting map image, in degrees clockwise.
Map canvas rotation support is not implemented, 0 is used
QgsPoint QgsQuickMapSettings::screenToCoordinate | ( | const QPointF & | point | ) | const |
Convert a screen coordinate to a map coordinate.
point | A coordinate in pixel / screen coordinates |
Definition at line 148 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setBackgroundColor | ( | const QColor & | color | ) |
The background color used to render the map.
The value is set to the project's background color setting on QgsProject::readProject
Definition at line 295 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setCenter | ( | const QgsPoint & | center | ) |
Move current map extent to have center point defined by center.
Definition at line 96 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setCenterToLayer | ( | QgsMapLayer * | layer, |
bool | shouldZoom = true |
||
) |
Move current map extent to have center point defined by layer. Optionally only pan to the layer if shouldZoom is false.
Definition at line 114 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | destinationCrs | ) |
Sets the destination crs (coordinate reference system) for the map render.
Definition at line 200 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setDevicePixelRatio | ( | const qreal & | devicePixelRatio | ) |
Sets the ratio between physical pixels and device-independent pixels.
This value is dependent on the screen the window is on, and may change when the window is moved. Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
Definition at line 309 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setExtent | ( | const QgsRectangle & | extent | ) |
Sets the coordinates of the rectangle which should be rendered.
Definition at line 82 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setIsTemporal | ( | bool | temporal | ) |
Returns true
if a temporal filtering is enabled.
Definition at line 320 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setLayers | ( | const QList< QgsMapLayer * > & | layers | ) |
Sets the list of layers to render in the map.
The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)
Definition at line 214 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setOutputDpi | ( | double | outputDpi | ) |
Sets the dpi (dots per inch) used for conversion between real world units (e.g.
mm) and pixels.
Definition at line 185 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setOutputSize | ( | QSize | outputSize | ) |
Sets the size of the resulting map image, in pixels.
Definition at line 169 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setProject | ( | QgsProject * | project | ) |
A project property should be used as a primary source of project all other components in the application.
QgsProject should be attached to QgsQuickMapSettings before it is read (QgsProject::read)
When project is read, map settings (CRS, extent, ...) are automatically set from its DOM.
Definition at line 37 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setRotation | ( | double | rotation | ) |
The rotation of the resulting map image, in degrees clockwise.
Map canvas rotation support is not implemented, 0 is used
Definition at line 284 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setTemporalBegin | ( | const QDateTime & | begin | ) |
The temporal range's begin (i.e.
lower) value
Definition at line 331 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setTemporalEnd | ( | const QDateTime & | end | ) |
The temporal range's end (i.e.
higher) value
Definition at line 343 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::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.
Definition at line 154 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setZRangeLower | ( | const double & | lower | ) |
The Z range's lower value (since QGIS 3.38)
Definition at line 356 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setZRangeUpper | ( | const double & | upper | ) |
The Z range's lower value (since QGIS 3.38)
Definition at line 374 of file qgsquickmapsettings.cpp.
QDateTime QgsQuickMapSettings::temporalBegin | ( | ) | const |
The temporal range's begin (i.e.
lower) value
Definition at line 326 of file qgsquickmapsettings.cpp.
QDateTime QgsQuickMapSettings::temporalEnd | ( | ) | const |
The temporal range's end (i.e.
higher) value
Definition at line 338 of file qgsquickmapsettings.cpp.
|
signal |
Emitted when the temporal state has changed.
QgsCoordinateTransformContext QgsQuickMapSettings::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.
Definition at line 72 of file qgsquickmapsettings.cpp.
QgsRectangle QgsQuickMapSettings::visibleExtent | ( | ) | const |
Returns the actual extent derived from requested extent that takes output image size into account.
Definition at line 134 of file qgsquickmapsettings.cpp.
|
signal |
Returns the actual extent derived from requested extent that takes output image size into account.
|
signal |
double QgsQuickMapSettings::zRangeLower | ( | ) | const |
The Z range's lower value (since QGIS 3.38)
Definition at line 350 of file qgsquickmapsettings.cpp.
double QgsQuickMapSettings::zRangeUpper | ( | ) | const |
The Z range's lower value (since QGIS 3.38)
Definition at line 368 of file qgsquickmapsettings.cpp.
|
readwrite |
The background color used to render the map.
The value is set to the project's background color setting on QgsProject::readProject
Definition at line 90 of file qgsquickmapsettings.h.
|
readwrite |
Geographical coordinate representing the center point of the current extent.
Definition at line 61 of file qgsquickmapsettings.h.
|
readwrite |
CRS of destination coordinate reference system.
Automatically loaded from project on QgsProject::readProject
Definition at line 111 of file qgsquickmapsettings.h.
|
readwrite |
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 QgsQuickMapSettings::visibleExtent to get the resulting extent.
Automatically loaded from project on QgsProject::readProject
Definition at line 71 of file qgsquickmapsettings.h.
|
readwrite |
Returns true
if a temporal filtering is enabled.
Definition at line 126 of file qgsquickmapsettings.h.
|
readwrite |
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)
Not loaded automatically from the associated project
Definition at line 121 of file qgsquickmapsettings.h.
|
read |
Returns the distance in geographical coordinates that equals to one pixel in the map.
Definition at line 75 of file qgsquickmapsettings.h.
|
read |
Returns the distance in geographical coordinates that equals to one point unit in the map.
Definition at line 77 of file qgsquickmapsettings.h.
|
readwrite |
Output DPI used for conversion between real world units (e.g.
mm) and pixels
Automatically loaded from project on QgsProject::readProject
Definition at line 104 of file qgsquickmapsettings.h.
|
readwrite |
The size of the resulting map image.
Automatically loaded from project on QgsProject::readProject
Definition at line 97 of file qgsquickmapsettings.h.
|
readwrite |
A project property should be used as a primary source of project all other components in the application.
QgsProject should be attached to QgsQuickMapSettings before it is read (QgsProject::read)
When project is read, map settings (CRS, extent, ...) are automatically set from its DOM.
Definition at line 56 of file qgsquickmapsettings.h.
|
readwrite |
The rotation of the resulting map image, in degrees clockwise.
Map canvas rotation support is not implemented, 0 is used
Definition at line 83 of file qgsquickmapsettings.h.
|
readwrite |
|
readwrite |
|
read |
Returns the actual extent derived from requested extent that takes output image size into account.
Definition at line 73 of file qgsquickmapsettings.h.
|
readwrite |
The Z range's lower value (since QGIS 3.38)
Definition at line 141 of file qgsquickmapsettings.h.
|
readwrite |
The Z range's upper value (since QGIS 3.38)
Definition at line 146 of file qgsquickmapsettings.h.