[GRASS-SVN] r52235 - grass/branches/develbranch_6/gui/wxpython/wxplot

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 27 00:01:33 PDT 2012


Author: annakrat
Date: 2012-06-27 00:01:32 -0700 (Wed, 27 Jun 2012)
New Revision: 52235

Modified:
   grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py
Log:
wxGUI/profile: display warning when points are not inside computational region (merge from trunk, r52234)

Modified: grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py	2012-06-27 06:48:20 UTC (rev 52234)
+++ grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py	2012-06-27 07:01:32 UTC (rev 52235)
@@ -22,6 +22,7 @@
 import wx
 import wx.lib.plot as plot
 
+from core.gcmd import GWarning
 import grass.script as grass
 
 try:
@@ -129,14 +130,22 @@
         self.coordstr = ''
         lasteast = lastnorth = None
         
+        region = grass.region()
+        insideRegion = True
         if len(self.mapwin.polycoords) > 0:
             for point in self.mapwin.polycoords:
+                if not (region['w'] <= point[0] <= region['e'] and region['s'] <= point[1] <= region['n']):
+                    insideRegion = False
                 # build string of coordinate points for r.profile
                 if self.coordstr == '':
                     self.coordstr = '%d,%d' % (point[0], point[1])
                 else:
                     self.coordstr = '%s,%d,%d' % (self.coordstr, point[0], point[1])
 
+        if not insideRegion:
+            GWarning(message = _("Not all points of profile lie inside computational region."),
+                     parent = self)
+
         if len(self.rasterList) == 0:
             return
 



More information about the grass-commit mailing list