File: qgsrelation.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 (385 lines) | stat: -rw-r--r-- 10,537 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsrelation.h                                               *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsRelation
{
%Docstring(signature="appended")
Represents a relationship between two vector layers.
%End

%TypeHeaderCode
#include "qgsrelation.h"
%End
  public:
    static const QMetaObject staticMetaObject;

  public:


    QgsRelation();
%Docstring
Default constructor. Creates an invalid relation.
%End
    ~QgsRelation();

    QgsRelation( const QgsRelationContext &context );
%Docstring
Constructor with context. Creates an invalid relation.
%End

    QgsRelation( const QgsRelation &other );
%Docstring
Copies a relation. This makes a shallow copy, relations are implicitly
shared and only duplicated when the copy is changed.
%End


    static QgsRelation createFromXml( const QDomNode &node, QgsReadWriteContext &context, const QgsRelationContext &relationContext = QgsRelationContext() );
%Docstring
Creates a relation from an XML structure. Used for reading .qgs
projects.

:param node: The dom node containing the relation information
:param context: to pass project translator
:param relationContext: a relation context

:return: A relation
%End

    void writeXml( QDomNode &node, QDomDocument &doc ) const;
%Docstring
Writes a relation to an XML structure. Used for saving .qgs projects

:param node: The parent node in which the relation will be created
:param doc: The document in which the relation will be saved
%End

    void setId( const QString &id );
%Docstring
Set an id for this relation
%End

    void setName( const QString &name );
%Docstring
Set a name for this relation
%End

    void setStrength( Qgis::RelationshipStrength strength );
%Docstring
Set a strength for this relation
%End

    void setReferencingLayer( const QString &id );
%Docstring
Set the referencing (child) layer id. This layer will be searched in the
registry.
%End

    void setReferencedLayer( const QString &id );
%Docstring
Set the referenced (parent) layer id. This layer will be searched in the
registry.
%End

    void addFieldPair( const QString &referencingField, const QString &referencedField );
%Docstring
Add a field pair which is part of this relation The first element of
each pair are the field names of the foreign key. The second element of
each pair are the field names of the matching primary key.

:param referencingField: The field name on the referencing (child) layer
                         (FK)
:param referencedField: The field name on the referenced (parent) layer
                        (PK)
%End


    QgsFeatureIterator getRelatedFeatures( const QgsFeature &feature ) const;
%Docstring
Creates an iterator which returns all the features on the referencing
(child) layer which have a foreign key pointing to the provided feature.

:param feature: A feature from the referenced (parent) layer

:return: An iterator with all the referenced features

.. seealso:: :py:func:`getRelatedFeaturesRequest`

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

    QgsFeatureRequest getRelatedFeaturesRequest( const QgsFeature &feature ) const;
%Docstring
Creates a request to return all the features on the referencing (child)
layer which have a foreign key pointing to the provided feature.

:param feature: A feature from the referenced (parent) layer

:return: A request for all the referencing features

.. seealso:: :py:func:`getRelatedFeatures`

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

    QString getRelatedFeaturesFilter( const QgsFeature &feature ) const;
%Docstring
Returns a filter expression which returns all the features on the
referencing (child) layer which have a foreign key pointing to the
provided feature.

:param feature: A feature from the referenced (parent) layer

:return: expression filter string for all the referencing features

.. seealso:: :py:func:`getRelatedFeatures`

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

    QgsFeatureRequest getReferencedFeatureRequest( const QgsAttributes &attributes ) const;
%Docstring
Creates a request to return the feature on the referenced (parent) layer
which is referenced by the provided feature.

:param attributes: An attribute vector containing the foreign key

:return: A request the referenced feature
%End

    QgsFeatureRequest getReferencedFeatureRequest( const QgsFeature &feature ) const;
%Docstring
Creates a request to return the feature on the referenced (parent) layer
which is referenced by the provided feature.

:param feature: A feature from the referencing (child) layer

:return: A request the referenced feature
%End

    QgsFeature getReferencedFeature( const QgsFeature &feature ) const;
%Docstring
Creates a request to return the feature on the referenced (parent) layer
which is referenced by the provided feature.

:param feature: A feature from the referencing (child) layer

:return: A request the referenced feature
%End

    QString name() const;
%Docstring
Returns a human readable name for this relation. Mostly used as title
for the children.

.. seealso:: :py:func:`id`

:return: A name
%End

    Qgis::RelationshipStrength strength() const;
%Docstring
Returns the relation strength as a string

:return: strength
%End

    QString id() const;
%Docstring
A (project-wide) unique id for this relation

:return: The id
%End

    void generateId();
%Docstring
Generate a (project-wide) unique id for this relation
%End

    QString referencingLayerId() const;
%Docstring
Access the referencing (child) layer's id This is the layer which has
the field(s) which point to another layer

:return: The id of the referencing layer
%End

    QgsVectorLayer *referencingLayer() const;
%Docstring
Access the referencing (child) layer This is the layer which has the
field(s) which point to another layer

:return: The referencing layer
%End

    QString referencedLayerId() const;
%Docstring
Access the referenced (parent) layer's id

:return: The id of the referenced layer
%End

    QgsVectorLayer *referencedLayer() const;
%Docstring
Access the referenced (parent) layer

:return: referenced layer
%End

    QMap< QString, QString > fieldPairs() const;
%Docstring
Returns the field pairs which form this relation The first element of
each pair are the field names of the foreign key. The second element of
each pair are the field names of the matching primary key.

:return: The fields forming the relation
%End
%MethodCode
    const QList< QgsRelation::FieldPair > &pairs = sipCpp->fieldPairs();
    sipRes = new QMap< QString, QString >();
    for ( const QgsRelation::FieldPair &pair : pairs )
    {
      sipRes->insert( pair.first, pair.second );
    }
%End

    QgsAttributeList referencedFields() const;
%Docstring
Returns a list of attributes used to form the referenced fields (most
likely primary key) on the referenced (parent) layer.

:return: A list of attributes
%End

    QgsAttributeList referencingFields() const;
%Docstring
Returns a list of attributes used to form the referencing fields
(foreign key) on the referencing (child) layer.

:return: A list of attributes
%End

    bool referencingFieldsAllowNull() const;
%Docstring
Returns ``True`` if none of the referencing fields has a NOT NULL
constraint.

.. versionadded:: 3.28
%End

    bool isValid() const;
%Docstring
Returns the validity of this relation. Don't use the information if it's
not valid. A relation is considered valid if both referenced and
referencig layers are valid.

:return: ``True`` if the relation is valid

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

    QString validationError() const;
%Docstring
Returns a user-friendly explanation for why the relationship is invalid.

Returns an empty string if the relationship
:py:func:`~QgsRelation.isValid`.

.. seealso:: :py:func:`isValid`

.. versionadded:: 3.28
%End

    bool hasEqualDefinition( const QgsRelation &other ) const;
%Docstring
Compares the two QgsRelation, ignoring the name and the ID.

:param other: The other relation

:return: ``True`` if they are similar
%End

    QString resolveReferencedField( const QString &referencingField ) const;
%Docstring
Gets the referenced field counterpart given a referencing field.
%End

    QString resolveReferencingField( const QString &referencedField ) const;
%Docstring
Gets the referencing field counterpart given a referenced field.
%End

    void updateRelationStatus();
%Docstring
Updates the validity status of this relation. Will be called internally
whenever a member is changed.

.. versionadded:: 3.6
%End

    void setPolymorphicRelationId( const QString &polymorphicRelationId );
%Docstring
Sets the parent polymorphic relation id.

.. versionadded:: 3.18
%End

    QString polymorphicRelationId() const;
%Docstring
Returns the parent polymorphic relation id. If the relation is a normal
relation, a null string is returned.

.. versionadded:: 3.18
%End

    QgsPolymorphicRelation polymorphicRelation() const;
%Docstring
Returns the parent polymorphic relation. If the relation is a normal
relation, an invalid polymorphic relation is returned.

.. versionadded:: 3.18
%End

    Qgis::RelationshipType type() const;
%Docstring
Returns the type of the relation

.. versionadded:: 3.18
%End

    static QString cardinalityToDisplayString( Qgis::RelationshipCardinality cardinality );
%Docstring
Returns a user-friendly translated string representing a relationship
``cardinality``.

.. versionadded:: 3.28
%End

    static QString strengthToDisplayString( Qgis::RelationshipStrength strength );
%Docstring
Returns a user-friendly translated string representing a relationship
``strength``.

.. versionadded:: 3.28
%End

};


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