[QGIS Commit] r15327 - in trunk/qgis: python/core src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Mar 3 17:45:22 EST 2011


Author: wonder
Date: 2011-03-03 14:45:21 -0800 (Thu, 03 Mar 2011)
New Revision: 15327

Modified:
   trunk/qgis/python/core/qgsvectorlayer.sip
   trunk/qgis/src/core/qgsvectorlayer.h
Log:
Added missing python bindings for table joins


Modified: trunk/qgis/python/core/qgsvectorlayer.sip
===================================================================
--- trunk/qgis/python/core/qgsvectorlayer.sip	2011-03-03 22:21:09 UTC (rev 15326)
+++ trunk/qgis/python/core/qgsvectorlayer.sip	2011-03-03 22:45:21 UTC (rev 15327)
@@ -4,6 +4,27 @@
 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 @@
   /** 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 @@
       @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 @@
    */
   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 */

Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h	2011-03-03 22:21:09 UTC (rev 15326)
+++ trunk/qgis/src/core/qgsvectorlayer.h	2011-03-03 22:45:21 UTC (rev 15327)
@@ -55,6 +55,7 @@
 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 @@
   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 @@
     /** 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 @@
       @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 @@
      */
     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:



More information about the QGIS-commit mailing list