Forráskód Böngészése

wxGUI/profile: display warning when points are not inside computational region

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52234 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 13 éve
szülő
commit
d2ef0426ef
1 módosított fájl, 9 hozzáadás és 0 törlés
  1. 9 0
      gui/wxpython/wxplot/profile.py

+ 9 - 0
gui/wxpython/wxplot/profile.py

@@ -22,6 +22,7 @@ import math
 import wx
 import wx.lib.plot as plot
 
+from core.gcmd import GWarning
 import grass.script as grass
 
 try:
@@ -129,14 +130,22 @@ class ProfileFrame(BasePlotFrame):
         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