QGIS API Documentation  2.99.0-Master (08c2e66)
Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsVectorLayerJoinBuffer Class Reference

Manages joined fields for a vector layer. More...

#include <qgsvectorlayerjoinbuffer.h>

Inheritance diagram for QgsVectorLayerJoinBuffer:
Inheritance graph
[legend]

Signals

void joinedFieldsChanged ()
 Emitted whenever the list of joined fields changes (e.g. More...
 

Public Member Functions

 QgsVectorLayerJoinBuffer (QgsVectorLayer *layer=nullptr)
 
bool addJoin (const QgsVectorLayerJoinInfo &joinInfo)
 Joins another vector layer to this layer. More...
 
QgsVectorLayerJoinBufferclone () const
 Create a copy of the join buffer. More...
 
bool containsJoins () const
 Quick way to test if there is any join at all. More...
 
void createJoinCaches ()
 Calls cacheJoinLayer() for all vector joins. More...
 
int joinedFieldsOffset (const QgsVectorLayerJoinInfo *info, const QgsFields &fields)
 Find out what is the first index of the join within fields. More...
 
const QgsVectorLayerJoinInfojoinForFieldIndex (int index, const QgsFields &fields, int &sourceFieldIndex) const
 Finds the vector join for a layer field index. More...
 
void readXml (const QDomNode &layer_node)
 Reads joins from project file. More...
 
bool removeJoin (const QString &joinLayerId)
 Removes a vector layer join. More...
 
void resolveReferences (QgsProject *project)
 Resolves layer IDs of joined layers using given project's available layers. More...
 
void updateFields (QgsFields &fields)
 Updates field map with joined attributes. More...
 
const QgsVectorJoinListvectorJoins () const
 
void writeXml (QDomNode &layer_node, QDomDocument &document) const
 Saves mVectorJoins to xml under the layer node. More...
 

Static Public Member Functions

static QVector< int > joinSubsetIndices (QgsVectorLayer *joinLayer, const QStringList &joinFieldsSubset)
 Return a vector of indices for use in join based on field names from the layer. More...
 

Detailed Description

Manages joined fields for a vector layer.

Definition at line 33 of file qgsvectorlayerjoinbuffer.h.

Constructor & Destructor Documentation

QgsVectorLayerJoinBuffer::QgsVectorLayerJoinBuffer ( QgsVectorLayer layer = nullptr)

Definition at line 27 of file qgsvectorlayerjoinbuffer.cpp.

Member Function Documentation

bool QgsVectorLayerJoinBuffer::addJoin ( const QgsVectorLayerJoinInfo joinInfo)

Joins another vector layer to this layer.

Parameters
joinInfojoin object containing join layer id, target and source field
Returns
(since 2.6) whether the join was successfully added

Definition at line 61 of file qgsvectorlayerjoinbuffer.cpp.

QgsVectorLayerJoinBuffer * QgsVectorLayerJoinBuffer::clone ( ) const

Create a copy of the join buffer.

Note
added in 2.6

Definition at line 394 of file qgsvectorlayerjoinbuffer.cpp.

bool QgsVectorLayerJoinBuffer::containsJoins ( ) const
inline

Quick way to test if there is any join at all.

Definition at line 68 of file qgsvectorlayerjoinbuffer.h.

void QgsVectorLayerJoinBuffer::createJoinCaches ( )

Calls cacheJoinLayer() for all vector joins.

Definition at line 251 of file qgsvectorlayerjoinbuffer.cpp.

void QgsVectorLayerJoinBuffer::joinedFieldsChanged ( )
signal

Emitted whenever the list of joined fields changes (e.g.

added join or joined layer's fields change)

Note
added in 2.6
int QgsVectorLayerJoinBuffer::joinedFieldsOffset ( const QgsVectorLayerJoinInfo info,
const QgsFields fields 
)

Find out what is the first index of the join within fields.

Returns -1 if join is not present

Note
added in 2.6

Definition at line 359 of file qgsvectorlayerjoinbuffer.cpp.

const QgsVectorLayerJoinInfo * QgsVectorLayerJoinBuffer::joinForFieldIndex ( int  index,
const QgsFields fields,
int &  sourceFieldIndex 
) const

Finds the vector join for a layer field index.

Parameters
indexthis layers attribute index
fieldsfields of the vector layer (including joined fields)
sourceFieldIndexOutput: field's index in source layer

Definition at line 379 of file qgsvectorlayerjoinbuffer.cpp.

QVector< int > QgsVectorLayerJoinBuffer::joinSubsetIndices ( QgsVectorLayer joinLayer,
const QStringList &  joinFieldsSubset 
)
static

Return a vector of indices for use in join based on field names from the layer.

Note
added in 2.6

Definition at line 179 of file qgsvectorlayerjoinbuffer.cpp.

void QgsVectorLayerJoinBuffer::readXml ( const QDomNode &  layer_node)

Reads joins from project file.

Does not resolve layer IDs to layers - call resolveReferences() afterwards

Definition at line 302 of file qgsvectorlayerjoinbuffer.cpp.

bool QgsVectorLayerJoinBuffer::removeJoin ( const QString &  joinLayerId)

Removes a vector layer join.

Returns
true if join was found and successfully removed

Definition at line 96 of file qgsvectorlayerjoinbuffer.cpp.

void QgsVectorLayerJoinBuffer::resolveReferences ( QgsProject project)

Resolves layer IDs of joined layers using given project's available layers.

Note
added in 3.0

Definition at line 340 of file qgsvectorlayerjoinbuffer.cpp.

void QgsVectorLayerJoinBuffer::updateFields ( QgsFields fields)

Updates field map with joined attributes.

Parameters
fieldsmap to append joined attributes

Definition at line 200 of file qgsvectorlayerjoinbuffer.cpp.

const QgsVectorJoinList& QgsVectorLayerJoinBuffer::vectorJoins ( ) const
inline

Definition at line 70 of file qgsvectorlayerjoinbuffer.h.

void QgsVectorLayerJoinBuffer::writeXml ( QDomNode &  layer_node,
QDomDocument &  document 
) const

Saves mVectorJoins to xml under the layer node.

Definition at line 263 of file qgsvectorlayerjoinbuffer.cpp.


The documentation for this class was generated from the following files: