[GRASS-SVN] r34970 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 21 07:22:37 EST 2008


Author: martinl
Date: 2008-12-21 07:22:37 -0500 (Sun, 21 Dec 2008)
New Revision: 34970

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/profile.py
Log:
wxGUI: fix "Profile tool does not work" (trac #408)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-12-21 12:17:00 UTC (rev 34969)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-12-21 12:22:37 UTC (rev 34970)
@@ -969,7 +969,6 @@
         (if not given, self.polycoords is used)
 
         """
-
         if not pdc:
             pdc = self.pdcTmp
 
@@ -984,7 +983,7 @@
                 coords.append(self.Cell2Pixel(p))
 
             self.Draw(pdc, drawid=self.plineid, pdctype='polyline', coords=coords)
-
+            
             Debug.msg (4, "BufferedWindow.DrawLines(): coords=%s, id=%s" % \
                            (coords, self.plineid))
 
@@ -1414,13 +1413,11 @@
             # measure or profile
             if self.mouse["use"] == "measure":
                 self.parent.MeasureDist(self.mouse['begin'], self.mouse['end'])
-            try:
-                self.polycoords.append(self.Pixel2Cell(self.mouse['end']))
-                self.pdcTmp.ClearId(self.lineid)
-                self.DrawLines(pdc=self.pdcTmp)
-            except:
-                pass
 
+            self.polycoords.append(self.Pixel2Cell(self.mouse['end']))
+            self.ClearLines(pdc=self.pdcTmp)
+            self.DrawLines(pdc=self.pdcTmp)
+        
         elif self.mouse["use"] == "pointer" and self.parent.gismanager.georectifying:
             # -> georectifying
             coord = self.Pixel2Cell(self.mouse['end'])
@@ -2062,30 +2059,26 @@
         """
         Clears temporary drawn lines from PseudoDC
         """
-
         if not pdc:
-            return
-
-        exit = True
-
+            pdc=self.pdcTmp
         try:
             pdc.ClearId(self.lineid)
             pdc.RemoveId(self.lineid)
         except:
-            exit = False
+            pass
 
         try:
             pdc.ClearId(self.plineid)
             pdc.RemoveId(self.plineid)
         except:
-            exit = False
+            pass
 
         Debug.msg(4, "BufferedWindow.ClearLines(): lineid=%s, plineid=%s" %
                   (self.lineid, self.plineid))
 
         ### self.Refresh()
 
-        return exit
+        return True
 
     def Pixel2Cell(self, (x, y)):
         """
@@ -2941,6 +2934,11 @@
         for layer in qlayer:
             self.Map.DeleteLayer(layer)
 
+        # delete tmp lines
+        if self.MapWindow.mouse["use"] in ["measure", "profile"]:
+            self.MapWindow.polycoords = []
+            self.MapWindow.ClearLines()
+        
         # deselect features in vdigit
         if self.toolbars['vdigit'] and self.digit:
             self.digit.driver.SetSelected([])

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/profile.py	2008-12-21 12:17:00 UTC (rev 34969)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/profile.py	2008-12-21 12:22:37 UTC (rev 34970)
@@ -152,8 +152,8 @@
         self.ptitle = _('Profile of')
 
         # determine units (axis labels)
-        if self.parent.projinfo['units'] != '':
-            self.xlabel = _('Distance (%s)') % self.parent.projinfo['units']
+        if self.parent.Map.projinfo['units'] != '':
+            self.xlabel = _('Distance (%s)') % self.parent.Map.projinfo['units']
         else:
             self.xlabel = _("Distance along transect")
         self.ylabel = _("Cell values")



More information about the grass-commit mailing list