Ver código fonte

rdigit: finish drawing of line/area before saving or switching tools

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62829 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 anos atrás
pai
commit
f43d0caa3a
1 arquivos alterados com 11 adições e 3 exclusões
  1. 11 3
      gui/wxpython/rdigit/controller.py

+ 11 - 3
gui/wxpython/rdigit/controller.py

@@ -154,7 +154,7 @@ class RDigitController(wx.EvtHandler):
         elif self._graphicsType == 'point':
         elif self._graphicsType == 'point':
             point = self._points.GetItem(-1)
             point = self._points.GetItem(-1)
             point.SetCoords([x, y])
             point.SetCoords([x, y])
-            self._finish(x, y)
+            self._finish()
         # draw
         # draw
         self._mapWindow.ClearLines()
         self._mapWindow.ClearLines()
         self._lines.Draw(pdc=self._mapWindow.pdcTmp)
         self._lines.Draw(pdc=self._mapWindow.pdcTmp)
@@ -162,7 +162,7 @@ class RDigitController(wx.EvtHandler):
         self._points.Draw(pdc=self._mapWindow.pdcTmp)
         self._points.Draw(pdc=self._mapWindow.pdcTmp)
         self._mapWindow.Refresh()
         self._mapWindow.Refresh()
 
 
-    def _finish(self, x, y):
+    def _finish(self):
         """Finish digitizing a new object and redraws.
         """Finish digitizing a new object and redraws.
         Saves current cell value and buffer width for that object.
         Saves current cell value and buffer width for that object.
 
 
@@ -201,6 +201,11 @@ class RDigitController(wx.EvtHandler):
         Connects and disconnects signal to allow other tools
         Connects and disconnects signal to allow other tools
         in map toolbar to work.
         in map toolbar to work.
         """
         """
+        if self._graphicsType and drawingType and self._graphicsType != drawingType \
+                and self._drawing:
+            # if we select different drawing tool, finish the feature
+            self._finish()
+
         if self._graphicsType and not drawingType:
         if self._graphicsType and not drawingType:
             self._mapWindow.ClearLines(pdc=self._mapWindow.pdcTmp)
             self._mapWindow.ClearLines(pdc=self._mapWindow.pdcTmp)
             self._mapWindow.mouse['end'] = self._mapWindow.mouse['begin']
             self._mapWindow.mouse['end'] = self._mapWindow.mouse['begin']
@@ -414,9 +419,12 @@ class RDigitController(wx.EvtHandler):
         keep the order of editing. These rasters are then patched together.
         keep the order of editing. These rasters are then patched together.
         Sets default color table for the newly digitized raster.
         Sets default color table for the newly digitized raster.
         """
         """
-        if not self._editedRaster:
+        if not self._editedRaster or self._running:
             return
             return
 
 
+        if self._drawing:
+            self._finish()
+
         if len(self._all) < 1:
         if len(self._all) < 1:
             return
             return
         tempRaster = 'tmp_rdigit_rast_' + str(os.getpid())
         tempRaster = 'tmp_rdigit_rast_' + str(os.getpid())