QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsweakrelation.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsweakrelation.h - QgsWeakRelation
3 
4  ---------------------
5  begin : 5.12.2019
6  copyright : (C) 2019 by Alessandro Pasotti
7  email : elpaso at itopen dot it
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSWEAKRELATION_H
17 #define QGSWEAKRELATION_H
18 
19 #define SIP_NO_FILE
20 
21 #include "qgis_core.h"
22 #include "qgsrelation.h"
23 #include "qgsvectorlayerref.h"
24 
38 class CORE_EXPORT QgsWeakRelation
39 {
40  public:
41 
45  QgsWeakRelation( const QString &relationId,
46  const QString &relationName,
47  const QgsRelation::RelationStrength strength,
48  const QString &referencingLayerId,
49  const QString &referencingLayerName,
50  const QString &referencingLayerSource,
51  const QString &referencingLayerProviderKey,
52  const QString &referencedLayerId,
53  const QString &referencedLayerName,
54  const QString &referencedLayerSource,
55  const QString &referencedLayerProviderKey,
56  const QList<QgsRelation::FieldPair> &fieldPairs
57  );
58 
66  QgsRelation resolvedRelation( const QgsProject *project, QgsVectorLayerRef::MatchType matchType = QgsVectorLayerRef::MatchType::All ) const;
67 
71  QgsVectorLayerRef referencingLayer() const;
72 
76  QgsVectorLayerRef referencedLayer() const;
77 
81  QgsRelation::RelationStrength strength() const;
82 
86  QList<QgsRelation::FieldPair> fieldPairs() const;
87 
88  private:
89 
90  QgsVectorLayerRef mReferencingLayer;
91  QgsVectorLayerRef mReferencedLayer;
92  QString mRelationId;
93  QString mRelationName;
94  QgsRelation::RelationStrength mStrength = QgsRelation::RelationStrength::Association;
95  QList<QgsRelation::FieldPair> mFieldPairs;
96 
97  friend class TestQgsWeakRelation;
98 
99 };
100 
101 #endif // QGSWEAKRELATION_H
QgsProject
Definition: qgsproject.h:92
qgsrelation.h
_LayerRef< QgsVectorLayer >::MatchType
MatchType
Flag for match type in weak resolution.
Definition: qgsmaplayerref.h:40
qgsvectorlayerref.h
QgsRelation
Definition: qgsrelation.h:41
QgsRelation::RelationStrength
RelationStrength
enum for the relation strength Association, Composition
Definition: qgsrelation.h:57
_LayerRef< QgsVectorLayer >
QgsWeakRelation
The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields...
Definition: qgsweakrelation.h:38