Skip to content
Permalink
Browse files

Added missing python bindings for table joins

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15327 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Mar 3, 2011
1 parent a8f8dcd commit 797529514e193cd0e033b26cc83d13ab1c5359b4
Showing with 64 additions and 10 deletions.
  1. +47 −1 python/core/qgsvectorlayer.sip
  2. +17 −9 src/core/qgsvectorlayer.h
@@ -4,6 +4,27 @@ typedef QSet<int> QgsFeatureIds;
typedef QSet<int> QgsAttributeIds;


/** @note added in 1.7 */
struct QgsVectorJoinInfo
{
%TypeHeaderCode
#include "qgsvectorlayer.h"
%End

/**Join field in the target layer*/
int targetField;
/**Source layer*/
QString joinLayerId;
/**Join field in the source layer*/
int joinField;
/**True if the join is cached in virtual memory*/
bool memoryCache;
/**Cache for joined attributes to provide fast lookup (size is 0 if no memory caching)*/
// TODO: needs conversion
// QHash< QString, QgsAttributeMap> cachedAttributes;
};


class QgsVectorLayer : QgsMapLayer
{
%TypeHeaderCode
@@ -88,6 +109,19 @@ public:
/** Setup the coordinate system tranformation for the layer */
void setCoordinateSystem();

/** Joins another vector layer to this layer
@param joinInfo join object containing join layer id, target and source field
@param cacheInMemory if true: caches the content of the join layer in virtual memory
@note added in 1.7 */
void addJoin( QgsVectorJoinInfo joinInfo );

/** Removes a vector layer join
@note added in 1.7 */
void removeJoin( const QString& joinLayerId );

/** @note added in 1.7 */
const QList< QgsVectorJoinInfo >& vectorJoins() const;

QgsLabel *label();

QgsAttributeAction *actions();
@@ -549,12 +583,20 @@ public:
@note public and static from version 1.4 */
static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );

/** Assembles mUpdatedFields considering provider fields, joined fields and added fields
@note added in 1.7 */
void updateFieldMap();

/** Caches joined attributes if required (and not already done)
@note added in 1.7 */
void createJoinCaches();

/**Returns unique values for column
@param index column index for attribute
@param uniqueValues out: result list
@limit maximum number of values to return (-1 if unlimited)
@note: this method was added in version 1.7*/
void uniqueValues( int index, QList<QVariant>& uniqueValues, int limit );
void uniqueValues( int index, QList<QVariant>& uniqueValues /Out/, int limit );

public slots:

@@ -574,6 +616,10 @@ public slots:
*/
virtual void updateExtents();

/** Check if there is a join with a layer that will be removed
@note added in 1.7 */
void checkJoinLayerRemove( QString theLayerId );

signals:

/** This signal is emited when selection was changed */
@@ -55,6 +55,7 @@ typedef QList<int> QgsAttributeList;
typedef QSet<int> QgsFeatureIds;
typedef QSet<int> QgsAttributeIds;

/** @note added in 1.7 */
struct CORE_EXPORT QgsVectorJoinInfo
{
/**Join field in the target layer*/
@@ -69,8 +70,10 @@ struct CORE_EXPORT QgsVectorJoinInfo
QHash< QString, QgsAttributeMap> cachedAttributes;
};

/**Join information prepared for fast attribute id mapping in QgsVectorLayerJoinBuffer::updateFeatureAttributes().
Created in the select() method of QgsVectorLayerJoinBuffer for the joins that contain fetched attributes*/
/** Join information prepared for fast attribute id mapping in QgsVectorLayerJoinBuffer::updateFeatureAttributes().
Created in the select() method of QgsVectorLayerJoinBuffer for the joins that contain fetched attributes
@note added in 1.7
*/
struct CORE_EXPORT QgsFetchJoinInfo
{
const QgsVectorJoinInfo* joinInfo;
@@ -150,14 +153,17 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Setup the coordinate system tranformation for the layer */
void setCoordinateSystem();

/**Joins another vector layer to this layer
/** Joins another vector layer to this layer
@param joinInfo join object containing join layer id, target and source field
@param cacheInMemory if true: caches the content of the join layer in virtual memory*/
@param cacheInMemory if true: caches the content of the join layer in virtual memory
@note added in 1.7 */
void addJoin( QgsVectorJoinInfo joinInfo );

/**Removes a vector layer join*/
/** Removes a vector layer join
@note added in 1.7 */
void removeJoin( const QString& joinLayerId );

/** @note added in 1.7 */
const QList< QgsVectorJoinInfo >& vectorJoins() const;

/** Get the label object associated with this layer */
@@ -631,11 +637,12 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
@note public and static from version 1.4 */
static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );

/**Assembles mUpdatedFields considering provider fields, joined fields and added fields
@note added in version 1.6*/
/** Assembles mUpdatedFields considering provider fields, joined fields and added fields
@note added in 1.7 */
void updateFieldMap();

/**Caches joined attributes if required (and not already done)*/
/** Caches joined attributes if required (and not already done)
@note added in 1.7 */
void createJoinCaches();

/**Returns unique values for column
@@ -663,7 +670,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
*/
virtual void updateExtents();

/**Check if there is a join with a layer that will be removed*/
/** Check if there is a join with a layer that will be removed
@note added in 1.7 */
void checkJoinLayerRemove( QString theLayerId );

signals:

0 comments on commit 7975295

Please sign in to comment.
You can’t perform that action at this time.