File: qgslayerdefinition.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (197 lines) | stat: -rw-r--r-- 7,226 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgslayerdefinition.h                                        *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsLayerDefinition
{
%Docstring(signature="appended")
The :py:class:`QgsLayerDefinition` class holds generic methods for
loading/exporting QLR files.

QLR files are an export of the layer xml including the style and
datasource location. There is no link to the QLR file once loaded.
Consider the QLR file a mini project file for layers and styles. QLR
files also store the layer tree info for the exported layers, including
group information.
%End

%TypeHeaderCode
#include "qgslayerdefinition.h"
%End
  public:

    static bool loadLayerDefinition( const QString &path, QgsProject *project, QgsLayerTreeGroup *rootGroup, QString &errorMessage /Out/, Qgis::LayerTreeInsertionMethod insertMethod = Qgis::LayerTreeInsertionMethod::OptimalInInsertionGroup, const QgsLayerTreeRegistryBridge::InsertionPoint *insertPoint = 0 );
%Docstring
Loads the QLR at path into QGIS. New layers are added to given project
into layer tree specified by rootGroup

:param path: file path to the qlr
:param project: the current project
:param rootGroup: the layer tree group to insert the qlr content
:param insertMethod: method for layer tree (since QGIS 3.38)
:param insertPoint: describes where in rootGroup the qlr layers/groups
                    shall be inserted (since QGIS 3.38)

:return: - true in case of success
         - errorMessage: the returned error message
%End

    static bool loadLayerDefinition( QDomDocument doc,  QgsProject *project, QgsLayerTreeGroup *rootGroup, QString &errorMessage /Out/, QgsReadWriteContext &context, Qgis::LayerTreeInsertionMethod insertMethod = Qgis::LayerTreeInsertionMethod::OptimalInInsertionGroup, const QgsLayerTreeRegistryBridge::InsertionPoint *insertPoint = 0 );
%Docstring
Loads the QLR from the XML document. New layers are added to given
project into layer tree specified by rootGroup

:param doc: the xml document
:param project: the current project
:param rootGroup: the layer tree group to insert the qlr content
:param context: the read write context
:param insertMethod: method for layer tree (since QGIS 3.38)
:param insertPoint: describes where in rootGroup the qlr layers/groups
                    shall be inserted (since QGIS 3.38)

:return: - true in case of success
         - errorMessage: the returned error message
%End

    static bool exportLayerDefinition( const QString &path, const QList<QgsLayerTreeNode *> &selectedTreeNodes, QString &errorMessage /Out/ );
%Docstring
Exports the selected layer tree nodes to a QLR file.

This method uses the :py:func:`QgsProject.instance()`'s file path
setting to determine whether absolute or relative paths are written. Use
the variant with an explicit argument for file path type for control
over this setting.

:param path: file path for exported QLR file
:param selectedTreeNodes: layer tree nodes to include in the QLR file

:return: - ``True`` if the export was successful
         - errorMessage: any error messages generated during the export
%End

    static bool exportLayerDefinition( const QString &path, const QList<QgsLayerTreeNode *> &selectedTreeNodes, Qgis::FilePathType pathType, QString &errorMessage /Out/ );
%Docstring
Exports the selected layer tree nodes to a QLR file.

:param path: file path for exported QLR file
:param selectedTreeNodes: layer tree nodes to include in the QLR file
:param pathType: specifies whether absolute or relative file paths
                 should be used.

:return: - ``True`` if the export was successful
         - errorMessage: any error messages generated during the export

.. versionadded:: 3.22
%End

    static bool exportLayerDefinition( QDomDocument doc, const QList<QgsLayerTreeNode *> &selectedTreeNodes, QString &errorMessage /Out/, const QgsReadWriteContext &context );
%Docstring
Exports the selected layer tree nodes to a QLR XML document.
%End

    static QDomDocument exportLayerDefinitionLayers( const QList<QgsMapLayer *> &layers, const QgsReadWriteContext &context );
%Docstring
Returns the given layer as a layer definition document Layer definitions
store the data source as well as styling and custom properties.

Layer definitions can be used to load a layer and styling all from a
single file.

This is a low-level routine that does not write layer tree.

.. seealso:: :py:func:`exportLayerDefinition`
%End

    static QList<QgsMapLayer *> loadLayerDefinitionLayers( QDomDocument &document, QgsReadWriteContext &context ) /Factory/;
%Docstring
Creates new layers from a layer definition document. This is a low-level
routine that does not resolve layer ID conflicts, dependencies and joins

.. seealso:: :py:func:`loadLayerDefinition`
%End

    static QList<QgsMapLayer *> loadLayerDefinitionLayers( const QString &qlrfile ) /Factory/;
%Docstring
Creates new layers from a layer definition file (.QLR) This is a
low-level routine that does not resolve layer ID conflicts, dependencies
and joins

.. seealso:: :py:func:`loadLayerDefinition`
%End

    class DependencySorter
{
%Docstring(signature="appended")
Class used to work with layer dependencies stored in a XML project or
layer definition file
%End

%TypeHeaderCode
#include "qgslayerdefinition.h"
%End
      public:

        explicit DependencySorter( const QDomDocument &doc );
%Docstring
Constructor

:param doc: The XML document containing maplayer elements
%End

        explicit DependencySorter( const QString &fileName );
%Docstring
Constructor

:param fileName: The filename where the XML document is stored
%End

        QVector<QDomNode> sortedLayerNodes() const;
%Docstring
Gets the layer nodes in an order where they can be loaded incrementally
without dependency break
%End

        QStringList sortedLayerIds() const;
%Docstring
Gets the layer IDs in an order where they can be loaded incrementally
without dependency break
%End

        bool hasCycle() const;
%Docstring
Whether some cyclic dependency has been detected
%End

        bool hasMissingDependency() const;
%Docstring
Whether some dependency is missing
%End

        bool isLayerDependent( const QString &layerId ) const;
%Docstring
Returns whether the layer associated with the``layerId`` is dependent
from another layer

.. versionadded:: 3.32
%End

    };

};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgslayerdefinition.h                                        *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/