QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
QgsVectorLayerJoinBuffer Class Reference

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

#include <qgsvectorlayerjoinbuffer.h>

Public Member Functions

 QgsVectorLayerJoinBuffer ()
 ~QgsVectorLayerJoinBuffer ()
void addJoin (const QgsVectorJoinInfo &joinInfo)
 Joins another vector layer to this layer.
void removeJoin (const QString &joinLayerId)
 Removes a vector layer join.
void updateFields (QgsFields &fields)
 Updates field map with joined attributes.
void createJoinCaches ()
 Calls cacheJoinLayer() for all vector joins.
void writeXml (QDomNode &layer_node, QDomDocument &document) const
 Saves mVectorJoins to xml under the layer node.
void readXml (const QDomNode &layer_node)
 Reads joins from project file.
bool containsJoins () const
 Quick way to test if there is any join at all.
const QList< QgsVectorJoinInfo > & vectorJoins () const
const QgsVectorJoinInfojoinForFieldIndex (int index, const QgsFields &fields, int &sourceFieldIndex) const
 Finds the vector join for a layer field index.

Private Member Functions

void cacheJoinLayer (QgsVectorJoinInfo &joinInfo)
 Caches attributes of join layer in memory if QgsVectorJoinInfo.memoryCache is true (and the cache is not already there)

Private Attributes

QList< QgsVectorJoinInfomVectorJoins
 Joined vector layers.

Detailed Description

Manages joined fields for a vector layer.

Definition at line 31 of file qgsvectorlayerjoinbuffer.h.

Constructor & Destructor Documentation

QgsVectorLayerJoinBuffer::QgsVectorLayerJoinBuffer ( )

Definition at line 25 of file qgsvectorlayerjoinbuffer.cpp.

QgsVectorLayerJoinBuffer::~QgsVectorLayerJoinBuffer ( )

Definition at line 29 of file qgsvectorlayerjoinbuffer.cpp.

Member Function Documentation

void QgsVectorLayerJoinBuffer::addJoin ( const QgsVectorJoinInfo joinInfo)

Joins another vector layer to this layer.

Parameters
joinInfojoin object containing join layer id, target and source field

Definition at line 33 of file qgsvectorlayerjoinbuffer.cpp.

References cacheJoinLayer(), QgsVectorJoinInfo::memoryCache, and mVectorJoins.

Referenced by QgsVectorLayer::addJoin(), and readXml().

void QgsVectorLayerJoinBuffer::cacheJoinLayer ( QgsVectorJoinInfo joinInfo)
private
bool QgsVectorLayerJoinBuffer::containsJoins ( ) const
inline
void QgsVectorLayerJoinBuffer::createJoinCaches ( )

Calls cacheJoinLayer() for all vector joins.

Definition at line 115 of file qgsvectorlayerjoinbuffer.cpp.

References cacheJoinLayer(), and mVectorJoins.

Referenced by QgsVectorLayer::createJoinCaches().

const QgsVectorJoinInfo * 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 174 of file qgsvectorlayerjoinbuffer.cpp.

References QgsFields::fieldOrigin(), QgsFields::fieldOriginIndex(), mVectorJoins, and QgsFields::OriginJoin.

Referenced by QgsVectorLayer::maximumValue(), QgsVectorLayer::minimumValue(), QgsVectorLayerFeatureIterator::prepareJoins(), and QgsVectorLayer::uniqueValues().

void QgsVectorLayerJoinBuffer::readXml ( const QDomNode &  layer_node)
void QgsVectorLayerJoinBuffer::removeJoin ( const QString &  joinLayerId)

Removes a vector layer join.

Definition at line 44 of file qgsvectorlayerjoinbuffer.cpp.

References mVectorJoins.

Referenced by QgsVectorLayer::removeJoin().

void QgsVectorLayerJoinBuffer::updateFields ( QgsFields fields)
const QList< QgsVectorJoinInfo >& QgsVectorLayerJoinBuffer::vectorJoins ( ) const
inline

Definition at line 61 of file qgsvectorlayerjoinbuffer.h.

Referenced by QgsVectorLayer::vectorJoins().

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

Saves mVectorJoins to xml under the layer node.

Definition at line 125 of file qgsvectorlayerjoinbuffer.cpp.

References mVectorJoins.

Referenced by QgsVectorLayer::writeXml().

Member Data Documentation

QList< QgsVectorJoinInfo > QgsVectorLayerJoinBuffer::mVectorJoins
private

Joined vector layers.

Definition at line 72 of file qgsvectorlayerjoinbuffer.h.

Referenced by addJoin(), createJoinCaches(), joinForFieldIndex(), readXml(), removeJoin(), updateFields(), and writeXml().


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