[GRASS-SVN] r48655 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 5 18:38:31 EDT 2011


Author: cmbarton
Date: 2011-10-05 15:38:31 -0700 (Wed, 05 Oct 2011)
New Revision: 48655

Modified:
   grass/trunk/gui/wxpython/gui_modules/wxplot.py
   grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py
Log:
wxgui: better error trapping for profile segments points

Modified: grass/trunk/gui/wxpython/gui_modules/wxplot.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxplot.py	2011-10-05 22:07:56 UTC (rev 48654)
+++ grass/trunk/gui/wxpython/gui_modules/wxplot.py	2011-10-05 22:38:31 UTC (rev 48655)
@@ -833,6 +833,7 @@
         # create list of coordinates for transect segment markers
         #
         if len(self.mapwin.polycoords) > 0:
+            self.seglist = []
             for point in self.mapwin.polycoords:
                 # get value of raster cell at coordinate point
                 ret = gcmd.RunCommand('r.what',
@@ -841,7 +842,9 @@
                                       input = self.rasterList[0],
                                       east_north = '%d,%d' % (point[0],point[1]))
                 
-                val = float(ret.splitlines()[0].split('|')[3])
+                val = ret.splitlines()[0].split('|')[3]
+                if val == None or val == '*': continue
+                val = float(val)
                 
                 # calculate distance between coordinate points
                 if lasteast and lastnorth:
@@ -863,7 +866,6 @@
             except:
                 pass
 
-
         #
         # create datalist for each raster map
         #    
@@ -959,6 +961,7 @@
         """
         # graph the distance, value pairs for the transect
         self.plotlist = []
+
         # Add segment marker points to plot data list
         if len(self.seglist) > 0 :
             self.ppoints = plot.PolyMarker(self.seglist,

Modified: grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py	2011-10-05 22:07:56 UTC (rev 48654)
+++ grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py	2011-10-05 22:38:31 UTC (rev 48655)
@@ -99,13 +99,10 @@
         sizer.Fit(self)
 
     def OnSelection(self, event):
-        # for now this is limited to 14 rasters (number of colors in colorList), but it could be increased
-        rstring = event.GetString()
-        rList = rstring.split(',')
-        n = min(len(rList), len(self.colorList))
+        """!Choose maps to profile. Convert these into a list
+        """
         self.rasterList = []
-        for idx in range(0,n):
-            self.rasterList.append(rList[idx])
+        self.rasterList = event.GetString().split(',')
 
 class ScatterRasterDialog(wx.Dialog):
     def __init__(self, parent, id = wx.ID_ANY, 



More information about the grass-commit mailing list