QGIS/python/core/auto_generated/qgsrelation.sip.in

305 lines
8.1 KiB
Plaintext
Raw Normal View History

2017-04-19 11:17:49 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrelation.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2013-10-04 14:47:59 +02:00
class QgsRelation
{
2017-04-19 11:17:49 +02:00
2013-10-04 14:47:59 +02:00
%TypeHeaderCode
2017-04-19 11:17:49 +02:00
#include "qgsrelation.h"
2013-10-04 14:47:59 +02:00
%End
public:
enum RelationStrength
{
Association,
Composition
};
2017-04-19 11:17:49 +02:00
2013-10-04 14:47:59 +02:00
QgsRelation();
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Default constructor. Creates an invalid relation.
2017-04-19 11:17:49 +02:00
%End
static QgsRelation createFromXml( const QDomNode &node );
%Docstring
2017-12-15 10:36:55 -04:00
Creates a relation from an XML structure. Used for reading .qgs projects.
2017-04-19 11:17:49 +02:00
2017-12-15 10:36:55 -04:00
:param node: The dom node containing the relation information
:return: A relation
2017-04-19 11:17:49 +02:00
%End
void writeXml( QDomNode &node, QDomDocument &doc ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Writes a relation to an XML structure. Used for saving .qgs projects
2017-04-19 11:17:49 +02:00
2017-12-15 10:36:55 -04:00
:param node: The parent node in which the relation will be created
:param doc: The document in which the relation will be saved
2017-04-19 11:17:49 +02:00
%End
void setId( const QString &id );
%Docstring
2017-12-15 10:36:55 -04:00
Set an id for this relation
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
2017-04-19 11:17:49 +02:00
void setName( const QString &name );
%Docstring
2017-12-15 10:36:55 -04:00
Set a name for this relation
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
void setStrength( RelationStrength strength );
%Docstring
2017-12-15 10:36:55 -04:00
Set a strength for this relation
.. versionadded:: 3.0
%End
2017-04-19 11:17:49 +02:00
void setReferencingLayer( const QString &id );
%Docstring
2017-12-15 10:36:55 -04:00
Set the referencing (child) layer id. This layer will be searched in the registry.
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
2017-04-19 11:17:49 +02:00
void setReferencedLayer( const QString &id );
%Docstring
2017-12-15 10:36:55 -04:00
Set the referenced (parent) layer id. This layer will be searched in the registry.
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
2017-04-19 11:17:49 +02:00
void addFieldPair( const QString &referencingField, const QString &referencedField );
%Docstring
2017-12-15 10:36:55 -04:00
Add a field pairs which is part of this relation
The first element of each pair are the field names of the foreign key.
The second element of each pair are the field names of the matching primary key.
2014-05-27 23:22:50 +02:00
2017-12-15 10:36:55 -04:00
:param referencingField: The field name on the referencing (child) layer (FK)
:param referencedField: The field name on the referenced (parent) layer (PK)
2017-04-19 11:17:49 +02:00
%End
QgsFeatureIterator getRelatedFeatures( const QgsFeature &feature ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Creates an iterator which returns all the features on the referencing (child) layer
which have a foreign key pointing to the provided feature.
:param feature: A feature from the referenced (parent) layer
:return: An iterator with all the referenced features
2017-04-19 11:17:49 +02:00
.. seealso:: :py:func:`getRelatedFeaturesRequest`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`getRelatedFeaturesFilter`
2017-04-19 11:17:49 +02:00
%End
QgsFeatureRequest getRelatedFeaturesRequest( const QgsFeature &feature ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Creates a request to return all the features on the referencing (child) layer
which have a foreign key pointing to the provided feature.
:param feature: A feature from the referenced (parent) layer
:return: A request for all the referencing features
2017-04-19 11:17:49 +02:00
.. seealso:: :py:func:`getRelatedFeatures`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`getRelatedFeaturesFilter`
2017-04-19 11:17:49 +02:00
%End
QString getRelatedFeaturesFilter( const QgsFeature &feature ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns a filter expression which returns all the features on the referencing (child) layer
which have a foreign key pointing to the provided feature.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param feature: A feature from the referenced (parent) layer
:return: expression filter string for all the referencing features
2017-04-19 11:17:49 +02:00
.. versionadded:: 2.16
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`getRelatedFeatures`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`getRelatedFeaturesRequest`
2017-04-19 11:17:49 +02:00
%End
QgsFeatureRequest getReferencedFeatureRequest( const QgsAttributes &attributes ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Creates a request to return the feature on the referenced (parent) layer
which is referenced by the provided feature.
:param attributes: An attribute vector containing the foreign key
:return: A request the referenced feature
2017-04-19 11:17:49 +02:00
.. note::
not available in Python bindings
%End
QgsFeatureRequest getReferencedFeatureRequest( const QgsFeature &feature ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Creates a request to return the feature on the referenced (parent) layer
which is referenced by the provided feature.
:param feature: A feature from the referencing (child) layer
2017-04-19 11:17:49 +02:00
2017-12-15 10:36:55 -04:00
:return: A request the referenced feature
2017-04-19 11:17:49 +02:00
%End
QgsFeature getReferencedFeature( const QgsFeature &feature ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Creates a request to return the feature on the referenced (parent) layer
which is referenced by the provided feature.
2017-04-19 11:17:49 +02:00
2017-12-15 10:36:55 -04:00
:param feature: A feature from the referencing (child) layer
:return: A request the referenced feature
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
QString name() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a human readable name for this relation. Mostly used as title for the children.
.. seealso:: :py:func:`id`
2017-04-19 11:17:49 +02:00
2017-12-15 10:36:55 -04:00
:return: A name
2017-04-19 11:17:49 +02:00
%End
RelationStrength strength() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the relation strength as a string
:return: strength
.. versionadded:: 3.0
%End
QString id() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A (project-wide) unique id for this relation
:return: The id
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
void generateId();
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Generate a (project-wide) unique id for this relation
2017-04-19 11:17:49 +02:00
.. versionadded:: 3.0
%End
2013-10-04 14:47:59 +02:00
QString referencingLayerId() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Access the referencing (child) layer's id
This is the layer which has the field(s) which point to another layer
:return: The id of the referencing layer
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
2017-04-19 11:17:49 +02:00
QgsVectorLayer *referencingLayer() const;
%Docstring
2017-12-15 10:36:55 -04:00
Access the referencing (child) layer
This is the layer which has the field(s) which point to another layer
:return: The referencing layer
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
QString referencedLayerId() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Access the referenced (parent) layer's id
:return: The id of the referenced layer
2017-04-19 11:17:49 +02:00
%End
QgsVectorLayer *referencedLayer() const;
%Docstring
2017-12-15 10:36:55 -04:00
Access the referenced (parent) layer
:return: referenced layer
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
QMap< QString, QString > fieldPairs() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the field pairs which form this relation
The first element of each pair are the field names of the foreign key.
The second element of each pair are the field names of the matching primary key.
:return: The fields forming the relation
2017-04-19 11:17:49 +02:00
%End
2013-10-04 14:47:59 +02:00
%MethodCode
2017-04-19 11:17:49 +02:00
const QList< QgsRelation::FieldPair > &pairs = sipCpp->fieldPairs();
sipRes = new QMap< QString, QString >();
for ( const QgsRelation::FieldPair &pair : pairs )
2013-10-04 14:47:59 +02:00
{
2017-04-19 11:17:49 +02:00
sipRes->insert( pair.first, pair.second );
2013-10-04 14:47:59 +02:00
}
%End
2015-11-30 14:42:29 +01:00
QgsAttributeList referencedFields() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a list of attributes used to form the referenced fields
(most likely primary key) on the referenced (parent) layer.
:return: A list of attributes
2017-04-19 11:17:49 +02:00
%End
2015-11-30 14:42:29 +01:00
QgsAttributeList referencingFields() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a list of attributes used to form the referencing fields
(foreign key) on the referencing (child) layer.
:return: A list of attributes
2017-04-19 11:17:49 +02:00
%End
2015-11-30 14:42:29 +01:00
2013-10-04 14:47:59 +02:00
bool isValid() const;
2017-04-19 11:17:49 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the validity of this relation. Don't use the information if it's not valid.
:return: true if the relation is valid
2017-04-19 11:17:49 +02:00
%End
bool hasEqualDefinition( const QgsRelation &other ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Compares the two QgsRelation, ignoring the name and the ID.
:param other: The other relation
:return: true if they are similar
2017-04-19 11:17:49 +02:00
.. versionadded:: 3.0
%End
QString resolveReferencedField( const QString &referencingField ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Get the referenced field counterpart given a referencing field.
2017-04-19 11:17:49 +02:00
.. versionadded:: 3.0
%End
QString resolveReferencingField( const QString &referencedField ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Get the referencing field counterpart given a referenced field.
2017-04-19 11:17:49 +02:00
.. versionadded:: 3.0
%End
2013-10-04 14:47:59 +02:00
};
2017-04-19 11:17:49 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrelation.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/