[QGIS Commit] r12194 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Nov 19 10:00:26 EST 2009


Author: wonder
Date: 2009-11-19 10:00:25 -0500 (Thu, 19 Nov 2009)
New Revision: 12194

Modified:
   trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
Fix vector layer editation when symbology-ng is turned on.


Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2009-11-19 14:43:43 UTC (rev 12193)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2009-11-19 15:00:25 UTC (rev 12194)
@@ -315,10 +315,10 @@
 {
   QgsDebugMsg( "Starting draw of labels" );
 
-  if ( ( mRenderer || mRendererV2 ) && mLabelOn &&
-       ( !label()->scaleBasedVisibility() ||
-         ( label()->minScale() <= rendererContext.rendererScale() &&
-           rendererContext.rendererScale() <= label()->maxScale() ) ) )
+  if (( mRenderer || mRendererV2 ) && mLabelOn &&
+      ( !label()->scaleBasedVisibility() ||
+        ( label()->minScale() <= rendererContext.rendererScale() &&
+          rendererContext.rendererScale() <= label()->maxScale() ) ) )
   {
     QgsAttributeList attributes;
     if ( mRenderer )
@@ -352,8 +352,8 @@
       QgsFeature fet;
       while ( nextFeature( fet ) )
       {
-        if ( ( mRenderer && mRenderer->willRenderFeature( &fet ) )
-          || ( mRendererV2 && mRendererV2->symbolForFeature( fet ) != NULL ) )
+        if (( mRenderer && mRenderer->willRenderFeature( &fet ) )
+            || ( mRendererV2 && mRendererV2->symbolForFeature( fet ) != NULL ) )
         {
           bool sel = mSelectedFeatureIds.contains( fet.id() );
           mLabel->renderLabel( rendererContext, fet, sel, 0 );
@@ -706,6 +706,12 @@
 
     if ( labeling )
       rendererContext.labelingEngine()->registerFeature( this, fet );
+
+    if ( mEditable )
+    {
+      // Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
+      mCachedGeometries[fet.id()] = *fet.geometry();
+    }
   }
 
   mRendererV2->stopRender( rendererContext );
@@ -745,6 +751,12 @@
 
     if ( labeling )
       rendererContext.labelingEngine()->registerFeature( this, fet );
+
+    if ( mEditable )
+    {
+      // Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
+      mCachedGeometries[fet.id()] = *fet.geometry();
+    }
   }
 
   // find out the order
@@ -806,6 +818,13 @@
 
     QgsDebugMsg( "rendering v2:\n" + mRendererV2->dump() );
 
+    if ( mEditable )
+    {
+      // Destroy all cached geometries and clear the references to them
+      deleteCachedGeometries();
+      mCachedGeometriesRect = rendererContext.extent();
+    }
+
     // TODO: really needed?
     updateFeatureCount();
 



More information about the QGIS-commit mailing list