[GRASS-SVN] r38317 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 8 12:43:45 EDT 2009
Author: martinl
Date: 2009-07-08 12:43:44 -0400 (Wed, 08 Jul 2009)
New Revision: 38317
Modified:
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/render.py
Log:
wrong coordinates after zoom to named region (trac #678)
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2009-07-08 15:25:24 UTC (rev 38316)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2009-07-08 16:43:44 UTC (rev 38317)
@@ -231,6 +231,7 @@
box.Add(item=label, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
self.selection = gselect.Select(parent=self, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE,
type='windows')
+ self.selection.SetFocus()
box.Add(item=self.selection, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
self.selection.Bind(wx.EVT_TEXT, self.OnSelection)
@@ -239,6 +240,7 @@
box.Add(item=label, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
self.textentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="",
size=globalvar.DIALOG_TEXTCTRL_SIZE)
+ self.textentry.SetFocus()
box.Add(item=self.textentry, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
self.textentry.Bind(wx.EVT_TEXT, self.OnText)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-07-08 15:25:24 UTC (rev 38316)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-07-08 16:43:44 UTC (rev 38317)
@@ -600,7 +600,7 @@
@param renderVector re-render vector map layer enabled for editing (used for digitizer)
"""
start = time.clock()
-
+
self.resize = False
# if len(self.Map.GetListOfLayers()) == 0:
@@ -2617,52 +2617,33 @@
os.environ["GRASS_REGION"] = tmpreg
def ZoomToSaved(self, event):
- """!
- Set display geometry to match extents in
+ """!Set display geometry to match extents in
saved region file
"""
-
- zoomreg = {}
-
- dlg = gdialogs.SavedRegion(self, wx.ID_ANY, _("Zoom to saved region extents"),
+ dlg = gdialogs.SavedRegion(parent = self, id = wx.ID_ANY,
+ title = _("Zoom to saved region extents"),
pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.DEFAULT_DIALOG_STYLE,
loadsave='load')
-
+
if dlg.ShowModal() == wx.ID_CANCEL:
dlg.Destroy()
return
-
+
wind = dlg.wind
-
- region = gcmd.RunCommand('g.region',
- parent = self,
- read = True,
- flags = 'ugp',
- region = wind)
- if not region:
- dlg.Destroy()
- return
+ self.Map.GetRegion(regionName = wind,
+ update = True)
- for line in region.splitlines():
- key, val = line.split('=')
- zoomreg[key.strip()] = float(val.strip())
+ dlg.Destroy()
- self.Map.region['n'] = zoomreg['n']
- self.Map.region['s'] = zoomreg['s']
- self.Map.region['e'] = zoomreg['e']
- self.Map.region['w'] = zoomreg['w']
-
self.ZoomHistory(self.Map.region['n'],
self.Map.region['s'],
self.Map.region['e'],
self.Map.region['w'])
self.UpdateMap()
-
- dlg.Destroy()
-
+
def SaveDisplayRegion(self, event):
"""!
Save display extents to named region file.
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2009-07-08 15:25:24 UTC (rev 38316)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2009-07-08 16:43:44 UTC (rev 38317)
@@ -572,17 +572,17 @@
self.height = 480
return False
- def GetRegion(self, rast = [], zoom = False, vect = [],
+ def GetRegion(self, rast = [], zoom = False, vect = [], regionName = None,
n = None, s = None, e = None, w = None, default = False,
update = False):
- """
- Get region settings (g.region -upgc)
+ """!Get region settings (g.region -upgc)
Optionally extent, raster or vector map layer can be given.
-
- @param rast raster name or None
- @param vect vector name or None
- @param zoom zoom to raster (ignore NULLs)
+
+ @param rast list of raster maps
+ @param zoom zoom to raster map (ignore NULLs)
+ @param vect list of vector maps
+ @param regionName named region or None
@param n,s,e,w force extent
@param default force default region settings
@param update if True update current display region settings
@@ -590,7 +590,6 @@
@return region settings as directory, e.g. {
'n':'4928010', 's':'4913700', 'w':'589980',...}
"""
-
region = {}
tmpreg = os.getenv("GRASS_REGION")
@@ -608,7 +607,10 @@
if default:
cmd['flags'] += 'd'
-
+
+ if regionName:
+ cmd['region'] = regionName
+
if n:
cmd['n'] = n
if s:
More information about the grass-commit
mailing list