File: qgsweakrelation.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 (513 lines) | stat: -rw-r--r-- 15,181 bytes parent folder | download | duplicates (6)
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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsweakrelation.h                                           *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/


class QgsWeakRelation
{
%Docstring(signature="appended")
The :py:class:`QgsWeakRelation` class represent a
:py:class:`QgsRelation` with possibly unresolved layers or unmatched
fields.

This class is used to store relation information attached to a layer
style, a method to attempt relation resolution is also implemented and
can be used to create a :py:class:`QgsRelation` after the dependent
layers are loaded and available.

In contrast to :py:class:`QgsRelation`, :py:class:`QgsWeakRelation` can
be used to encapsulate information about a relationship which does not
currently exist in a QGIS project. E.g. it can be used to represent a
relationship which exists in a database backend (but not within a QGIS
project). Accordingly, some properties available in
:py:class:`QgsWeakRelation` are included for informational purposes
only, and cannot be translated to :py:class:`QgsRelations` or respected
in QGIS relationships.

.. versionadded:: 3.12
%End

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

    enum WeakRelationType /BaseType=IntEnum/
    {
      Referencing,
      Referenced
    };

    QgsWeakRelation();
%Docstring
Default constructor for an invalid relation.
%End

    QgsWeakRelation( const QString &relationId,
                     const QString &relationName,
                     const Qgis::RelationshipStrength strength,
                     const QString &referencingLayerId,
                     const QString &referencingLayerName,
                     const QString &referencingLayerSource,
                     const QString &referencingLayerProviderKey,
                     const QString &referencedLayerId,
                     const QString &referencedLayerName,
                     const QString &referencedLayerSource,
                     const QString &referencedLayerProviderKey
                   );
%Docstring
Creates a QgsWeakRelation.

.. versionadded:: 3.30
%End

    QList< QgsRelation > resolvedRelations( const QgsProject *project ) const;
%Docstring
Resolves a weak relation in the given ``project`` returning a list of
possibly invalid :py:class:`QgsRelations` and without performing any
kind of validity check.

.. note::

   Client code should never assume that the returned relations are valid and the
   layer components are not NULL.
%End

    QString id() const;
%Docstring
Returns the relationship's ID.

.. versionadded:: 3.28
%End

    QString name() const;
%Docstring
Returns the relationship's name.

.. versionadded:: 3.28
%End


    QString referencingLayerSource() const;
%Docstring
Returns the source URI for the referencing (or "child" / "right") layer.

.. seealso:: :py:func:`referencingLayerProvider`

.. seealso:: :py:func:`setReferencingLayer`

.. versionadded:: 3.28
%End

    QString referencingLayerProvider() const;
%Docstring
Returns the provider ID for the referencing (or "child" / "right")
layer.

.. seealso:: :py:func:`referencingLayerSource`

.. seealso:: :py:func:`setReferencingLayer`

.. versionadded:: 3.28
%End

    QString referencingLayerName() const;
%Docstring
Returns the layer name of the referencing (or "child" / "right") layer.

.. note::

   the layer name refers to the layer name used in the datasource, not in any associated
   :py:class:`QgsVectorLayer`.

.. versionadded:: 3.28
%End

    void setReferencingLayer( const QString &sourceUri, const QString &provider );
%Docstring
Sets the source for the referencing (or "child" / "right") layer, by
``sourceUri`` and ``provider`` ID.

.. seealso:: :py:func:`referencingLayerSource`

.. seealso:: :py:func:`referencingLayerProvider`

.. versionadded:: 3.36
%End


    QString referencedLayerSource() const;
%Docstring
Returns the source URI for the referenced (or "parent" / "left") layer.

.. seealso:: :py:func:`referencedLayerProvider`

.. seealso:: :py:func:`setReferencedLayer`

.. versionadded:: 3.28
%End

    QString referencedLayerProvider() const;
%Docstring
Returns the provider ID for the referenced (or "parent" / "left") layer.

.. seealso:: :py:func:`referencedLayerSource`

.. seealso:: :py:func:`setReferencedLayer`

.. versionadded:: 3.28
%End

    QString referencedLayerName() const;
%Docstring
Returns the layer name of the referenced (or "parent" / "left") layer.

.. note::

   the layer name refers to the layer name used in the datasource, not in any associated
   :py:class:`QgsVectorLayer`.

.. versionadded:: 3.28
%End

