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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu May 14 13:03:44 EDT 2009


Author: mhugent
Date: 2009-05-14 13:03:43 -0400 (Thu, 14 May 2009)
New Revision: 10794

Modified:
   trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
Keep mCachedGeometries up-to-date before the next repaint. This is important in cases where topological editing is enabled

Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2009-05-14 16:53:54 UTC (rev 10793)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2009-05-14 17:03:43 UTC (rev 10794)
@@ -1469,6 +1469,7 @@
   // and add to the known added features.
   f.setFeatureId( addedIdLowWaterMark );
   mAddedFeatures.append( f );
+  mCachedGeometries[f.id()] = *(f.geometry());
 
   setModified( true );
 
@@ -1502,6 +1503,7 @@
     }
 
     mChangedGeometries[atFeatureId].insertVertex( x, y, beforeVertex );
+    mCachedGeometries[atFeatureId] = mChangedGeometries[atFeatureId];
 
     setModified( true, true ); // only geometry was changed
 
@@ -1531,6 +1533,7 @@
     }
 
     mChangedGeometries[atFeatureId].moveVertex( x, y, atVertex );
+    mCachedGeometries[atFeatureId] = mChangedGeometries[atFeatureId];
 
     setModified( true, true ); // only geometry was changed
 
@@ -1652,7 +1655,9 @@
   QgsGeometryMap::iterator changedIt = mChangedGeometries.find( selectedFeatureId );
   if ( changedIt != mChangedGeometries.end() )
   {
-    return changedIt->addIsland( ring );
+    int returnValue = changedIt->addIsland( ring );
+    mCachedGeometries[selectedFeatureId] = *changedIt;
+    return returnValue;
   }
 
   //look if id of selected feature belongs to an added feature
@@ -1661,6 +1666,7 @@
     if ( addedIt->id() == selectedFeatureId )
     {
       return addedIt->geometry()->addIsland( ring );
+      mCachedGeometries[selectedFeatureId] = *(addedIt->geometry());
     }
   }
 
@@ -1672,6 +1678,7 @@
     if ( errorCode == 0 )
     {
       mChangedGeometries.insert( selectedFeatureId, *cachedIt );
+      mCachedGeometries[selectedFeatureId] = *cachedIt;
       setModified( true, true );
     }
     return errorCode;
@@ -2572,6 +2579,7 @@
   }
 
   mChangedGeometries[ fid ] = *geom;
+  mCachedGeometries[fid] = *geom;
   setModified( true, true );
   return true;
 }
@@ -3236,7 +3244,7 @@
   int n = 0;
   QgsFeature f;
 
-  if ( mCachedGeometriesRect.contains( searchRect ) )
+  if (mCachedGeometriesRect.contains( searchRect ) )
   {
     QgsDebugMsg( "Using cached geometries for snapping." );
 



More information about the QGIS-commit mailing list