QGIS API Documentation
2.12.0-Lyon
|
#include <qgsrelation.h>
Classes | |
class | FieldPair |
Defines a relation between matchin fields of the two involved tables of a relation. More... | |
Public Member Functions | |
QgsRelation () | |
Default constructor. More... | |
void | addFieldPair (const QString &referencingField, const QString &referencedField) |
Add a field pairs which is part of this relation The first element of each pair are the field names fo the foreign key. More... | |
void | addFieldPair (FieldPair fieldPair) |
Add a field pairs which is part of this relation The first element of each pair are the field names fo the foreign key. More... | |
QList< FieldPair > | fieldPairs () const |
Returns the field pairs which form this relation The first element of each pair are the field names fo the foreign key. More... | |
QgsFeature | getReferencedFeature (const QgsFeature &feature) const |
Creates a request to return the feature on the referenced (parent) layer which is referenced by the provided feature. More... | |
QgsFeatureRequest | getReferencedFeatureRequest (const QgsAttributes &attributes) const |
Creates a request to return the feature on the referenced (parent) layer which is referenced by the provided feature. More... | |
QgsFeatureRequest | getReferencedFeatureRequest (const QgsFeature &feature) const |
Creates a request to return the feature on the referenced (parent) layer which is referenced by the provided feature. More... | |
QgsFeatureIterator | getRelatedFeatures (const QgsFeature &feature) const |
Creates an iterator which returns all the features on the referencing (child) layer which have a foreign key pointing to the provided feature. More... | |
QgsFeatureRequest | getRelatedFeaturesRequest (const QgsFeature &feature) const |
Creates a request to return all the features on the referencing (child) layer which have a foreign key pointing to the provided feature. More... | |
QString | id () const |
A (project-wide) unique id for this relation. More... | |
bool | isValid () const |
Returns the validity of this relation. More... | |
QString | name () const |
Returns a human readable name for this relation. More... | |
QgsVectorLayer * | referencedLayer () const |
Access the referenced (parent) layer. More... | |
QString | referencedLayerId () const |
Access the referenced (parent) layer's id. More... | |
QgsVectorLayer * | referencingLayer () const |
Access the referencing (child) layer This is the layer which has the field(s) which point to another layer. More... | |
QString | referencingLayerId () const |
Access the referencing (child) layer's id This is the layer which has the field(s) which point to another layer. More... | |
void | setReferencedLayer (const QString &id) |
Set the referenced layer id. More... | |
void | setReferencingLayer (const QString &id) |
Set the referencing layer id. More... | |
void | setRelationId (const QString &id) |
Set a name for this relation. More... | |
void | setRelationName (const QString &name) |
Set a name for this relation. More... | |
void | writeXML (QDomNode &node, QDomDocument &doc) const |
Writes a relation to an XML structure. More... | |
Static Public Member Functions | |
static QgsRelation | createFromXML (const QDomNode &node) |
Creates a relation from an XML structure. More... | |
Protected Member Functions | |
void | updateRelationStatus () |
Definition at line 28 of file qgsrelation.h.
QgsRelation::QgsRelation | ( | ) |
void QgsRelation::addFieldPair | ( | const QString & | referencingField, |
const QString & | referencedField | ||
) |
Add a field pairs which is part of this relation The first element of each pair are the field names fo the foreign key.
The second element of each pair are the field names of the matching primary key.
referencingField | The field name on the referencing layer (FK) |
referencedField | The field name on the referenced layer (PK) |
Definition at line 135 of file qgsrelation.cpp.
void QgsRelation::addFieldPair | ( | QgsRelation::FieldPair | fieldPair | ) |
Add a field pairs which is part of this relation The first element of each pair are the field names fo the foreign key.
The second element of each pair are the field names of the matching primary key.
fieldPair | A pair of two strings |
Definition at line 141 of file qgsrelation.cpp.
|
static |
Creates a relation from an XML structure.
Used for reading .qgs projects.
node | The dom node containing the relation information |
Definition at line 30 of file qgsrelation.cpp.
QList< QgsRelation::FieldPair > QgsRelation::fieldPairs | ( | ) | const |
Returns the field pairs which form this relation The first element of each pair are the field names fo the foreign key.
The second element of each pair are the field names of the matching primary key.
Definition at line 258 of file qgsrelation.cpp.
QgsFeature QgsRelation::getReferencedFeature | ( | const QgsFeature & | feature | ) | const |
Creates a request to return the feature on the referenced (parent) layer which is referenced by the provided feature.
feature | A feature from the referencing (child) layer |
Definition at line 219 of file qgsrelation.cpp.
QgsFeatureRequest QgsRelation::getReferencedFeatureRequest | ( | const QgsAttributes & | attributes | ) | const |
Creates a request to return the feature on the referenced (parent) layer which is referenced by the provided feature.
attributes | An attribute vector containing the foreign key |
Definition at line 182 of file qgsrelation.cpp.
QgsFeatureRequest QgsRelation::getReferencedFeatureRequest | ( | const QgsFeature & | feature | ) | const |
Creates a request to return the feature on the referenced (parent) layer which is referenced by the provided feature.
feature | A feature from the referencing (child) layer |
Definition at line 214 of file qgsrelation.cpp.
QgsFeatureIterator QgsRelation::getRelatedFeatures | ( | const QgsFeature & | feature | ) | const |
Creates an iterator which returns all the features on the referencing (child) layer which have a foreign key pointing to the provided feature.
feature | A feature from the referenced (parent) layer |
Definition at line 147 of file qgsrelation.cpp.
QgsFeatureRequest QgsRelation::getRelatedFeaturesRequest | ( | const QgsFeature & | feature | ) | const |
Creates a request to return all the features on the referencing (child) layer which have a foreign key pointing to the provided feature.
feature | A feature from the referenced (parent) layer |
Definition at line 152 of file qgsrelation.cpp.
QString QgsRelation::id | ( | ) | const |
A (project-wide) unique id for this relation.
Definition at line 233 of file qgsrelation.cpp.
bool QgsRelation::isValid | ( | ) | const |
Returns the validity of this relation.
Don't use the information if it's not valid.
Definition at line 263 of file qgsrelation.cpp.
QString QgsRelation::name | ( | ) | const |
Returns a human readable name for this relation.
Mostly used as title for the children.
Definition at line 228 of file qgsrelation.cpp.
QgsVectorLayer * QgsRelation::referencedLayer | ( | ) | const |
Access the referenced (parent) layer.
Definition at line 253 of file qgsrelation.cpp.
QString QgsRelation::referencedLayerId | ( | ) | const |
Access the referenced (parent) layer's id.
Definition at line 248 of file qgsrelation.cpp.
QgsVectorLayer * QgsRelation::referencingLayer | ( | ) | const |
Access the referencing (child) layer This is the layer which has the field(s) which point to another layer.
Definition at line 243 of file qgsrelation.cpp.
QString QgsRelation::referencingLayerId | ( | ) | const |
Access the referencing (child) layer's id This is the layer which has the field(s) which point to another layer.
Definition at line 238 of file qgsrelation.cpp.
void QgsRelation::setReferencedLayer | ( | const QString & | id | ) |
Set the referenced layer id.
This layer will be searched in the registry.
id |
Definition at line 128 of file qgsrelation.cpp.
void QgsRelation::setReferencingLayer | ( | const QString & | id | ) |
Set the referencing layer id.
This layer will be searched in the registry.
id |
Definition at line 121 of file qgsrelation.cpp.
void QgsRelation::setRelationId | ( | const QString & | id | ) |
void QgsRelation::setRelationName | ( | const QString & | name | ) |
|
protected |
Definition at line 268 of file qgsrelation.cpp.
void QgsRelation::writeXML | ( | QDomNode & | node, |
QDomDocument & | doc | ||
) | const |
Writes a relation to an XML structure.
Used for saving .qgs projects
node | The parent node in which the relation will be created |
doc | The document in which the relation will be saved |
Definition at line 92 of file qgsrelation.cpp.