#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.
|
void | writeXML (QDomNode &node, QDomDocument &doc) const |
| Writes a relation to an XML structure.
|
void | setRelationId (QString id) |
| Set a name for this relation.
|
void | setRelationName (QString name) |
| Set a name for this relation.
|
void | setReferencingLayer (QString id) |
| Set the referencing layer id.
|
void | setReferencedLayer (QString id) |
| Set the referenced layer id.
|
void | addFieldPair (QString referencingField, 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.
|
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.
|
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.
|
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.
|
const QString | name () const |
const QString & | id () const |
| The id.
|
QString | referencingLayerId () const |
| Access the referencing (child) layer's id This is the layer which has the field(s) which point to another layer.
|
QgsVectorLayer * | referencingLayer () const |
| Access the referencing (child) layer This is the layer which has the field(s) which point to another layer.
|
QString | referencedLayerId () const |
| Access the referenced (parent) layer's id.
|
QgsVectorLayer * | referencedLayer () const |
| Access the referenced (parent) layer.
|
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.
|
bool | isValid () const |
| Returns the validity of this relation.
|
Static Public Member Functions |
static QgsRelation | createFromXML (const QDomNode &node) |
| Creates a relation from an XML structure.
|
Constructor & Destructor Documentation
QgsRelation::QgsRelation |
( |
| ) |
|
Default constructor.
Creates an invalid relation.
Member Function Documentation
void QgsRelation::addFieldPair |
( |
QString |
referencingField, |
|
|
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.
- Parameters
-
referencingField | The field name on the referencing layer (FK) |
referencedField | The field name on the referenced layer (PK) |
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.
- Parameters
-
fieldPair | A pair of two strings |
- Note
- not available in python bindings
QgsRelation QgsRelation::createFromXML |
( |
const QDomNode & |
node | ) |
|
|
static |
Creates a relation from an XML structure.
Used for reading .qgs projects.
- Parameters
-
node | The dom node containing the relation information |
- Returns
- A relation
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.
- Returns
- The fields forming the relation
Creates an iterator which returns all the features on the referencing (child) layer which have a foreign key pointing to the provided feature.
- Parameters
-
feature | A feature from the referenced (parent) layer |
- Returns
- An iterator with all the referenced features
Creates a request to return all the features on the referencing (child) layer which have a foreign key pointing to the provided feature.
- Parameters
-
feature | A feature from the referenced (parent) layer |
- Returns
- An request for all the referenced features
const QString & QgsRelation::id |
( |
| ) |
const |
bool QgsRelation::isValid |
( |
| ) |
const |
Returns the validity of this relation.
Don't use the information if it's not valid.
- Returns
- true if the relation is valid
const QString QgsRelation::name |
( |
| ) |
const |
Access the referenced (parent) layer.
- Returns
- referenced layer
QString QgsRelation::referencedLayerId |
( |
| ) |
const |
Access the referenced (parent) layer's id.
- Returns
- The id of the referenced layer
Access the referencing (child) layer This is the layer which has the field(s) which point to another layer.
- Returns
- The referencing layer
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.
- Returns
- The id of the referencing layer
void QgsRelation::runChecks |
( |
| ) |
|
|
protected |
void QgsRelation::setReferencedLayer |
( |
QString |
id | ) |
|
Set the referenced layer id.
This layer will be searched in the registry.
- Parameters
-
void QgsRelation::setReferencingLayer |
( |
QString |
id | ) |
|
Set the referencing layer id.
This layer will be searched in the registry.
- Parameters
-
void QgsRelation::setRelationId |
( |
QString |
id | ) |
|
Set a name for this relation.
- Parameters
-
void QgsRelation::setRelationName |
( |
QString |
name | ) |
|
Set a name for this relation.
- Parameters
-
void QgsRelation::updateRelationStatus |
( |
| ) |
|
|
protected |
void QgsRelation::writeXML |
( |
QDomNode & |
node, |
|
|
QDomDocument & |
doc |
|
) |
| const |
Writes a relation to an XML structure.
Used for saving .qgs projects
- Parameters
-
node | The parent node in which the relation will be created |
doc | The document in which the relation will be saved |
The documentation for this class was generated from the following files: