[GRASS-SVN] r34966 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 21 06:55:16 EST 2008


Author: martinl
Date: 2008-12-21 06:55:16 -0500 (Sun, 21 Dec 2008)
New Revision: 34966

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


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2008-12-21 08:57:40 UTC (rev 34965)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2008-12-21 11:55:16 UTC (rev 34966)
@@ -968,7 +968,6 @@
         (if not given, self.polycoords is used)
 
         """
-
         if not pdc:
             pdc = self.pdcTmp
 
@@ -983,7 +982,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))
 
@@ -1413,13 +1412,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'])
@@ -2061,30 +2058,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)):
         """
@@ -2940,6 +2933,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/releasebranch_6_4/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py	2008-12-21 08:57:40 UTC (rev 34965)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/profile.py	2008-12-21 11:55:16 UTC (rev 34966)
@@ -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