QGIS/python/core/qgsrelation.sip

86 lines
3.1 KiB
Plaintext
Raw Normal View History

2013-10-04 14:47:59 +02:00
/***************************************************************************
qgsrelation.sip
--------------------------------------
Date : 29.4.2013
Copyright : (C) 2013 Matthias Kuhn
2015-08-30 12:59:30 +02:00
Email : matthias at opengis dot ch
2013-10-04 14:47:59 +02:00
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsRelation
{
%TypeHeaderCode
#include <qgsrelation.h>
%End
public:
QgsRelation();
static QgsRelation createFromXml( const QDomNode& node );
2013-10-04 14:47:59 +02:00
void writeXml( QDomNode& node, QDomDocument& doc ) const;
2013-10-04 14:47:59 +02:00
void setId( const QString& id );
2013-10-04 14:47:59 +02:00
void setName( const QString& name );
2013-10-04 14:47:59 +02:00
void setReferencingLayer( const QString& id );
2013-10-04 14:47:59 +02:00
void setReferencedLayer( const QString& id );
void addFieldPair( const QString& referencingField, const QString& referencedField );
// void addFieldPair( const FieldPair& fieldPair );
2014-05-27 23:22:50 +02:00
2013-10-04 14:47:59 +02:00
QgsFeatureIterator getRelatedFeatures( const QgsFeature& feature ) const;
QgsFeatureRequest getRelatedFeaturesRequest( const QgsFeature& feature ) const;
QString getRelatedFeaturesFilter( const QgsFeature& feature ) const;
2016-02-14 03:50:23 +01:00
QgsFeatureRequest getReferencedFeatureRequest( const QgsAttributes& attributes ) const;
QgsFeatureRequest getReferencedFeatureRequest( const QgsFeature& feature ) const;
2016-02-14 03:50:23 +01:00
QgsFeature getReferencedFeature( const QgsFeature& feature ) const;
QString name() const;
QString id() const;
2013-10-04 14:47:59 +02:00
void generateId();
2013-10-04 14:47:59 +02:00
QString referencingLayerId() const;
QgsVectorLayer* referencingLayer() const;
QString referencedLayerId() const;
QgsVectorLayer* referencedLayer() 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.
*
* @return The fields forming the relation
*/
QMap< QString, QString > fieldPairs() const;
%MethodCode
const QList< QgsRelation::FieldPair >& pairs = sipCpp->fieldPairs();
sipRes = new QMap< QString, QString >();
2013-10-04 14:47:59 +02:00
Q_FOREACH( const QgsRelation::FieldPair& pair, pairs )
{
sipRes->insert( pair.first, pair.second );
}
%End
2015-11-30 14:42:29 +01:00
QgsAttributeList referencedFields() const;
QgsAttributeList referencingFields() const;
2013-10-04 14:47:59 +02:00
bool isValid() const;
bool hasEqualDefinition( const QgsRelation& other ) const;
2017-02-20 09:00:50 +01:00
QString resolveReferencedField( const QString& referencingField ) const;
QString resolveReferencingField( const QString& referencedField ) const;
2013-10-04 14:47:59 +02:00
};