2012-09-24 02:28:15 +02:00
|
|
|
class QgsVectorLayerJoinBuffer
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsvectorlayerjoinbuffer.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
QgsVectorLayerJoinBuffer();
|
|
|
|
~QgsVectorLayerJoinBuffer();
|
|
|
|
|
|
|
|
/**Joins another vector layer to this layer
|
|
|
|
@param joinInfo join object containing join layer id, target and source field */
|
|
|
|
void addJoin( QgsVectorJoinInfo joinInfo );
|
|
|
|
|
|
|
|
/**Removes a vector layer join*/
|
|
|
|
void removeJoin( const QString& joinLayerId );
|
|
|
|
|
|
|
|
/**Creates QgsVectorLayerJoinBuffer for the joins containing attributes to fetch*/
|
|
|
|
void select( const QgsAttributeList& fetchAttributes,
|
2012-10-20 22:19:55 +02:00
|
|
|
QgsAttributeList& sourceJoinFields, int providerFieldCount );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
/**Updates field map with joined attributes
|
|
|
|
@param fields map to append joined attributes
|
2012-10-20 22:19:55 +02:00
|
|
|
*/
|
|
|
|
void updateFields( QgsFields& fields );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
/**Update feature with uncommited attribute updates and joined attributes*/
|
2012-10-20 22:19:55 +02:00
|
|
|
void updateFeatureAttributes( QgsFeature &f, int providerFieldCount, bool all = false );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
/**Calls cacheJoinLayer() for all vector joins*/
|
|
|
|
void createJoinCaches();
|
|
|
|
|
|
|
|
/**Saves mVectorJoins to xml under the layer node*/
|
|
|
|
void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
|
|
|
|
|
|
|
|
/**Reads joins from project file*/
|
|
|
|
void readXml( const QDomNode& layer_node );
|
|
|
|
|
|
|
|
/**Quick way to test if there is any join at all*/
|
|
|
|
bool containsJoins() const;
|
|
|
|
/**Quick way to test if there is a join to be fetched*/
|
|
|
|
bool containsFetchJoins() const;
|
|
|
|
|
|
|
|
const QList< QgsVectorJoinInfo >& vectorJoins() const;
|
|
|
|
|
|
|
|
/**Finds the vector join for a layer field index.
|
|
|
|
@param index this layers attribute index
|
|
|
|
@param maxProviderIndex maximum attribute index of the vectorlayer provider
|
|
|
|
@param indexOffset out: offset between layer index and original provider index
|
|
|
|
@return pointer to the join if the index belongs to a joined field, otherwise 0 (possibily provider field or added field)*/
|
2012-10-20 22:19:55 +02:00
|
|
|
const QgsVectorJoinInfo* joinForFieldIndex( int index, int providerFieldCount, int& indexOffset ) const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
};
|