    void setReferencedLayer( const QString &sourceUri, const QString &provider );
%Docstring
Sets the source for the referenced (or "parent" / "left") layer, by
``sourceUri`` and ``provider`` ID.

.. seealso:: :py:func:`referencedLayerSource`

.. seealso:: :py:func:`referencedLayerProvider`

.. versionadded:: 3.36
%End



    QString mappingTableSource() const;
%Docstring
Returns the source URI for the mapping table, which forms the middle
table in many-to-many relationships.

.. seealso:: :py:func:`mappingTableProvider`

.. seealso:: :py:func:`setMappingTable`

.. versionadded:: 3.28
%End

    QString mappingTableProvider() const;
%Docstring
Returns the provider ID for the mapping table, which forms the middle
table in many-to-many relationships.

.. seealso:: :py:func:`mappingTableSource`

.. seealso:: :py:func:`setMappingTable`

.. versionadded:: 3.28
%End

    QString mappingTableName() const;
%Docstring
Returns the layer name of the mapping table, which forms the middle
table in many-to-many relationships.

.. note::

   the layer name refers to the layer name used in the datasource, not in any associated
   :py:class:`QgsVectorLayer`.

.. versionadded:: 3.28
%End

    void setMappingTable( const QString &sourceUri, const QString &provider );
%Docstring
Sets the source for the mapping table, which forms the middle table in
many-to-many relationships, by ``sourceUri`` and ``provider`` ID.

.. seealso:: :py:func:`mappingTableSource`

.. seealso:: :py:func:`mappingTableProvider`

.. versionadded:: 3.36
%End

    QStringList referencingLayerFields() const;
%Docstring
Returns the list of fields from the
:py:func:`~QgsWeakRelation.referencingLayer` involved in the
relationship.

.. versionadded:: 3.28
%End

    void setReferencingLayerFields( const QStringList &fields );
%Docstring
Sets the list of ``fields`` from the
:py:func:`~QgsWeakRelation.referencingLayer` involved in the
relationship.

.. versionadded:: 3.28
%End

    QStringList mappingReferencingLayerFields() const;
%Docstring
Returns the list of fields from the
:py:func:`~QgsWeakRelation.mappingTable` involved in the relationship.

These fields will be matched to the
:py:func:`~QgsWeakRelation.referencingLayerFields` in many-to-many
joins.

.. versionadded:: 3.28
%End

    void setMappingReferencingLayerFields( const QStringList &fields );
%Docstring
Sets the list of ``fields`` from the
:py:func:`~QgsWeakRelation.mappingTable` involved in the relationship.

These fields will be matched to the
:py:func:`~QgsWeakRelation.referencingLayerFields` in many-to-many
joins.

.. versionadded:: 3.28
%End

    QStringList referencedLayerFields() const;
%Docstring
Returns the list of fields from the
:py:func:`~QgsWeakRelation.referencedLayer` involved in the
relationship.

.. versionadded:: 3.28
%End

    void setReferencedLayerFields( const QStringList &fields );
%Docstring
Sets the list of ``fields`` from the
:py:func:`~QgsWeakRelation.referencedLayer` involved in the
relationship.

.. versionadded:: 3.28
%End

    QStringList mappingReferencedLayerFields() const;
%Docstring
Returns the list of fields from the
:py:func:`~QgsWeakRelation.mappingTable` involved in the relationship.

These fields will be matched to the
:py:func:`~QgsWeakRelation.referencedLayerFields` in many-to-many joins.

.. versionadded:: 3.28
%End

    void setMappingReferencedLayerFields( const QStringList &fields );
%Docstring
Sets the list of ``fields`` from the
:py:func:`~QgsWeakRelation.mappingTable` involved in the relationship.

These fields will be matched to the
:py:func:`~QgsWeakRelation.referencedLayerFields` in many-to-many joins.

.. versionadded:: 3.28
%End

    Qgis::RelationshipStrength strength() const;
%Docstring
Returns the strength of the relation.
%End

    Qgis::RelationshipCardinality cardinality() const;
%Docstring
Returns the relationship's cardinality.

.. seealso:: :py:func:`setCardinality`

.. versionadded:: 3.28
%End

    void setCardinality( Qgis::RelationshipCardinality cardinality );
%Docstring
Sets the relationship's ``cardinality``.

.. seealso:: :py:func:`cardinality`

.. versionadded:: 3.28
%End

