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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jul 22 07:40:14 EDT 2009


Author: wonder
Date: 2009-07-22 07:40:13 -0400 (Wed, 22 Jul 2009)
New Revision: 11143

Modified:
   trunk/qgis/python/core/qgsvectorlayer.sip
   trunk/qgis/src/core/qgsvectorlayer.cpp
   trunk/qgis/src/core/qgsvectorlayer.h
Log:
Undo changes in active edit command when it gets destroyed.
Fixed return value for deletion of vertices.
Contributed by Richard Kostecky.


Modified: trunk/qgis/python/core/qgsvectorlayer.sip
===================================================================
--- trunk/qgis/python/core/qgsvectorlayer.sip	2009-07-22 11:37:00 UTC (rev 11142)
+++ trunk/qgis/python/core/qgsvectorlayer.sip	2009-07-22 11:40:13 UTC (rev 11143)
@@ -422,7 +422,7 @@
     /** Finish edit command and add it to undo/redo stack */
     void endEditCommand();
 
-    /** Destroy active command and deletes all changes in it */
+    /** Destroy active command and reverts all changes in it */
     void destroyEditCommand();
 
     /** Execute undo operation. To be called only from QgsVectorLayerUndoCommand. */

Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2009-07-22 11:37:00 UTC (rev 11142)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2009-07-22 11:40:13 UTC (rev 11143)
@@ -1558,7 +1558,10 @@
       geometry = mChangedGeometries[atFeatureId];
     }
 
-    geometry.deleteVertex( atVertex );
+    if (!geometry.deleteVertex( atVertex ))
+    {
+      return false;
+    }
     mCachedGeometries[atFeatureId] = geometry;
     editGeometryChange( atFeatureId, geometry );
 
@@ -3885,6 +3888,7 @@
 {
   if ( mActiveCommand != NULL )
   {
+    undoEditCommand( mActiveCommand );
     delete mActiveCommand;
     mActiveCommand = NULL;
   }

Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h	2009-07-22 11:37:00 UTC (rev 11142)
+++ trunk/qgis/src/core/qgsvectorlayer.h	2009-07-22 11:40:13 UTC (rev 11143)
@@ -485,7 +485,7 @@
     /** Finish edit command and add it to undo/redo stack */
     void endEditCommand();
 
-    /** Destroy active command and deletes all changes in it */
+    /** Destroy active command and reverts all changes in it */
     void destroyEditCommand();
 
     /** Execute undo operation. To be called only from QgsVectorLayerUndoCommand. */



More information about the QGIS-commit mailing list