Class QgsQuickMapSettings
ClassList > QgsQuickMapSettings
#include <qgsquickmapsettings.h>
Inherits the following classes: QObject
Public Properties
| Type | Name |
|---|---|
| property QColor | backgroundColor |
| property double | bottomMargin |
| property QgsPoint | center |
| property QgsCoordinateReferenceSystem | destinationCrs |
| property QgsRectangle | extent |
| property bool | isTemporal |
| property QList< QgsMapLayer * > | layers |
| property double | mapUnitsPerPoint Returns the distance in geographical coordinates that equals to one point unit in the map. |
| property double | outputDpi |
| property QSize | outputSize |
| property QgsProject * | project |
| property double | rightMargin |
| property double | rotation |
| property double | scale |
| property QDateTime | temporalBegin |
| property QDateTime | temporalEnd |
| property QgsRectangle | visibleExtent |
| property double | zRangeLower |
| property double | zRangeUpper |
Public Signals
| Type | Name |
|---|---|
| signal void | backgroundColorChanged |
| signal void | bottomMarginChanged |
| signal void | destinationCrsChanged |
| signal void | extentChanged |
| signal void | layersChanged |
| signal void | mapUnitsPerPointChanged Returns the distance in geographical coordinates that equals to one point unit in the map. |
| signal void | outputDpiChanged |
| signal void | outputSizeChanged |
| signal void | projectChanged |
| signal void | rightMarginChanged |
| signal void | rotationChanged |
| signal void | temporalStateChanged Emitted when temporal properties are modified. |
| signal void | visibleExtentChanged |
| signal void | zRangeChanged Emitted when the Z range's lower and upper values are modified. |
Public Functions
| Type | Name |
|---|---|
| QgsQuickMapSettings (QObject * parent=nullptr) Create new map settings. |
|
| QColor | backgroundColor () const |
| double | bottomMargin () const |
| Q_INVOKABLE double | computeScaleForExtent (const QgsRectangle & extent, bool handleMargins=false) |
| Q_INVOKABLE QPointF | coordinateToScreen (const QgsPoint & point) const |
| QgsCoordinateReferenceSystem | destinationCrs () const |
| qreal | devicePixelRatio () const |
| QgsRectangle | extent () const |
| Q_INVOKABLE QgsPoint | getCenter (bool handleMargins=false) const Returns the center point of the current map extent. |
| bool | isTemporal () const |
| QList< QgsMapLayer * > | layers () const |
| QgsMapSettings | mapSettings () const Clone map settings. |
| double | mapUnitsPerPoint () const Returns the distance in geographical coordinates that equals to one point unit in the map. |
| double | outputDpi () const |
| QSize | outputSize () const |
| QgsProject * | project () const |
| double | rightMargin () const |
| double | rotation () const |
| double | scale () const |
| Q_INVOKABLE QgsPoint | screenToCoordinate (const QPointF & point) const |
| void | setBackgroundColor (const QColor & color) |
| void | setBottomMargin (double bottomMargin) |
| Q_INVOKABLE void | setCenter (const QgsPoint & center, bool handleMargins=false) |
| Q_INVOKABLE void | setCenter (const QPointF & center, bool handleMargins=false) |
| 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) |
| void | setDevicePixelRatio (const qreal & devicePixelRatio) |
| Q_INVOKABLE void | setExtent (const QgsRectangle & extent, bool handleMargins=false) |
| Q_INVOKABLE void | setExtentFromPoints (const QVariantList & points, const double & minimumScale=0, bool handleMargins=false) Move current map extent to center around the list of points provided. |
| void | setIsTemporal (bool temporal) |
| void | setLayers (const QList< QgsMapLayer * > & layers) |
| void | setOutputDpi (double outputDpi) |
| void | setOutputSize (QSize outputSize) |
| void | setProject (QgsProject * project) |
| void | setRightMargin (double rightMargin) |
| void | setRotation (double rotation) |
| void | setTemporalBegin (const QDateTime & begin) |
| void | setTemporalEnd (const QDateTime & end) |
| void | setTransformContext (const QgsCoordinateTransformContext & context) |
| void | setZRangeLower (double lower) |
| void | setZRangeUpper (double upper) |
| QDateTime | temporalBegin () const |
| QDateTime | temporalEnd () const |
| Q_INVOKABLE QgsCoordinateTransformContext | transformContext () const |
| QgsRectangle | visibleExtent () const |
| double | zRangeLower () const |
| double | zRangeUpper () const |
| ~QgsQuickMapSettings () = default |
Detailed Description
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.
Note:
QML Type: MapSettings
See also: QgsQuickMapCanvas
Public Properties Documentation
property backgroundColor [1/2]
QColor QgsQuickMapSettings::backgroundColor;
The background color used to render the map
The value is set to the project's bacckground color setting on QgsProject::readProject
property bottomMargin [1/2]
double QgsQuickMapSettings::bottomMargin;
The bottom margin used by the map settings when calculating map extent or center.
property center
QgsPoint QgsQuickMapSettings::center;
Geographical coordinate representing the center point of the current extent
property destinationCrs [1/2]
QgsCoordinateReferenceSystem QgsQuickMapSettings::destinationCrs;
CRS of destination coordinate reference system.
Automatically loaded from project on QgsProject::readProject
property extent [1/2]
QgsRectangle QgsQuickMapSettings::extent;
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
property isTemporal [1/2]
bool QgsQuickMapSettings::isTemporal;
Returns TRUE if a temporal filtering is enabled
property layers [1/2]
QList<QgsMapLayer *> QgsQuickMapSettings::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!).
Not loaded automatically from the associated project
property mapUnitsPerPoint [1/2]
Returns the distance in geographical coordinates that equals to one point unit in the map.
double QgsQuickMapSettings::mapUnitsPerPoint;
property outputDpi [1/2]
double QgsQuickMapSettings::outputDpi;
Output DPI used for conversion between real world units (e.g. mm) and pixels
Automatically loaded from project on QgsProject::readProject
property outputSize [1/2]
QSize QgsQuickMapSettings::outputSize;
The size of the resulting map image
Automatically loaded from project on QgsProject::readProject
property project [1/2]
QgsProject * QgsQuickMapSettings::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.
property rightMargin [1/2]
double QgsQuickMapSettings::rightMargin;
The right margin used by the map settings when calculating map extent or center.
property rotation [1/2]
double QgsQuickMapSettings::rotation;
The rotation of the resulting map image, in degrees clockwise.
property scale [1/2]
double QgsQuickMapSettings::scale;
property temporalBegin [1/2]
QDateTime QgsQuickMapSettings::temporalBegin;
The temporal range's begin (i.e. lower) value
property temporalEnd [1/2]
QDateTime QgsQuickMapSettings::temporalEnd;
The temporal range's end (i.e. higher) value
property visibleExtent [1/2]
QgsRectangle QgsQuickMapSettings::visibleExtent;
property zRangeLower [1/2]
double QgsQuickMapSettings::zRangeLower;
The Z range's lower value; if both the lower and upper value are finite, Z range filtering will occur.
property zRangeUpper [1/2]
double QgsQuickMapSettings::zRangeUpper;
The Z range's upper value; if both the lower and upper value are finite, Z range filtering will occur.
Public Signals Documentation
signal backgroundColorChanged
void QgsQuickMapSettings::backgroundColorChanged;
The background color used to render the map
The value is set to the project's bacckground color setting on QgsProject::readProject
signal bottomMarginChanged
void QgsQuickMapSettings::bottomMarginChanged;
The bottom margin used by the map settings when calculating map extent or center.
signal destinationCrsChanged
void QgsQuickMapSettings::destinationCrsChanged;
CRS of destination coordinate reference system.
Automatically loaded from project on QgsProject::readProject
signal extentChanged
void QgsQuickMapSettings::extentChanged;
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
signal layersChanged
void QgsQuickMapSettings::layersChanged;
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!).
Not loaded automatically from the associated project
signal mapUnitsPerPointChanged
Returns the distance in geographical coordinates that equals to one point unit in the map.
void QgsQuickMapSettings::mapUnitsPerPointChanged;
signal outputDpiChanged
void QgsQuickMapSettings::outputDpiChanged;
Output DPI used for conversion between real world units (e.g. mm) and pixels
Automatically loaded from project on QgsProject::readProject
signal outputSizeChanged
void QgsQuickMapSettings::outputSizeChanged;
The size of the resulting map image
Automatically loaded from project on QgsProject::readProject
signal projectChanged
void QgsQuickMapSettings::projectChanged;
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.
signal rightMarginChanged
void QgsQuickMapSettings::rightMarginChanged;
The right margin used by the map settings when calculating map extent or center.
signal rotationChanged
void QgsQuickMapSettings::rotationChanged;
The rotation of the resulting map image, in degrees clockwise.
signal temporalStateChanged
Emitted when temporal properties are modified.
void QgsQuickMapSettings::temporalStateChanged;
signal visibleExtentChanged
void QgsQuickMapSettings::visibleExtentChanged;
signal zRangeChanged
Emitted when the Z range's lower and upper values are modified.
void QgsQuickMapSettings::zRangeChanged;
Public Functions Documentation
function QgsQuickMapSettings
Create new map settings.
explicit QgsQuickMapSettings::QgsQuickMapSettings (
QObject * parent=nullptr
)
function backgroundColor [2/2]
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
function bottomMargin [2/2]
double QgsQuickMapSettings::bottomMargin () const
The bottom margin used by the map settings when calculating map extent or center.
function computeScaleForExtent
Q_INVOKABLE double QgsQuickMapSettings::computeScaleForExtent (
const QgsRectangle & extent,
bool handleMargins=false
)
Compute the scale that corresponds to the specified extent.
Parameters:
pointA coordinate in pixel / screen coordinates
Returns:
A scale value
function coordinateToScreen
Q_INVOKABLE QPointF QgsQuickMapSettings::coordinateToScreen (
const QgsPoint & point
) const
Convert a map coordinate to screen pixel coordinates
Parameters:
pointA coordinate in map coordinates
Returns:
A coordinate in pixel / screen space
function destinationCrs [2/2]
QgsCoordinateReferenceSystem QgsQuickMapSettings::destinationCrs () const
function devicePixelRatio
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.
function extent [2/2]
QgsRectangle QgsQuickMapSettings::extent () const
function getCenter
Returns the center point of the current map extent.
Q_INVOKABLE QgsPoint QgsQuickMapSettings::getCenter (
bool handleMargins=false
) const
function isTemporal [2/2]
bool QgsQuickMapSettings::isTemporal () const
Returns TRUE if a temporal filtering is enabled
function layers [2/2]
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)
See also: setLayers()
function mapSettings
Clone map settings.
QgsMapSettings QgsQuickMapSettings::mapSettings () const
function mapUnitsPerPoint [2/2]
Returns the distance in geographical coordinates that equals to one point unit in the map.
double QgsQuickMapSettings::mapUnitsPerPoint () const
function outputDpi [2/2]
double QgsQuickMapSettings::outputDpi () const
function outputSize [2/2]
QSize QgsQuickMapSettings::outputSize () const
function project [2/2]
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.
function rightMargin [2/2]
double QgsQuickMapSettings::rightMargin () const
The right margin used by the map settings when calculating map extent or center.
function rotation [2/2]
double QgsQuickMapSettings::rotation () const
The rotation of the resulting map image, in degrees clockwise.
function scale [2/2]
double QgsQuickMapSettings::scale () const
function screenToCoordinate
Q_INVOKABLE QgsPoint QgsQuickMapSettings::screenToCoordinate (
const QPointF & point
) const
Convert a screen coordinate to a map coordinate
Parameters:
pointA coordinate in pixel / screen coordinates
Returns:
A coordinate in map coordinates
function setBackgroundColor
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
function setBottomMargin
void QgsQuickMapSettings::setBottomMargin (
double bottomMargin
)
The bottom margin used by the map settings when calculating map extent or center.
function setCenter [1/2]
Q_INVOKABLE void QgsQuickMapSettings::setCenter (
const QgsPoint & center,
bool handleMargins=false
)
Move current map extent to have center point defined by center
Parameters:
centera QgsPoint center pointhandleMarginsset to TRUE for margins to be considered when recentering
function setCenter [2/2]
Q_INVOKABLE void QgsQuickMapSettings::setCenter (
const QPointF & center,
bool handleMargins=false
)
Move current map extent to have center point defined by center
Parameters:
centera QPointF center pointhandleMarginsset to TRUE for margins to be considered when recentering
function setCenterToLayer
Move current map extent to have center point defined by layer . Optionally only pan to the layer if__shouldZoom is false.
Q_INVOKABLE void QgsQuickMapSettings::setCenterToLayer (
QgsMapLayer * layer,
bool shouldZoom=true
)
function setDestinationCrs
void QgsQuickMapSettings::setDestinationCrs (
const QgsCoordinateReferenceSystem & destinationCrs
)
function setDevicePixelRatio
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.
function setExtent
Q_INVOKABLE void QgsQuickMapSettings::setExtent (
const QgsRectangle & extent,
bool handleMargins=false
)
function setExtentFromPoints
Move current map extent to center around the list of points provided.
Q_INVOKABLE void QgsQuickMapSettings::setExtentFromPoints (
const QVariantList & points,
const double & minimumScale=0,
bool handleMargins=false
)
function setIsTemporal
void QgsQuickMapSettings::setIsTemporal (
bool temporal
)
Returns TRUE if a temporal filtering is enabled
function setLayers
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)
Note:
Any non-spatial layers will be automatically stripped from the list (since they cannot be rendered!).
See also: layers()
function setOutputDpi
void QgsQuickMapSettings::setOutputDpi (
double outputDpi
)
function setOutputSize
void QgsQuickMapSettings::setOutputSize (
QSize outputSize
)
function setProject
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.
function setRightMargin
void QgsQuickMapSettings::setRightMargin (
double rightMargin
)
The right margin used by the map settings when calculating map extent or center.
function setRotation
void QgsQuickMapSettings::setRotation (
double rotation
)
The rotation of the resulting map image, in degrees clockwise.
function setTemporalBegin
void QgsQuickMapSettings::setTemporalBegin (
const QDateTime & begin
)
The temporal range's begin (i.e. lower) value
function setTemporalEnd
void QgsQuickMapSettings::setTemporalEnd (
const QDateTime & end
)
The temporal range's end (i.e. higher) value
function setTransformContext
void QgsQuickMapSettings::setTransformContext (
const QgsCoordinateTransformContext & context
)
function setZRangeLower
void QgsQuickMapSettings::setZRangeLower (
double lower
)
The Z range's lower value; if both the lower and upper value are finite, Z range filtering will occur.
function setZRangeUpper
void QgsQuickMapSettings::setZRangeUpper (
double upper
)
The Z range's upper value; if both the lower and upper value are finite, Z range filtering will occur.
function temporalBegin [2/2]
QDateTime QgsQuickMapSettings::temporalBegin () const
The temporal range's begin (i.e. lower) value
function temporalEnd [2/2]
QDateTime QgsQuickMapSettings::temporalEnd () const
The temporal range's end (i.e. higher) value
function transformContext
Q_INVOKABLE QgsCoordinateTransformContext QgsQuickMapSettings::transformContext () const
function visibleExtent [2/2]
QgsRectangle QgsQuickMapSettings::visibleExtent () const
function zRangeLower [2/2]
double QgsQuickMapSettings::zRangeLower () const
The Z range's lower value; if both the lower and upper value are finite, Z range filtering will occur.
function zRangeUpper [2/2]
double QgsQuickMapSettings::zRangeUpper () const
The Z range's upper value; if both the lower and upper value are finite, Z range filtering will occur.
function ~QgsQuickMapSettings
QgsQuickMapSettings::~QgsQuickMapSettings () = default
The documentation for this class was generated from the following file src/core/qgsquick/qgsquickmapsettings.h