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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 25 11:02:05 EDT 2008


Author: martinl
Date: 2008-08-25 11:02:05 -0400 (Mon, 25 Aug 2008)
New Revision: 33064

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
Log:
wxGUI/vdigit: snapping value -1 -> calculate from computational resolution


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2008-08-25 14:49:39 UTC (rev 33063)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2008-08-25 15:02:05 UTC (rev 33064)
@@ -2080,18 +2080,27 @@
         value = self.snappingValue.GetValue()
         
         if value < 0:
-            self.snappingInfo.SetLabel(_("No limit for snapping"))
-            return
+            region = self.parent.MapWindow.Map.GetRegion()
+            res = (region['nsres'] + region['ewres']) / 2.
+            threshold = self.parent.digit.driver.GetThreshold(value=res)
+        else:
+            if self.snappingUnit.GetStringSelection() == "map units":
+                threshold = value
+            else:
+                threshold = self.parent.digit.driver.GetThreshold(value=value)
+            
+        if value == 0:
+            self.snappingInfo.SetLabel(_("Snapping disabled"))
+        elif value < 0:
+            self.snappingInfo.SetLabel(_("Snapping threshold is %(value).1f %(units)s "
+                                         "(based on computation resolution)") % 
+                                       {'value' : threshold,
+                                        'units' : self.mapUnits.lower()})
+        else:
+            self.snappingInfo.SetLabel(_("Snapping threshold is %(value).1f %(units)s") % 
+                                       {'value' : threshold,
+                                        'units' : self.mapUnits.lower()})
         
-        if self.snappingUnit.GetStringSelection() == "map units":
-            threshold = value
-        else:
-            threshold = self.parent.digit.driver.GetThreshold(value=value)
-
-        self.snappingInfo.SetLabel(_("Snapping threshold is %(value).1f %(units)s") % 
-                                   {'value' : threshold,
-                                    'units' : self.mapUnits})
-
         event.Skip()
 
     def OnChangeSnappingUnits(self, event):



More information about the grass-commit mailing list