[GRASS-SVN] r52234 - grass/trunk/gui/wxpython/wxplot

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 26 23:48:20 PDT 2012


Author: annakrat
Date: 2012-06-26 23:48:20 -0700 (Tue, 26 Jun 2012)
New Revision: 52234

Modified:
   grass/trunk/gui/wxpython/wxplot/profile.py
Log:
wxGUI/profile: display warning when points are not inside computational region

Modified: grass/trunk/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/profile.py	2012-06-27 05:27:57 UTC (rev 52233)
+++ grass/trunk/gui/wxpython/wxplot/profile.py	2012-06-27 06:48:20 UTC (rev 52234)
@@ -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