[GRASS-SVN] r33065 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 25 11:17:19 EDT 2008
Author: martinl
Date: 2008-08-25 11:17:19 -0400 (Mon, 25 Aug 2008)
New Revision: 33065
Modified:
grass/trunk/gui/wxpython/gui_modules/vdigit.py
Log:
wxGUI/vdigit: snapping value -1 -> calculate from computational resolution
(merge from devbr6, r33064)
Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py 2008-08-25 15:02:05 UTC (rev 33064)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py 2008-08-25 15:17:19 UTC (rev 33065)
@@ -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