    QString forwardPathLabel() const;
%Docstring
Returns the label of the forward path for the relationship.

The forward and backward path labels are free-form, user-friendly
strings which can be used to generate descriptions of the relationship
between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains
furniture, the forward path label could be "contains" and the backward
path label could be "is located within". A client could then generate a
user friendly description string such as "fire hose 1234 is located
within building 15a".

.. seealso:: :py:func:`setForwardPathLabel`

.. seealso:: :py:func:`backwardPathLabel`

.. versionadded:: 3.28
%End

    QString backwardPathLabel() const;
%Docstring
Returns the label of the backward path for the relationship.

The forward and backward path labels are free-form, user-friendly
strings which can be used to generate descriptions of the relationship
between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains
furniture, the forward path label could be "contains" and the backward
path label could be "is located within". A client could then generate a
user friendly description string such as "fire hose 1234 is located
within building 15a".

.. seealso:: :py:func:`setBackwardPathLabel`

.. seealso:: :py:func:`forwardPathLabel`

.. versionadded:: 3.28
%End

    void setForwardPathLabel( const QString &label );
%Docstring
Sets the ``label`` of the forward path for the relationship.

The forward and backward path labels are free-form, user-friendly
strings which can be used to generate descriptions of the relationship
between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains
furniture, the forward path label could be "contains" and the backward
path label could be "is located within". A client could then generate a
user friendly description string such as "fire hose 1234 is located
within building 15a".

.. seealso:: :py:func:`forwardPathLabel`

.. seealso:: :py:func:`setBackwardPathLabel`

.. versionadded:: 3.28
%End

    void setBackwardPathLabel( const QString &label );
%Docstring
Sets the ``label`` of the backward path for the relationship.

The forward and backward path labels are free-form, user-friendly
strings which can be used to generate descriptions of the relationship
between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains
furniture, the forward path label could be "contains" and the backward
path label could be "is located within". A client could then generate a
user friendly description string such as "fire hose 1234 is located
within building 15a".

.. seealso:: :py:func:`backwardPathLabel`

.. seealso:: :py:func:`setForwardPathLabel`

.. versionadded:: 3.28
%End

    QString relatedTableType() const;
%Docstring
Returns the type string of the related table.

This a free-form string representing the type of related features, where
the exact interpretation is format dependent. For instance, table types
from GeoPackage relationships will directly reflect the categories from
the GeoPackage related tables extension (i.e. "media", "simple
attributes", "features", "attributes" and "tiles").

.. seealso:: :py:func:`setRelatedTableType`

.. versionadded:: 3.28
%End

    void setRelatedTableType( const QString &type );
%Docstring
Sets the ``type`` string of the related table.

This a free-form string representing the type of related features, where
the exact interpretation is format dependent. For instance, table types
from GeoPackage relationships will directly reflect the categories from
the GeoPackage related tables extension (i.e. "media", "simple
attributes", "features", "attributes" and "tiles").

.. seealso:: :py:func:`relatedTableType`

.. versionadded:: 3.28
%End

    static QgsWeakRelation readXml( const QgsVectorLayer *layer, WeakRelationType type, const QDomNode &node, const QgsPathResolver resolver );
%Docstring
Returns a weak relation for the given layer.

:param layer: the layer of the weak relation
:param type: determines if the layer is referencing or referenced
:param node: the QDomNode
:param resolver: the path resolver

.. versionadded:: 3.16
%End

    static void writeXml( const QgsVectorLayer *layer, WeakRelationType type, const QgsRelation &relation, QDomNode &node, QDomDocument &doc );
%Docstring
Writes a weak relation infoto an XML structure. Used for saving .qgs
projects

:param layer: the layer which we save the weak relation for
:param type: determines if the layer is referencing or referenced
:param relation: the relation to save as a weak relation
:param node: The parent node in which the relation will be created
:param doc: The document in which the relation will be saved

.. versionadded:: 3.16
%End

    SIP_PYOBJECT __repr__();
%MethodCode

    QString leftIdentifier;
    if ( !sipCpp->referencedLayer().source.isEmpty() )
      leftIdentifier = sipCpp->referencedLayer().source;

    QString rightIdentifier;
    if ( !sipCpp->referencingLayer().source.isEmpty() )
      rightIdentifier = sipCpp->referencingLayer().source;

    QString str;
    if ( leftIdentifier.isEmpty() && rightIdentifier.isEmpty() )
      str = QStringLiteral( "<QgsWeakRelation: %1>" ).arg( sipCpp->id() );
    else
      str = QStringLiteral( "<QgsWeakRelation: %1 - %2 -> %3>" ).arg( sipCpp->id(), leftIdentifier, rightIdentifier );

    sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

};

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