Explorar o código

wxgui: better error trapping for profile segments points

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48655 15284696-431f-4ddb-bdfa-cd5b030d7da7
Michael Barton %!s(int64=13) %!d(string=hai) anos
pai
achega
cb46e8675b

+ 5 - 2
gui/wxpython/gui_modules/wxplot.py

@@ -833,6 +833,7 @@ class ProfileFrame(AbstractPlotFrame):
         # 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 @@ class ProfileFrame(AbstractPlotFrame):
                                       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 @@ class ProfileFrame(AbstractPlotFrame):
             except:
                 pass
 
-
         #
         # create datalist for each raster map
         #    
@@ -959,6 +961,7 @@ class ProfileFrame(AbstractPlotFrame):
         """
         # 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,

+ 3 - 6
gui/wxpython/gui_modules/wxplot_dialogs.py

@@ -99,13 +99,10 @@ class ProfileRasterDialog(wx.Dialog):
         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,