QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
QgsProjectViewSettings Class Reference

Contains settings and properties relating to how a QgsProject should be displayed inside map canvas, e.g. More...

#include <qgsprojectviewsettings.h>

Inheritance diagram for QgsProjectViewSettings:
Inheritance graph
[legend]

Signals

void mapScalesChanged ()
 Emitted when the list of custom project map scales changes.
 
void presetFullExtentChanged ()
 Emitted whenever the presetFullExtent() is changed.
 

Public Member Functions

 QgsProjectViewSettings (QgsProject *project=nullptr)
 Constructor for QgsProjectViewSettings for the specified project.
 
double defaultRotation () const
 Returns the default map rotation (in clockwise degrees) for maps in the project.
 
QgsReferencedRectangle defaultViewExtent () const
 Returns the default view extent, which should be used as the initial map extent when this project is opened.
 
QgsReferencedRectangle fullExtent () const
 Returns the full extent of the project, which represents the maximal limits of the project.
 
QVector< double > mapScales () const
 Returns the list of custom project map scales.
 
QgsReferencedRectangle presetFullExtent () const
 Returns the project's preset full extent.
 
bool readXml (const QDomElement &element, const QgsReadWriteContext &context)
 Reads the settings's state from a DOM element.
 
void reset ()
 Resets the settings to a default state.
 
void setDefaultRotation (double rotation)
 Set the default rotation of maps in the project, in clockwise degrees.
 
void setDefaultViewExtent (const QgsReferencedRectangle &extent)
 Sets the default view extent, which should be used as the initial map extent when this project is opened.
 
void setMapScales (const QVector< double > &scales)
 Sets the list of custom project map scales.
 
void setPresetFullExtent (const QgsReferencedRectangle &extent)
 Sets the project's preset full extent.
 
void setUseProjectScales (bool enabled)
 Sets whether project mapScales() are enabled.
 
bool useProjectScales () const
 Returns true if project mapScales() are enabled.
 
QDomElement writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const
 Returns a DOM element representing the settings.
 

Detailed Description

Contains settings and properties relating to how a QgsProject should be displayed inside map canvas, e.g.

map scales and default view extent for the project.

Since
QGIS 3.10.1

Definition at line 35 of file qgsprojectviewsettings.h.

Constructor & Destructor Documentation

◆ QgsProjectViewSettings()

QgsProjectViewSettings::QgsProjectViewSettings ( QgsProject project = nullptr)

Constructor for QgsProjectViewSettings for the specified project.

Ownership is transferred to the project.

Definition at line 24 of file qgsprojectviewsettings.cpp.

Member Function Documentation

◆ defaultRotation()

double QgsProjectViewSettings::defaultRotation ( ) const

Returns the default map rotation (in clockwise degrees) for maps in the project.

Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous map rotations as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual rotations. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time (or when new map canvases are opened in that project.)
See also
setDefaultRotation()
Since
QGIS 3.28

Definition at line 135 of file qgsprojectviewsettings.cpp.

◆ defaultViewExtent()

QgsReferencedRectangle QgsProjectViewSettings::defaultViewExtent ( ) const

Returns the default view extent, which should be used as the initial map extent when this project is opened.

Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous view extent as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual last view extents. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time.
See also
setDefaultViewExtent()

Definition at line 50 of file qgsprojectviewsettings.cpp.

◆ fullExtent()

QgsReferencedRectangle QgsProjectViewSettings::fullExtent ( ) const

Returns the full extent of the project, which represents the maximal limits of the project.

The returned extent will be in the project's CRS.

If the presetFullExtent() is non null, this will be returned as the full extent. Otherwise the full extent will be calculated based on the extent of all layers in the project.

See also
presetFullExtent()
setPresetFullExtent()

Definition at line 74 of file qgsprojectviewsettings.cpp.

◆ mapScales()

QVector< double > QgsProjectViewSettings::mapScales ( ) const

Returns the list of custom project map scales.

