QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields. More...
#include <qgsweakrelation.h>
Public Types | |
enum | WeakRelationType { Referencing , Referenced } |
Enum to distinguish if the layer is referenced or referencing. More... | |
Public Member Functions | |
QgsWeakRelation (const QString &relationId, const QString &relationName, const QgsRelation::RelationStrength 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, const QList< QgsRelation::FieldPair > &fieldPairs) | |
Creates a QgsWeakRelation. More... | |
QList< QgsRelation::FieldPair > | fieldPairs () const |
Returns the list of field pairs. More... | |
QgsVectorLayerRef | referencedLayer () const |
Returns a weak reference to the referenced layer. More... | |
QgsVectorLayerRef | referencingLayer () const |
Returns a weak reference to the referencing layer. More... | |
QgsRelation | resolvedRelation (const QgsProject *project, QgsVectorLayerRef::MatchType matchType=QgsVectorLayerRef::MatchType::All) const |
Resolves a weak relation in the given project returning a possibly invalid QgsRelation and without performing any kind of validity check. More... | |
QgsRelation::RelationStrength | strength () const |
Returns the strength of the relation. More... | |
Static Public Member Functions | |
static QgsWeakRelation | readXml (const QgsVectorLayer *layer, WeakRelationType type, const QDomNode &node, const QgsPathResolver resolver) |
Returns a weak relation for the given layer. More... | |
static void | writeXml (const QgsVectorLayer *layer, WeakRelationType type, const QgsRelation &relation, QDomNode &node, QDomDocument &doc) |
Writes a weak relation infoto an XML structure. More... | |
Friends | |
class | TestQgsWeakRelation |
The QgsWeakRelation class represent a 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 QgsRelation after the dependent layers are loaded and available.
Definition at line 38 of file qgsweakrelation.h.
Enum to distinguish if the layer is referenced or referencing.
Enumerator | |
---|---|
Referencing | The layer is referencing. |
Referenced | The layer is referenced. |
Definition at line 46 of file qgsweakrelation.h.
QgsWeakRelation::QgsWeakRelation | ( | const QString & | relationId, |
const QString & | relationName, | ||
const QgsRelation::RelationStrength | 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, | ||
const QList< QgsRelation::FieldPair > & | fieldPairs | ||
) |
Creates a QgsWeakRelation.
Definition at line 22 of file qgsweakrelation.cpp.
QList< QgsRelation::FieldPair > QgsWeakRelation::fieldPairs | ( | ) | const |
Returns the list of field pairs.
Definition at line 75 of file qgsweakrelation.cpp.
|
static |
Returns a weak relation for the given layer.
layer | the layer of the weak relation |
type | determines if the layer is referencing or referenced |
node | the QDomNode |
resolver | the path resolver |
Definition at line 80 of file qgsweakrelation.cpp.
QgsVectorLayerRef QgsWeakRelation::referencedLayer | ( | ) | const |
Returns a weak reference to the referenced layer.
Definition at line 65 of file qgsweakrelation.cpp.
QgsVectorLayerRef QgsWeakRelation::referencingLayer | ( | ) | const |
Returns a weak reference to the referencing layer.
Definition at line 60 of file qgsweakrelation.cpp.
QgsRelation QgsWeakRelation::resolvedRelation | ( | const QgsProject * | project, |
QgsVectorLayerRef::MatchType | matchType = QgsVectorLayerRef::MatchType::All |
||
) | const |
Resolves a weak relation in the given project returning a possibly invalid QgsRelation and without performing any kind of validity check.
Definition at line 35 of file qgsweakrelation.cpp.
QgsRelation::RelationStrength QgsWeakRelation::strength | ( | ) | const |
Returns the strength of the relation.
Definition at line 70 of file qgsweakrelation.cpp.
|
static |
Writes a weak relation infoto an XML structure.
Used for saving .qgs projects
layer | the layer which we save the weak relation for |
type | determines if the layer is referencing or referenced |
relation | the relation to save as a weak relation |
node | The parent node in which the relation will be created |
doc | The document in which the relation will be saved |
Definition at line 139 of file qgsweakrelation.cpp.
|
friend |
Definition at line 130 of file qgsweakrelation.h.