QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
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. More... | |
void | destinationCrsChanged () |
CRS of destination coordinate reference system. More... | |
void | extentChanged () |
Geographical coordinates of the rectangle that should be rendered. More... | |
void | layersChanged () |
Set list of layers for map rendering. More... | |
void | mapUnitsPerPixelChanged () |
Returns the distance in geographical coordinates that equals to one pixel in the map. More... | |
void | outputDpiChanged () |
Output DPI used for conversion between real world units (e.g. More... | |
void | outputSizeChanged () |
The size of the resulting map image. More... | |
void | projectChanged () |
A project property should be used as a primary source of project all other components in the application. More... | |
void | rotationChanged () |
The rotation of the resulting map image, in degrees clockwise. More... | |
void | visibleExtentChanged () |
Returns the actual extent derived from requested extent that takes takes output image size into account. More... | |
Public Member Functions | |
QgsQuickMapSettings (QObject *parent=nullptr) | |
Create new map settings. More... | |
~QgsQuickMapSettings ()=default | |
QColor | backgroundColor () const |
The background color used to render the map. More... | |
Q_INVOKABLE QPointF | coordinateToScreen (const QgsPoint &point) const |
Convert a map coordinate to screen pixel coordinates. More... | |
QgsCoordinateReferenceSystem | destinationCrs () const |
returns CRS of destination coordinate reference system More... | |
QgsRectangle | extent () const |
Returns geographical coordinates of the rectangle that should be rendered. 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... | |
QgsMapSettings | mapSettings () const |
Clone map settings. 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... | |
QSize | outputSize () const |
Returns the size of the resulting map image. More... | |
QgsProject * | project () const |
A project property should be used as a primary source of project all other components in the application. More... | |
double | rotation () const |
The rotation of the resulting map image, in degrees clockwise. More... | |
Q_INVOKABLE QgsPoint | screenToCoordinate (const QPointF &point) const |
Convert a screen coordinate to a map coordinate. More... | |
void | setBackgroundColor (const QColor &color) |
The background color used to render the map. More... | |
Q_INVOKABLE void | setCenter (const QgsPoint ¢er) |
Move current map extent to have center point defined by center. More... | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &destinationCrs) |
sets destination coordinate reference system More... | |
void | setExtent (const QgsRectangle &extent) |
Set coordinates of the rectangle which should be rendered. More... | |
void | setLayers (const QList< QgsMapLayer * > &layers) |
Set list of layers for map rendering. More... | |
void | setOutputDpi (double outputDpi) |
Sets DPI used for conversion between real world units (e.g. mm) and pixels. More... | |
void | setOutputSize (const QSize &outputSize) |
Sets the size of the resulting map image. More... | |
void | setProject (QgsProject *project) |
A project property should be used as a primary source of project all other components in the application. More... | |
void | setRotation (double rotation) |
The rotation of the resulting map image, in degrees clockwise. 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... | |
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. More... | |
QgsRectangle | visibleExtent () const |
Returns the actual extent derived from requested extent that takes takes output image size into account. More... | |
Properties | |
QColor | backgroundColor |
The background color used to render the map. More... | |
QgsCoordinateReferenceSystem | destinationCrs |
CRS of destination coordinate reference system. More... | |
QgsRectangle | extent |
Geographical coordinates of the rectangle that should be rendered. More... | |
QList< QgsMapLayer * > | layers |
Set list of layers for map rendering. More... | |
double | mapUnitsPerPixel |
Returns the distance in geographical coordinates that equals to one pixel in the map. More... | |
double | outputDpi |
Output DPI used for conversion between real world units (e.g. More... | |
QSize | outputSize |
The size of the resulting map image. More... | |
QgsProject * | project |
A project property should be used as a primary source of project all other components in the application. More... | |
double | rotation |
The rotation of the resulting map image, in degrees clockwise. More... | |
QgsRectangle | visibleExtent |
Returns the actual extent derived from requested extent that takes takes output image size into account. More... | |
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 46 of file qgsquickmapsettings.h.
QgsQuickMapSettings::QgsQuickMapSettings | ( | QObject * | parent = nullptr | ) |
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 bacckground color setting on QgsProject::readProject
Definition at line 229 of file qgsquickmapsettings.cpp.
|
signal |
The background color used to render the map.
The value is set to the project's bacckground color setting on QgsProject::readProject
QPointF QgsQuickMapSettings::coordinateToScreen | ( | const QgsPoint & | point | ) | const |
Convert a map coordinate to screen pixel coordinates.
point | A coordinate in map coordinates |
Definition at line 112 of file qgsquickmapsettings.cpp.
QgsCoordinateReferenceSystem QgsQuickMapSettings::destinationCrs | ( | ) | const |
returns CRS of destination coordinate reference system
Definition at line 166 of file qgsquickmapsettings.cpp.
|
signal |
CRS of destination coordinate reference system.
Automatically loaded from project on QgsProject::readProject
QgsRectangle QgsQuickMapSettings::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 75 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
QList< QgsMapLayer * > QgsQuickMapSettings::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 180 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 128 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 102 of file qgsquickmapsettings.cpp.
|
signal |
Returns the distance in geographical coordinates that equals to one pixel in the map.
double QgsQuickMapSettings::outputDpi | ( | ) | const |
Returns DPI used for conversion between real world units (e.g.
mm) and pixels Default value is 96
Definition at line 152 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.
Definition at line 138 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 65 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 218 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 119 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 bacckground color setting on QgsProject::readProject
Definition at line 234 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setCenter | ( | const QgsPoint & | center | ) |
Move current map extent to have center point defined by center.
Definition at line 89 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | destinationCrs | ) |
sets destination coordinate reference system
Definition at line 171 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setExtent | ( | const QgsRectangle & | extent | ) |
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 80 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::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)
Definition at line 185 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setOutputDpi | ( | double | outputDpi | ) |
Sets DPI used for conversion between real world units (e.g. mm) and pixels.
Definition at line 157 of file qgsquickmapsettings.cpp.
void QgsQuickMapSettings::setOutputSize | ( | const QSize & | outputSize | ) |
Sets the size of the resulting map image.
Definition at line 143 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 223 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.
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 70 of file qgsquickmapsettings.cpp.
QgsRectangle QgsQuickMapSettings::visibleExtent | ( | ) | const |
Returns the actual extent derived from requested extent that takes takes output image size into account.
Definition at line 107 of file qgsquickmapsettings.cpp.
|
signal |
Returns the actual extent derived from requested extent that takes takes output image size into account.
|
readwrite |
The background color used to render the map.
The value is set to the project's bacckground color setting on QgsProject::readProject
Definition at line 1 of file qgsquickmapsettings.h.
|
readwrite |
CRS of destination coordinate reference system.
Automatically loaded from project on QgsProject::readProject
Definition at line 1 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 1 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 1 of file qgsquickmapsettings.h.
|
read |
Returns the distance in geographical coordinates that equals to one pixel in the map.
Definition at line 1 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 1 of file qgsquickmapsettings.h.
|
readwrite |
The size of the resulting map image.
Automatically loaded from project on QgsProject::readProject
Definition at line 1 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 1 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 1 of file qgsquickmapsettings.h.
|
read |
Returns the actual extent derived from requested extent that takes takes output image size into account.
Definition at line 1 of file qgsquickmapsettings.h.