The scales list consists of a list of scale denominator values, e.g. 1000 for a 1:1000 scale.

See also
setMapScales()
mapScalesChanged()

Definition at line 116 of file qgsprojectviewsettings.cpp.

◆ mapScalesChanged

void QgsProjectViewSettings::mapScalesChanged ( )
signal

Emitted when the list of custom project map scales changes.

See also
mapScales()
setMapScales()

◆ presetFullExtent()

QgsReferencedRectangle QgsProjectViewSettings::presetFullExtent ( ) const

Returns the project's preset full extent.

This extent represents the maximal limits of the project. The full extent defaults to a null rectangle, which indicates that the maximal extent should be calculated based on the layers in the project.

See also
setPresetFullExtent()
fullExtent()
Since
QGIS 3.18

Definition at line 60 of file qgsprojectviewsettings.cpp.

◆ presetFullExtentChanged

void QgsProjectViewSettings::presetFullExtentChanged ( )
signal

Emitted whenever the presetFullExtent() is changed.

Since
QGIS 3.18

◆ readXml()

bool QgsProjectViewSettings::readXml ( const QDomElement &  element,
const QgsReadWriteContext context 
)

Reads the settings's state from a DOM element.

See also
writeXml()

Definition at line 145 of file qgsprojectviewsettings.cpp.

◆ reset()

void QgsProjectViewSettings::reset ( )

Resets the settings to a default state.

Definition at line 31 of file qgsprojectviewsettings.cpp.

◆ setDefaultRotation()

void QgsProjectViewSettings::setDefaultRotation ( double  rotation)

Set the default rotation of maps in the project, in clockwise degrees.

Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous map rotations as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual rotations. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time (or when new map canvases are opened in that project.)
See also
defaultRotation()
Since
QGIS 3.28

Definition at line 140 of file qgsprojectviewsettings.cpp.

◆ setDefaultViewExtent()

void QgsProjectViewSettings::setDefaultViewExtent ( const QgsReferencedRectangle extent)

Sets the default view extent, which should be used as the initial map extent when this project is opened.

Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous view extent as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual last view extents. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time.
See also
defaultViewExtent()

Definition at line 55 of file qgsprojectviewsettings.cpp.

◆ setMapScales()

void QgsProjectViewSettings::setMapScales ( const QVector< double > &  scales)

Sets the list of custom project map scales.

The scales list consists of a list of scale denominator values, e.g. 1000 for a 1:1000 scale.

See also
mapScales()
mapScalesChanged()

Definition at line 102 of file qgsprojectviewsettings.cpp.

◆ setPresetFullExtent()

void QgsProjectViewSettings::setPresetFullExtent ( const QgsReferencedRectangle extent)

Sets the project's preset full extent.

This extent represents the maximal limits of the project. Setting the full extent to a null rectangle indicates that the maximal extent should be calculated based on the layers in the project.

See also
setPresetFullExtent()
fullExtent()
Since
QGIS 3.18

Definition at line 65 of file qgsprojectviewsettings.cpp.

◆ setUseProjectScales()

void QgsProjectViewSettings::setUseProjectScales ( bool  enabled)

Sets whether project mapScales() are enabled.

When project map scales are enabled these scales will replace the default QGIS map scales list while working with this project.

See also
useProjectScales()
setMapScales()

Definition at line 121 of file qgsprojectviewsettings.cpp.

◆ useProjectScales()

bool QgsProjectViewSettings::useProjectScales ( ) const

Returns true if project mapScales() are enabled.

When project map scales are enabled these scales will replace the default QGIS map scales list while working with this project.

See also
setUseProjectScales()
mapScales()

Definition at line 130 of file qgsprojectviewsettings.cpp.

◆ writeXml()

QDomElement QgsProjectViewSettings::writeXml ( QDomDocument &  doc,
const QgsReadWriteContext context 
) const

Returns a DOM element representing the settings.

See also
readXml()

Definition at line 205 of file qgsprojectviewsettings.cpp.


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