2017-05-18 07:50:23 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsproject.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
2004-09-09 01:23:32 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2004-09-09 01:23:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-08 18:30:42 +02:00
|
|
|
class QgsProject : QObject, QgsExpressionContextGenerator
|
2004-09-09 01:23:32 +00:00
|
|
|
{
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reads and writes project states.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
\note
|
|
|
|
|
|
|
|
Has two general kinds of state to make persistent. (I.e., to read and
|
|
|
|
write.) First, QGIS proprietary information. Second plug-in information.
|
|
|
|
|
|
|
|
A singleton since there shall only be one active project at a time; and
|
|
|
|
provides canonical location for plug-ins and main app to find/set
|
|
|
|
properties.
|
2007-01-09 02:39:15 +00:00
|
|
|
%End
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsproject.h"
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
public:
|
2017-05-01 16:42:33 +02:00
|
|
|
static QgsProject *instance();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the QgsProject singleton instance
|
|
|
|
%End
|
2004-09-09 01:23:32 +00:00
|
|
|
|
2017-05-02 07:21:20 +02:00
|
|
|
explicit QgsProject( QObject *parent /TransferThis/ = 0 );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Create a new QgsProject.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Most of the time you want to use QgsProject.instance() instead as many components of QGIS work with the singleton.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-11 17:49:24 +08:00
|
|
|
|
2004-09-09 01:23:32 +00:00
|
|
|
~QgsProject();
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setTitle( const QString &title );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the project's title.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param title: new title
|
|
|
|
|
2018-03-19 13:46:19 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Since QGIS 3.2 this is just a shortcut to setting the title in the project's metadata().
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`title`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.4
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString title() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the project's title.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setTitle`
|
2018-03-19 13:46:19 +10:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Since QGIS 3.2 this is just a shortcut to retrieving the title from the project's metadata().
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2004-10-21 17:27:38 +00:00
|
|
|
|
2008-08-23 09:19:49 +00:00
|
|
|
bool isDirty() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the project has been modified since the last write()
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2004-10-21 17:27:38 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setFileName( const QString &name );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the file name associated with the project. This is the file which contains the project's XML
|
|
|
|
representation.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param name: project file name
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`fileName`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2004-10-21 17:27:38 +00:00
|
|
|
|
2008-08-23 19:38:17 +00:00
|
|
|
QString fileName() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the project's file name. This is the file which contains the project's XML
|
|
|
|
representation.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setFileName`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`fileInfo`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2004-10-21 17:27:38 +00:00
|
|
|
|
2018-04-05 13:11:13 +02:00
|
|
|
QFileInfo fileInfo() const /Deprecated/;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns QFileInfo object for the project's associated file.
|
|
|
|
|
2018-04-05 11:45:19 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The use of this method is discouraged since QGIS 3.2 as it only works with project files stored
|
|
|
|
in the file system. It is recommended to use absoluteFilePath(), baseName(), lastModifiedTime() as
|
|
|
|
replacements that are aware of the fact that projects may be saved in other project storages.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`fileName`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 2.9
|
2018-05-25 15:25:18 +10:00
|
|
|
|
|
|
|
.. deprecated:: Use absoluteFilePath(), baseName() or lastModifiedTime() instead
|
2018-04-07 16:56:03 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
QgsProjectStorage *projectStorage() const;
|
|
|
|
%Docstring
|
|
|
|
Returns pointer to project storage implementation that handles read/write of the project file.
|
|
|
|
If the project file is stored in the local file system, returns null pointer.
|
|
|
|
The project storage object is inferred from fileName() of the project.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2018-04-05 11:45:19 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
QDateTime lastModified() const;
|
|
|
|
%Docstring
|
|
|
|
Returns last modified time of the project file as returned by the file system (or other project storage).
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString absoluteFilePath() const;
|
|
|
|
%Docstring
|
|
|
|
Returns full absolute path to the project file if the project is stored in a file system - derived from fileName().
|
|
|
|
Returns empty string when the project is stored in a project storage (there is no concept of paths for custom project storages).
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString baseName() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the base name of the project file without the path and without extension - derived from fileName().
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
New framework for context based expressions
This commit adds the ability for expressions to be evaluated against
specific contexts. It replaces the previous behaviour where
expressions were evaluated against a specific feature and could
utilise fragile global "special columns".
Now, expressions are instead evaluated using a context designed for
each individual expression. This is done via QgsExpressionContext
and QgsExpressionContextScope objects.
A QgsExpressionContextScope encapsulates the variables and functions
relating to a specific context. For instance, scopes can be created
for "global" variables (such as QGIS version, platform, and user-set
variables specified within the QGIS options dialog. Think things
like user name, work department, etc), or for "project" variables
(eg project path, title, filename, and user-set variables set
through the project properties dialog. Project version, reference
number, that kind of thing). Many more scopes are planned, including
map layer scopes (variables for layer name, id, user-set variables
through the layer properties dialog), composer scopes, etc...
QgsExpressionContextScopes are 'stacked' into a QgsExpressionContext
object. Scopes added later to a QgsExpressionContext will override
any variables or functions provided by earlier scopes, so for
instance a user could override their global 'author' variable set
within QGIS options with a different 'author' set via the project
properties dialog.
The intended use is that a QgsExpressionContext is created before
a batch set of QgsExpression evaluations. Scopes are then added to
the context based on what makes sense for that particular
expression. Eg, almost all contexts will consist of the global
scope and project scope, and then additional scopes as required.
So a composer label would be evaluated against a context
consisting of the global scope, project scope, composition scope
and finally composer item scope. The batch set of expression
evaluations would then be performed using this context, after which
the context is discarded. In other words, a context is designed
for use for one specific set of expression evaluations only.
2015-08-07 15:29:51 +10:00
|
|
|
|
2016-10-18 09:55:56 +10:00
|
|
|
QgsCoordinateReferenceSystem crs() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the project's native coordinate reference system.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setCrs`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`ellipsoid`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-10-18 09:55:56 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setCrs( const QgsCoordinateReferenceSystem &crs );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the project's native coordinate reference system.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`crs`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setEllipsoid`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-10-18 09:55:56 +10:00
|
|
|
|
|
|
|
QString ellipsoid() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a proj string representing the project's ellipsoid setting, e.g., "WGS84".
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setEllipsoid`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`crs`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-10-18 09:55:56 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setEllipsoid( const QString &ellipsoid );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the project's ellipsoid from a proj string representation, e.g., "WGS84".
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`ellipsoid`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setCrs`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-10-18 09:55:56 +10:00
|
|
|
|
2017-11-05 20:11:20 +10:00
|
|
|
|
2017-11-06 13:46:44 +10:00
|
|
|
QgsCoordinateTransformContext transformContext() const;
|
2017-11-05 20:11:20 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a copy of the project's 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.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setTransformContext`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`transformContextChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-11-05 20:11:20 +10:00
|
|
|
%End
|
|
|
|
|
2017-11-06 13:46:44 +10:00
|
|
|
void setTransformContext( const QgsCoordinateTransformContext &context );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the project's 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.
|
2017-11-06 13:46:44 +10:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`transformContext`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`transformContextChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-11-06 13:46:44 +10:00
|
|
|
%End
|
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
void clear();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-06-18 22:10:10 +10:00
|
|
|
Clears the project, removing all settings and resetting it back to an empty, default state.
|
2018-06-18 21:50:29 +10:00
|
|
|
|
|
|
|
.. seealso:: :py:func:`cleared`
|
2018-06-18 22:10:10 +10:00
|
|
|
|
|
|
|
.. versionadded:: 2.4
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool read( const QString &filename );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reads given project file from the given file.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param filename: name of project file to read
|
|
|
|
|
|
|
|
:return: true if project file has been read successfully
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-06-14 10:24:20 +10:00
|
|
|
|
2013-05-11 21:30:42 +02:00
|
|
|
bool read();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reads the project from its currently associated file (see fileName() ).
|
|
|
|
|
|
|
|
:return: true if project file has been read successfully
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2004-09-09 01:23:32 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool readLayer( const QDomNode &layerNode );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reads the layer described in the associated DOM node.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This method is mainly for use by QgsProjectBadLayerHandler subclasses
|
2018-01-12 20:51:17 -04:00
|
|
|
that may fix definition of bad layers with the user's help in GUI. Calling
|
|
|
|
this method with corrected DOM node adds the layer back to the project.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerNode: represents a QgsProject DOM node that encodes a specific layer.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2005-05-05 21:06:00 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool write( const QString &filename );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Writes the project to a file.
|
|
|
|
|
2017-12-15 21:36:08 -04:00
|
|
|
:param filename: destination file
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-16 10:38:54 -04:00
|
|
|
:return: true if project was written successfully
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
calling this implicitly sets the project's filename (see setFileName() )
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
isDirty() will be set to false if project is successfully written
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2005-05-05 21:06:00 +00:00
|
|
|
|
2013-05-11 21:30:42 +02:00
|
|
|
bool write();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Writes the project to its current associated file (see fileName() ).
|
|
|
|
|
2017-12-16 10:38:54 -04:00
|
|
|
:return: true if project was written successfully
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
isDirty() will be set to false if project is successfully written
|
|
|
|
%End
|
2004-09-09 01:23:32 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool writeEntry( const QString &scope, const QString &key, bool value ) /PyName=writeEntryBool/;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Write a boolean entry to the project file.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Keys are '/'-delimited entries, implying
|
|
|
|
a hierarchy of keys and corresponding values
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The key string must be valid xml tag names in order to be saved to the file.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
available in Python bindings as writeEntryBool
|
|
|
|
%End
|
2016-08-19 16:51:18 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool writeEntry( const QString &scope, const QString &key, double value ) /PyName=writeEntryDouble/;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Write a double entry to the project file.
|
|
|
|
|
|
|
|
Keys are '/'-delimited entries, implying
|
|
|
|
a hierarchy of keys and corresponding values
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The key string must be valid xml tag names in order to be saved to the file.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
available in Python bindings as writeEntryDouble
|
|
|
|
%End
|
2016-08-19 16:51:18 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool writeEntry( const QString &scope, const QString &key, int value );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Write an integer entry to the project file.
|
|
|
|
|
|
|
|
Keys are '/'-delimited entries, implying
|
|
|
|
a hierarchy of keys and corresponding values
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The key string must be valid xml tag names in order to be saved to the file.
|
|
|
|
%End
|
2016-08-19 16:51:18 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool writeEntry( const QString &scope, const QString &key, const QString &value );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Write a string entry to the project file.
|
|
|
|
|
|
|
|
Keys are '/'-delimited entries, implying
|
|
|
|
a hierarchy of keys and corresponding values
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The key string must be valid xml tag names in order to be saved to the file.
|
|
|
|
%End
|
2016-08-19 16:51:18 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Write a string list entry to the project file.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Keys are '/'-delimited entries, implying
|
|
|
|
a hierarchy of keys and corresponding values
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The key string must be valid xml tag names in order to be saved to the file.
|
|
|
|
%End
|
2004-11-19 22:27:07 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(), bool *ok = 0 ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Key value accessors
|
|
|
|
|
|
|
|
keys would be the familiar QgsSettings-like '/' delimited entries,
|
|
|
|
implying a hierarchy of keys and corresponding values
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2004-11-19 22:27:07 +00:00
|
|
|
|
2017-06-06 09:59:20 +02:00
|
|
|
QString readEntry( const QString &scope, const QString &key, const QString &def = QString(), bool *ok = 0 ) const;
|
2017-05-01 16:42:33 +02:00
|
|
|
int readNumEntry( const QString &scope, const QString &key, int def = 0, bool *ok = 0 ) const;
|
|
|
|
double readDoubleEntry( const QString &scope, const QString &key, double def = 0, bool *ok = 0 ) const;
|
|
|
|
bool readBoolEntry( const QString &scope, const QString &key, bool def = false, bool *ok = 0 ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2005-01-19 22:03:09 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool removeEntry( const QString &scope, const QString &key );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Remove the given key
|
|
|
|
%End
|
2005-03-02 23:34:00 +00:00
|
|
|
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QStringList entryList( const QString &scope, const QString &key ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns keys with values -- do not return keys that contain other keys
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
equivalent to QgsSettings entryList()
|
|
|
|
%End
|
2005-01-19 22:03:09 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QStringList subkeyList( const QString &scope, const QString &key ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns keys with keys -- do not return keys that contain only values
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
equivalent to QgsSettings subkeyList()
|
|
|
|
%End
|
2005-01-19 22:03:09 +00:00
|
|
|
|
2005-03-02 23:34:00 +00:00
|
|
|
|
|
|
|
void dumpProperties() const;
|
|
|
|
|
2017-02-16 09:56:11 +08:00
|
|
|
QgsPathResolver pathResolver() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns path resolver object with considering whether the project uses absolute
|
2017-12-15 10:36:55 -04:00
|
|
|
or relative paths and using current project's path.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-02-16 09:56:11 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QString writePath( const QString &filename ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Prepare a filename to save it to the project file.
|
|
|
|
Creates an absolute or relative path according to the project settings.
|
|
|
|
Paths written to the project file should be prepared with this method.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2009-09-05 19:49:10 +00:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
QString readPath( const QString &filename ) const;
|
|
|
|
%Docstring
|
|
|
|
Turn filename read from the project file to an absolute path
|
|
|
|
%End
|
2009-09-05 19:49:10 +00:00
|
|
|
|
2009-12-07 14:22:37 +00:00
|
|
|
QString error() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns error message from previous read/write
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2009-12-07 14:22:37 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setBadLayerHandler( QgsProjectBadLayerHandler *handler /Transfer/ );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Change handler for missing layers.
|
|
|
|
Deletes old handler and takes ownership of the new one.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2009-12-07 17:14:41 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QString layerIsEmbedded( const QString &id ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Returns project file path if layer is embedded from other project file. Returns empty string if layer is not embedded
|
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Create layer group instance defined in an arbitrary project file.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 2.4
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2012-06-20 11:43:53 +02:00
|
|
|
void setTopologicalEditing( bool enabled );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Convenience function to set topological editing
|
|
|
|
%End
|
2012-06-20 16:18:05 +02:00
|
|
|
|
2012-06-20 11:43:53 +02:00
|
|
|
bool topologicalEditing() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Convenience function to query topological editing status
|
|
|
|
%End
|
2012-06-20 11:43:53 +02:00
|
|
|
|
2016-07-17 14:56:05 +10:00
|
|
|
QgsUnitTypes::DistanceUnit distanceUnits() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Convenience function to query default distance measurement units for project.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setDistanceUnits`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`areaUnits`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.14
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-02-14 21:04:41 +11:00
|
|
|
|
2016-10-18 09:55:56 +10:00
|
|
|
void setDistanceUnits( QgsUnitTypes::DistanceUnit unit );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the default distance measurement units for the project.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`distanceUnits`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAreaUnits`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-10-18 09:55:56 +10:00
|
|
|
|
Fix project unit confusion (pt 3): add area unit settings with a
ton of available area units (eg m2, km2, mi2, ft2, yd2, ha, ac,
etc)
Adds a new option in both the QGIS setting and project properties to
set the units used for area measurements. Just like the distance
setting, this defaults to the units set in QGIS options, but can
then be overridden for specific projects.
The setting is respected for area calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values
Also adds unit tests to ensure that area calculated by attribute table
update bar, field calculator and identify tool are consistent wrt
ellipsoidal calculations and area units.
TODO: make measure tool respect area setting
(refs #13209, #4252 and fixes #12939, #2402, #4857)
2016-02-15 07:25:32 +11:00
|
|
|
QgsUnitTypes::AreaUnit areaUnits() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Convenience function to query default area measurement units for project.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`distanceUnits`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.14
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
Fix project unit confusion (pt 3): add area unit settings with a
ton of available area units (eg m2, km2, mi2, ft2, yd2, ha, ac,
etc)
Adds a new option in both the QGIS setting and project properties to
set the units used for area measurements. Just like the distance
setting, this defaults to the units set in QGIS options, but can
then be overridden for specific projects.
The setting is respected for area calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values
Also adds unit tests to ensure that area calculated by attribute table
update bar, field calculator and identify tool are consistent wrt
ellipsoidal calculations and area units.
TODO: make measure tool respect area setting
(refs #13209, #4252 and fixes #12939, #2402, #4857)
2016-02-15 07:25:32 +11:00
|
|
|
|
2016-10-18 09:55:56 +10:00
|
|
|
void setAreaUnits( QgsUnitTypes::AreaUnit unit );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the default area measurement units for the project.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`areaUnits`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setDistanceUnits`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-10-18 09:55:56 +10:00
|
|
|
|
2013-05-11 21:30:42 +02:00
|
|
|
QString homePath() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-03-07 15:30:23 +10:00
|
|
|
Returns the project's home path. This will either be a manually set home path
|
|
|
|
(see presetHomePath()) or the path containing the project file itself.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-03-07 15:30:23 +10:00
|
|
|
This method always returns the absolute path to the project's home. See
|
|
|
|
presetHomePath() to retrieve any manual project home path override (e.g.
|
|
|
|
relative home paths).
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setPresetHomePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`presetHomePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`homePathChanged`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString presetHomePath() const;
|
|
|
|
%Docstring
|
|
|
|
Returns any manual project home path setting, or an empty string if not set.
|
|
|
|
|
|
|
|
This path may be a relative path. See homePath() to retrieve a path which is always
|
|
|
|
an absolute path.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`homePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setPresetHomePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`homePathChanged`
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2013-05-11 21:30:42 +02:00
|
|
|
|
2017-03-17 22:07:58 +10:00
|
|
|
QgsRelationManager *relationManager() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2017-03-17 22:07:58 +10:00
|
|
|
QgsLayoutManager *layoutManager();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the project's layout manager, which manages compositions within
|
|
|
|
the project.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
QgsLayerTree *layerTreeRoot() const;
|
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns pointer to the root (invisible) node of the project's layer tree
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 2.4
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsLayerTreeRegistryBridge *layerTreeRegistryBridge() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns pointer to the helper class that synchronizes map layer registry with layer tree
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 2.4
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsMapThemeCollection *mapThemeCollection();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns pointer to the project's map theme collection.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
2017-12-19 11:43:52 -04:00
|
|
|
renamed in QGIS 3.0, formerly :py:class:`QgsVisibilityPresetCollection`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.12
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2015-08-19 19:04:53 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsAnnotationManager *annotationManager();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns pointer to the project's annotation manager.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-01-30 14:57:16 +10:00
|
|
|
|
2017-05-30 10:50:28 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
void setNonIdentifiableLayers( const QList<QgsMapLayer *> &layers );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set a list of layers which should not be taken into account on map identification
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-03-11 12:31:32 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setNonIdentifiableLayers( const QStringList &layerIds );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set a list of layers which should not be taken into account on map identification
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-03-11 12:31:32 +01:00
|
|
|
|
|
|
|
QStringList nonIdentifiableLayers() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-26 18:44:30 +10:00
|
|
|
Gets the list of layers which currently should not be taken into account on map identification
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-03-11 12:31:32 +01:00
|
|
|
|
2016-04-05 15:44:06 +02:00
|
|
|
bool autoTransaction() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Transactional editing means that on supported datasources (postgres databases) the edit state of
|
|
|
|
all tables that originate from the same database are synchronized and executed in a server side
|
|
|
|
transaction.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2016-04-05 15:44:06 +02:00
|
|
|
|
2016-10-21 13:31:42 +02:00
|
|
|
void setAutoTransaction( bool autoTransaction );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Transactional editing means that on supported datasources (postgres databases) the edit state of
|
|
|
|
all tables that originate from the same database are synchronized and executed in a server side
|
|
|
|
transaction.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Make sure that this is only called when all layers are not in edit mode.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
2016-10-21 13:31:42 +02:00
|
|
|
|
2018-06-11 09:44:33 +10:00
|
|
|
QgsTransactionGroup *transactionGroup( const QString &providerKey, const QString &connString );
|
|
|
|
%Docstring
|
2018-06-11 11:56:19 +10:00
|
|
|
Returns the matching transaction group from a provider key and connection string.
|
2018-06-11 09:44:33 +10:00
|
|
|
|
|
|
|
Returns None if a matching transaction group is not available.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
2016-06-03 15:13:42 +02:00
|
|
|
bool evaluateDefaultValues() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Should default values be evaluated on provider side when requested and not when committed.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2016-06-03 15:13:42 +02:00
|
|
|
|
|
|
|
void setEvaluateDefaultValues( bool evaluateDefaultValues );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Defines if default values should be evaluated on provider side when requested and not when committed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QgsExpressionContext createExpressionContext() const;
|
2016-04-05 15:44:06 +02:00
|
|
|
|
2016-08-10 19:44:30 +02:00
|
|
|
|
2016-08-26 15:36:07 +02:00
|
|
|
QgsSnappingConfig snappingConfig() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
The snapping configuration for this project.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
QList<QgsVectorLayer *> avoidIntersectionsLayers() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A list of layers with which intersections should be avoided.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setAvoidIntersectionsLayers( const QList<QgsVectorLayer *> &layers );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A list of layers with which intersections should be avoided.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2016-12-22 13:11:43 +01:00
|
|
|
QVariantMap customVariables() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A map of custom project variables.
|
|
|
|
To get all available variables including generated ones
|
|
|
|
use QgsExpressionContextUtils.projectScope() instead.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setCustomVariables( const QVariantMap &customVariables );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A map of custom project variables.
|
|
|
|
Be careful not to set generated variables.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2017-04-21 18:04:09 +08:00
|
|
|
|
|
|
|
void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets project's global labeling engine settings
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-04-21 18:04:09 +08:00
|
|
|
|
|
|
|
const QgsLabelingEngineSettings &labelingEngineSettings() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns project's global labeling engine settings
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-04-21 18:04:09 +08:00
|
|
|
|
2017-05-03 07:35:47 +10:00
|
|
|
QgsMapLayerStore *layerStore();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a pointer to the project's internal layer store.
|
|
|
|
/since QGIS 3.0
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
2017-05-03 07:35:47 +10:00
|
|
|
|
2016-12-10 15:18:12 +08:00
|
|
|
int count() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the number of registered layers.
|
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsMapLayer *mapLayer( const QString &layerId ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Retrieve a pointer to a registered layer by layer ID.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerId: ID of layer to retrieve
|
|
|
|
|
|
|
|
:return: matching layer, or None if no matching layer found
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`mapLayersByName`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`mapLayers`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QList<QgsMapLayer *> mapLayersByName( const QString &layerName ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Retrieve a list of matching registered layers by layer name.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerName: name of layers to match
|
|
|
|
|
|
|
|
:return: list of matching layers
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`mapLayer`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`mapLayers`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
QMap<QString, QgsMapLayer *> mapLayers() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a map of all registered layers by layer ID.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`mapLayer`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`mapLayersByName`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layers`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
2017-07-17 16:58:01 +01:00
|
|
|
bool isZipped() const;
|
2017-07-10 17:18:49 +01:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the project comes from a zip archive, false otherwise.
|
2017-07-10 17:18:49 +01:00
|
|
|
%End
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
QList<QgsMapLayer *> addMapLayers( const QList<QgsMapLayer *> &mapLayers /Transfer/,
|
|
|
|
bool addToLegend = true);
|
|
|
|
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Add a list of layers to the map of loaded layers.
|
|
|
|
|
|
|
|
The layersAdded() and layerWasAdded() signals will always be emitted.
|
|
|
|
The legendLayersAdded() signal is emitted only if addToLegend is true.
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2018-05-27 16:42:41 +10:00
|
|
|
:param mapLayers: A list of layer which should be added to the registry
|
|
|
|
:param addToLegend: If true (by default), the layers will be added to the
|
2018-05-24 21:21:14 +10:00
|
|
|
legend and to the main canvas. If you have a private
|
2018-05-27 16:33:02 +10:00
|
|
|
layer you can set this parameter to false to hide it.
|
2017-12-15 10:36:55 -04:00
|
|
|
:param takeOwnership: Ownership will be transferred to the layer registry.
|
2018-05-24 21:21:14 +10:00
|
|
|
If you specify false here you have take care of deleting
|
|
|
|
the layers yourself. Not available in Python.
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:return: a list of the map layers that were added
|
2018-05-24 21:21:14 +10:00
|
|
|
successfully. If a layer is invalid, or already exists in the registry,
|
2018-05-27 16:33:02 +10:00
|
|
|
it will not be part of the returned QList.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
As a side-effect QgsProject is made dirty.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
takeOwnership is not available in the Python bindings - the registry will always
|
2018-01-12 20:51:17 -04:00
|
|
|
take ownership
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`addMapLayer`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 1.8
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
QgsMapLayer *addMapLayer( QgsMapLayer *mapLayer /Transfer/,
|
|
|
|
bool addToLegend = true);
|
|
|
|
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Add a layer to the map of loaded layers.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
The layersAdded() and layerWasAdded() signals will always be emitted.
|
|
|
|
The legendLayersAdded() signal is emitted only if addToLegend is true.
|
|
|
|
If you are adding multiple layers at once, you should use
|
|
|
|
addMapLayers() instead.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param mapLayer: A layer to add to the registry
|
|
|
|
:param addToLegend: If true (by default), the layer will be added to the
|
2018-05-24 21:21:14 +10:00
|
|
|
legend and to the main canvas. If you have a private
|
2018-05-27 16:33:02 +10:00
|
|
|
layer you can set this parameter to false to hide it.
|
2017-12-15 10:36:55 -04:00
|
|
|
:param takeOwnership: Ownership will be transferred to the layer registry.
|
2018-05-24 21:21:14 +10:00
|
|
|
If you specify false here you have take care of deleting
|
|
|
|
the layer yourself. Not available in Python.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: None if unable to add layer, otherwise pointer to newly added layer
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`addMapLayers`
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
As a side-effect QgsProject is made dirty.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Use addMapLayers if adding more than one layer at a time
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
takeOwnership is not available in the Python bindings - the registry will always
|
2018-01-12 20:51:17 -04:00
|
|
|
take ownership
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`addMapLayers`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void removeMapLayers( const QStringList &layerIds );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Remove a set of layers from the registry by layer ID.
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
The specified layers will be removed from the registry. If the registry has ownership
|
|
|
|
of any layers these layers will also be deleted.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerIds: list of IDs of the layers to remove
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
As a side-effect the QgsProject instance is marked dirty.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeMapLayer`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeAllMapLayers`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 1.8
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
void removeMapLayers( const QList<QgsMapLayer *> &layers );
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void removeMapLayer( const QString &layerId );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Remove a layer from the registry by layer ID.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
The specified layer will be removed from the registry. If the registry has ownership
|
|
|
|
of the layer then it will also be deleted.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerId: ID of the layer to remove
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
As a side-effect the QgsProject instance is marked dirty.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeMapLayers`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeAllMapLayers`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void removeMapLayer( QgsMapLayer *layer );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Remove a layer from the registry.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
The specified layer will be removed from the registry. If the registry has ownership
|
|
|
|
of the layer then it will also be deleted.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layer: The layer to remove. Null pointers are ignored.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
As a side-effect the QgsProject instance is marked dirty.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeMapLayers`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeAllMapLayers`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-04-26 15:27:00 +10:00
|
|
|
QgsMapLayer *takeMapLayer( QgsMapLayer *layer ) /TransferBack/;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Takes a layer from the registry. If the layer was owned by the project, the
|
|
|
|
layer will be returned without deleting it. The caller takes ownership of
|
|
|
|
the layer and is responsible for deleting it.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeMapLayer`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-04-26 15:27:00 +10:00
|
|
|
|
2016-12-10 15:18:12 +08:00
|
|
|
void removeAllMapLayers();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Removes all registered layers. If the registry has ownership
|
|
|
|
of any layers these layers will also be deleted.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
As a side-effect the QgsProject instance is marked dirty.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Calling this method will cause the removeAll() signal to
|
2018-01-12 20:51:17 -04:00
|
|
|
be emitted.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeMapLayer`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeMapLayers`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
|
|
|
void reloadAllLayers();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reload all registered layer's provider data caches, synchronising the layer
|
|
|
|
with any changes in the datasource.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`QgsMapLayer.reload`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-08-06 22:44:53 +02:00
|
|
|
QgsCoordinateReferenceSystem defaultCrsForNewLayers() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the default CRS for new layers based on the settings and
|
|
|
|
the current project CRS
|
2017-08-06 22:44:53 +02:00
|
|
|
%End
|
|
|
|
|
2017-09-05 07:44:59 +01:00
|
|
|
void setTrustLayerMetadata( bool trust );
|
2017-09-05 07:44:20 +01:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the trust option allowing to indicate if the extent has to be
|
|
|
|
read from the XML document when data source has no metadata or if the
|
|
|
|
data provider has to determine it. Moreover, when this option is
|
|
|
|
activated, primary key unicity is not checked for views and
|
|
|
|
materialized views with Postgres provider.
|
2017-09-05 07:44:20 +01:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param trust: True to trust the project, false otherwise
|
2017-09-05 07:44:20 +01:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-09-05 07:44:59 +01:00
|
|
|
bool trustLayerMetadata() const;
|
2017-09-05 07:44:20 +01:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the trust option is activated, false otherwise. This
|
|
|
|
option allows indicateing if the extent has to be read from the XML
|
|
|
|
document when data source has no metadata or if the data provider has
|
|
|
|
to determine it. Moreover, when this option is activated, primary key
|
|
|
|
unicity is not checked for views and materialized views with Postgres
|
|
|
|
provider.
|
|
|
|
|
2017-09-05 07:44:20 +01:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-08-06 22:44:53 +02:00
|
|
|
|
2017-09-07 18:01:04 +01:00
|
|
|
|
2017-08-29 04:23:26 +01:00
|
|
|
QgsAuxiliaryStorage *auxiliaryStorage();
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the current auxiliary storage.
|
|
|
|
|
2017-08-29 04:23:26 +01:00
|
|
|
.. versionadded:: 3.0
|
2018-03-19 13:38:08 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
const QgsProjectMetadata &metadata() const;
|
|
|
|
%Docstring
|
|
|
|
Returns a reference to the project's metadata store.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setMetadata`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`metadataChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2018-03-19 13:38:08 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMetadata( const QgsProjectMetadata &metadata );
|
|
|
|
%Docstring
|
|
|
|
Sets the project's ``metadata`` store.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`metadata`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`metadataChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2018-04-11 15:48:49 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
QSet<QgsMapLayer *> requiredLayers() const;
|
|
|
|
%Docstring
|
|
|
|
Returns a set of map layers that are required in the project and therefore they should not get
|
|
|
|
removed from the project. The set of layers may be configured by users in project properties.
|
|
|
|
and it is mainly a hint for the user interface to protect users from removing layers that important
|
|
|
|
in the project. The removeMapLayer(), removeMapLayers() calls do not block removal of layers listed here.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setRequiredLayers( const QSet<QgsMapLayer *> &layers );
|
|
|
|
%Docstring
|
|
|
|
Configures a set of map layers that are required in the project and therefore they should not get
|
|
|
|
removed from the project. The set of layers may be configured by users in project properties.
|
|
|
|
and it is mainly a hint for the user interface to protect users from removing layers that important
|
|
|
|
in the project. The removeMapLayer(), removeMapLayers() calls do not block removal of layers listed here.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2017-08-29 04:23:26 +01:00
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
signals:
|
2018-06-18 21:50:29 +10:00
|
|
|
|
|
|
|
void cleared();
|
|
|
|
%Docstring
|
|
|
|
Emitted when the project is cleared (and additionally when an open project is cleared
|
|
|
|
just before a new project is read).
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`clear`
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
void readProject( const QDomDocument & );
|
|
|
|
%Docstring
|
2018-06-18 21:50:29 +10:00
|
|
|
Emitted when a project is being read.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
void writeProject( QDomDocument & );
|
|
|
|
%Docstring
|
2018-06-18 21:50:29 +10:00
|
|
|
Emitted when the project is being written.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void readMapLayer( QgsMapLayer *mapLayer, const QDomElement &layerNode );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-06-18 21:50:29 +10:00
|
|
|
Emitted after the basic initialization of a layer from the project
|
2017-12-15 10:36:55 -04:00
|
|
|
file is done. You can use this signal to read additional information
|
|
|
|
from the project file.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2018-05-27 16:42:41 +10:00
|
|
|
:param mapLayer: The map layer which is being initialized
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerNode: The layer node from the project file
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2013-04-28 10:53:34 +02:00
|
|
|
|
2013-05-11 21:30:42 +02:00
|
|
|
void writeMapLayer( QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-06-18 21:50:29 +10:00
|
|
|
Emitted when a layer is being saved. You can use this method to save
|
2017-12-15 10:36:55 -04:00
|
|
|
additional information to the layer.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2018-05-27 16:42:41 +10:00
|
|
|
:param mapLayer: The map layer which is being initialized
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerElem: The layer element from the project file
|
|
|
|
:param doc: The document
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2013-05-11 21:30:42 +02:00
|
|
|
|
|
|
|
void projectSaved();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-06-18 21:50:29 +10:00
|
|
|
Emitted when the project file has been written and closed.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2013-04-28 10:53:34 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
void oldProjectVersionWarning( const QString & );
|
|
|
|
%Docstring
|
2018-06-18 21:50:29 +10:00
|
|
|
Emitted when an old project file is read.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
void layerLoaded( int i, int n );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when a layer from a projects was read.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param i: current layer
|
|
|
|
:param n: number of layers
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2005-03-02 23:34:00 +00:00
|
|
|
|
2018-02-06 14:57:04 -04:00
|
|
|
void loadingLayer( const QString &layerName );
|
2018-02-26 14:48:05 -04:00
|
|
|
%Docstring
|
|
|
|
Emitted when a layer is loaded
|
|
|
|
%End
|
2018-02-06 14:57:04 -04:00
|
|
|
|
2018-02-26 14:48:05 -04:00
|
|
|
void loadingLayerMessageReceived( const QString &layerName, const QList<QgsReadWriteContext::ReadWriteMessage> &messages );
|
2018-02-06 15:18:50 -04:00
|
|
|
%Docstring
|
2018-05-26 14:10:30 +10:00
|
|
|
Emitted when loading layers has produced some messages
|
2018-02-26 14:48:05 -04:00
|
|
|
|
|
|
|
:param layerName: the layer name
|
|
|
|
:param messages: a list of pairs of Qgis.MessageLevel and messages
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2018-02-06 15:18:50 -04:00
|
|
|
%End
|
2013-05-11 21:30:42 +02:00
|
|
|
|
2016-03-11 12:31:32 +01:00
|
|
|
void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Emitted when the list of layer which are excluded from map identification changes
|
|
|
|
%End
|
2016-03-11 12:31:32 +01:00
|
|
|
|
2016-07-11 08:42:27 +10:00
|
|
|
void fileNameChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
Emitted when the file name of the project changes
|
|
|
|
%End
|
2016-07-11 08:42:27 +10:00
|
|
|
|
|
|
|
void homePathChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-03-07 15:30:23 +10:00
|
|
|
Emitted when the home path of the project changes.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setPresetHomePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`homePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`presetHomePath`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-07-11 08:42:27 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void snappingConfigChanged( const QgsSnappingConfig &config );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-06-18 21:50:29 +10:00
|
|
|
Emitted whenever the configuration for snapping has changed.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2016-12-21 20:14:58 +01:00
|
|
|
void customVariablesChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted whenever the expression variables stored in the project have been changed.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-07-19 11:59:44 +10:00
|
|
|
|
2017-03-06 18:05:13 +01:00
|
|
|
void crsChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the CRS of the project has changed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-04-20 15:45:08 +10:00
|
|
|
void ellipsoidChanged( const QString &ellipsoid );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the project ``ellipsoid`` is changed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setEllipsoid`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`ellipsoid`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2017-03-06 18:05:13 +01:00
|
|
|
|
2017-11-06 13:46:44 +10:00
|
|
|
|
|
|
|
void transformContextChanged();
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the project transformContext() is changed.
|
2017-11-06 13:46:44 +10:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`transformContext`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-12-15 17:32:00 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void missingDatumTransforms( const QStringList &missingTransforms );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when datum transforms stored in the project are not available locally.
|
|
|
|
|
2017-12-15 17:32:00 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-11-06 13:46:44 +10:00
|
|
|
%End
|
|
|
|
|
2016-10-18 15:43:28 +02:00
|
|
|
void transactionGroupsChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted whenever a new transaction group has been created or a
|
|
|
|
transaction group has been removed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-06-14 10:24:20 +10:00
|
|
|
|
2016-10-18 16:17:07 +02:00
|
|
|
void topologicalEditingChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the topological editing flag has changed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-10-18 16:17:07 +02:00
|
|
|
|
2017-01-06 17:24:32 +08:00
|
|
|
void avoidIntersectionsLayersChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted whenever avoidIntersectionsLayers has changed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-10-18 16:27:30 +02:00
|
|
|
|
2016-10-23 21:14:42 +02:00
|
|
|
void mapThemeCollectionChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the map theme collection changes.
|
|
|
|
This only happens when the map theme collection is reset.
|
|
|
|
Any pointer previously received from mapThemeCollection()
|
|
|
|
must no longer be used after this signal is emitted.
|
|
|
|
You must still connect to signals from the map theme collection
|
|
|
|
if you want to be notified about new map themes being added and
|
|
|
|
map themes being removed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-10-23 21:14:42 +02:00
|
|
|
|
2017-04-21 18:04:09 +08:00
|
|
|
void labelingEngineSettingsChanged();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when global configuration of the labeling engine changes.
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-04-21 18:04:09 +08:00
|
|
|
|
2018-03-19 13:38:08 +10:00
|
|
|
void metadataChanged();
|
|
|
|
%Docstring
|
|
|
|
Emitted when the project's metadata is changed.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setMetadata`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`metadata`
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void layersWillBeRemoved( const QStringList &layerIds );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when one or more layers are about to be removed from the registry.
|
|
|
|
|
|
|
|
:param layerIds: A list of IDs for the layers which are to be removed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layerWillBeRemoved`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layersRemoved`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
void layersWillBeRemoved( const QList<QgsMapLayer *> &layers );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when one or more layers are about to be removed from the registry.
|
|
|
|
|
|
|
|
:param layers: A list of layers which are to be removed.
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layerWillBeRemoved`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layersRemoved`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void layerWillBeRemoved( const QString &layerId );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when a layer is about to be removed from the registry.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerId: The ID of the layer to be removed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Consider using layersWillBeRemoved() instead
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layersWillBeRemoved`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layerRemoved`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void layerWillBeRemoved( QgsMapLayer *layer );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when a layer is about to be removed from the registry.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layer: The layer to be removed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Consider using layersWillBeRemoved() instead
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layersWillBeRemoved`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layerRemoved`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void layersRemoved( const QStringList &layerIds );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted after one or more layers were removed from the registry.
|
|
|
|
|
2018-05-27 16:42:41 +10:00
|
|
|
:param layerIds: A list of IDs of the layers which were removed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layersWillBeRemoved`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void layerRemoved( const QString &layerId );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted after a layer was removed from the registry.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerId: The ID of the layer removed.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Consider using layersRemoved() instead
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layerWillBeRemoved`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
|
|
|
void removeAll();
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-03-09 13:13:09 +10:00
|
|
|
void layersAdded( const QList<QgsMapLayer *> &layers );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when one or more layers were added to the registry.
|
|
|
|
This signal is also emitted for layers added to the registry,
|
|
|
|
but not to the legend.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layers: List of layers which have been added.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`legendLayersAdded`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layerWasAdded`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-03-09 13:13:09 +10:00
|
|
|
void layerWasAdded( QgsMapLayer *layer );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when a layer was added to the registry.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Consider using layersAdded() instead
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`layersAdded`
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
2017-03-09 13:13:09 +10:00
|
|
|
void legendLayersAdded( const QList<QgsMapLayer *> &layers );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted, when a layer was added to the registry and the legend.
|
|
|
|
Layers can also be private layers, which are signalled by
|
|
|
|
layersAdded() and layerWasAdded() but will not be
|
|
|
|
advertised by this signal.
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layers: List of QgsMapLayer which were added to the legend.
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-12-10 15:18:12 +08:00
|
|
|
|
2018-03-06 11:57:51 +10:00
|
|
|
void isDirtyChanged( bool dirty );
|
2018-03-05 15:10:23 +10:00
|
|
|
%Docstring
|
2018-03-05 19:15:06 +10:00
|
|
|
Emitted when the project dirty status changes.
|
2017-08-06 22:44:53 +02:00
|
|
|
|
2018-03-05 15:10:23 +10:00
|
|
|
:param dirty: True if the project is in a dirty state and has pending unsaved changes.
|
2018-03-05 19:15:06 +10:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2018-03-05 15:10:23 +10:00
|
|
|
%End
|
2017-08-06 22:44:53 +02:00
|
|
|
|
2016-10-18 15:43:28 +02:00
|
|
|
public slots:
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
void setSnappingConfig( const QgsSnappingConfig &snappingConfig );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
The snapping configuration for this project.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2018-03-09 11:54:57 +10:00
|
|
|
|
2016-06-14 10:24:20 +10:00
|
|
|
void setDirty( bool b = true );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Flag the project as dirty (modified). If this flag is set, the user will
|
|
|
|
be asked to save changes to the project before closing the current project.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
promoted to public slot in 2.16
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.4
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-06-14 10:24:20 +10:00
|
|
|
|
2018-03-07 15:30:23 +10:00
|
|
|
void setPresetHomePath( const QString &path );
|
|
|
|
%Docstring
|
|
|
|
Sets the project's home ``path``. If an empty path is specified than the
|
|
|
|
home path will be automatically determined from the project's file path.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`presetHomePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`homePath`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`homePathChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2018-03-07 15:30:23 +10:00
|
|
|
%End
|
|
|
|
|
2009-12-07 17:14:41 +00:00
|
|
|
};
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2018-03-09 11:54:57 +10:00
|
|
|
class QgsProjectDirtyBlocker
|
|
|
|
{
|
|
|
|
%Docstring
|
|
|
|
Temporarily blocks QgsProject "dirtying" for the lifetime of the object.
|
|
|
|
|
|
|
|
QgsProjectDirtyBlocker supports "stacked" blocking, so two QgsProjectDirtyBlockers created
|
|
|
|
for the same project will both need to be destroyed before the project can be dirtied again.
|
|
|
|
|
|
|
|
Note that QgsProjectDirtyBlocker only blocks calls which set the project as dirty - calls
|
|
|
|
which set the project as clean are not blocked.
|
|
|
|
|
|
|
|
Python scripts should not use QgsProjectDirtyBlocker directly. Instead, use :py:func:`QgsProject.blockDirtying()`
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
project = QgsProject.instance()
|
|
|
|
with QgsProject.blockDirtying(project):
|
|
|
|
# do something
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`QgsProject.setDirty`
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsproject.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
QgsProjectDirtyBlocker( QgsProject *project );
|
|
|
|
%Docstring
|
|
|
|
Constructor for QgsProjectDirtyBlocker.
|
|
|
|
|
|
|
|
This will block dirtying the specified ``project`` for the lifetime of this object.
|
|
|
|
%End
|
|
|
|
|
2018-06-11 09:46:10 +10:00
|
|
|
|
|
|
|
|
2018-03-09 11:54:57 +10:00
|
|
|
~QgsProjectDirtyBlocker();
|
|
|
|
|
2018-06-11 09:46:10 +10:00
|
|
|
private:
|
|
|
|
QgsProjectDirtyBlocker( const QgsProjectDirtyBlocker &other );
|
2018-03-09 11:54:57 +10:00
|
|
|
};
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsproject.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|