[GRASS-SVN] r54391 - in grass/trunk/gui/wxpython: core vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 24 14:31:39 PST 2012


Author: martinl
Date: 2012-12-24 14:31:38 -0800 (Mon, 24 Dec 2012)
New Revision: 54391

Modified:
   grass/trunk/gui/wxpython/core/settings.py
   grass/trunk/gui/wxpython/vdigit/preferences.py
   grass/trunk/gui/wxpython/vdigit/wxdigit.py
Log:
wxGUI/vdigit: option to close boundary (snap to the first node) 


Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2012-12-24 16:29:33 UTC (rev 54390)
+++ grass/trunk/gui/wxpython/core/settings.py	2012-12-24 22:31:38 UTC (rev 54391)
@@ -456,6 +456,10 @@
                 'breakLines' : {
                     'enabled' : False,
                     },
+                # close boundary (snap to the first node)
+                'closeBoundary' : {
+                    'enabled' : False,
+                    }
                 },
              # 
              # plots for profiles, histograms, and scatterplots

Modified: grass/trunk/gui/wxpython/vdigit/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/preferences.py	2012-12-24 16:29:33 UTC (rev 54390)
+++ grass/trunk/gui/wxpython/vdigit/preferences.py	2012-12-24 22:31:38 UTC (rev 54391)
@@ -232,7 +232,7 @@
         #
         # digitize lines box
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Digitize line features"))
+        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Digitize lines/boundaries"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
         self.intersect = wx.CheckBox(parent = panel, label = _("Break lines at intersection"))
@@ -243,6 +243,19 @@
         border.Add(item = sizer, proportion = 0, flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5)
 
         #
+        # digitize areas box
+        #
+        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Digitize areas"))
+        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+
+        self.closeBoundary = wx.CheckBox(parent = panel, label = _("Close boundary (snap to the start node)"))
+        self.closeBoundary.SetValue(UserSettings.Get(group = 'vdigit', key = 'closeBoundary', subkey = 'enabled'))
+        
+        sizer.Add(item = self.closeBoundary, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 1)
+
+        border.Add(item = sizer, proportion = 0, flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5)
+
+        #
         # save-on-exit box
         #
         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Save changes"))

Modified: grass/trunk/gui/wxpython/vdigit/wxdigit.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/wxdigit.py	2012-12-24 16:29:33 UTC (rev 54390)
+++ grass/trunk/gui/wxpython/vdigit/wxdigit.py	2012-12-24 22:31:38 UTC (rev 54391)
@@ -1401,9 +1401,11 @@
             # close boundary
             points = self.poPoints.contents
             last = points.n_points - 1
-            if Vect_points_distance(points.x[0], points.x[0], points.z[0],
-                                    points.x[last], points.x[last], points.z[last],
-                                    is3D) <= threshold:
+            if self._settings['closeBoundary']:
+                Vect_append_point(self.poPoints, points.x[0], points.y[0], points.z[0])
+            elif Vect_points_distance(points.x[0], points.x[0], points.z[0],
+                                      points.x[last], points.x[last], points.z[last],
+                                      is3D) <= threshold:
                 points.x[last] = points.x[0]
                 points.y[last] = points.y[0]
                 points.z[last] = points.z[0]
@@ -1577,8 +1579,10 @@
         """
         self._display.UpdateSettings()
         
-        self._settings['breakLines']  = bool(UserSettings.Get(group = 'vdigit', key = "breakLines",
+        self._settings['breakLines']   = bool(UserSettings.Get(group = 'vdigit', key = "breakLines",
                                                               subkey = 'enabled'))
+        self._settings['closeBoundary'] = bool(UserSettings.Get(group = 'vdigit', key = "closeBoundary",
+                                                                subkey = 'enabled'))
         
     def SetCategory(self):
         """!Update self.cats based on settings"""



More information about the grass-commit mailing list