[GRASS-SVN] r31642 - in grass/trunk/gui/wxpython: . gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 5 15:57:03 EDT 2008
Author: martinl
Date: 2008-06-05 15:57:03 -0400 (Thu, 05 Jun 2008)
New Revision: 31642
Modified:
grass/trunk/gui/wxpython/gui_modules/workspace.py
grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: 'extent' attribute added to 'display' tag (merge devbr6, r31641)
Modified: grass/trunk/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/workspace.py 2008-06-05 19:53:31 UTC (rev 31641)
+++ grass/trunk/gui/wxpython/gui_modules/workspace.py 2008-06-05 19:57:03 UTC (rev 31642)
@@ -66,6 +66,8 @@
elif name == 'display':
self.inDisplay = True
self.displayIndex += 1
+
+ # window position and size
posAttr = attrs.get('dim', '')
if posAttr:
posVal = map(int, posAttr.split(','))
@@ -79,12 +81,20 @@
pos = None
size = None
+ extentAttr = attrs.get('extent', '')
+ if extentAttr:
+ # w, s, e, n
+ extent = map(float, extentAttr.split(','))
+ else:
+ extent = None
+
self.displays.append({
"render" : bool(int(attrs.get('render', "0"))),
"mode" : int(attrs.get('mode', 0)),
"showCompExtent" : bool(int(attrs.get('showCompExtent', "0"))),
"pos" : pos,
- "size" : size})
+ "size" : size,
+ "extent" : extent})
elif name == 'group':
self.groupName = attrs.get('name', None)
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2008-06-05 19:53:31 UTC (rev 31641)
+++ grass/trunk/gui/wxpython/wxgui.py 2008-06-05 19:57:03 UTC (rev 31642)
@@ -627,8 +627,11 @@
#
# start map displays first (list of layers can be empty)
#
+ displayId = 0
for display in gxwXml.displays:
mapdisplay = self.NewDisplay(show=False)
+ maptree = self.gm_cb.GetPage(displayId).maptree
+
# set windows properties
mapdisplay.SetProperties(render=display['render'],
mode=display['mode'],
@@ -641,7 +644,14 @@
if display['size']:
mapdisplay.SetSize(display['size'])
+ # set extent if defined
+ if display['extent']:
+ w, s, e, n = display['extent']
+ maptree.Map.region = maptree.Map.GetRegion(w=w, s=s, e=e, n=n)
+
mapdisplay.Show()
+
+ displayId += 1
maptree = None
selected = [] # list of selected layers
@@ -899,21 +909,27 @@
# list of displays
for page in range(0, self.gm_cb.GetPageCount()):
mapTree = self.gm_cb.GetPage(page).maptree
+ region = mapTree.Map.region
displayPos = mapTree.mapdisplay.GetPosition()
displaySize = mapTree.mapdisplay.GetSize()
file.write('%s<display render="%d" '
'mode="%d" showCompExtent="%d" '
- 'dim="%d,%d,%d,%d">\n' % (' ' * self.indent,
- int(mapTree.mapdisplay.autoRender.IsChecked()),
- mapTree.mapdisplay.toggleStatus.GetSelection(),
- int(mapTree.mapdisplay.showRegion.IsChecked()),
- displayPos[0],
- displayPos[1],
- displaySize[0],
- displaySize[1]
- ))
+ 'dim="%d,%d,%d,%d" '
+ 'extent="%f,%f,%f,%f">\n' % (' ' * self.indent,
+ int(mapTree.mapdisplay.autoRender.IsChecked()),
+ mapTree.mapdisplay.toggleStatus.GetSelection(),
+ int(mapTree.mapdisplay.showRegion.IsChecked()),
+ displayPos[0],
+ displayPos[1],
+ displaySize[0],
+ displaySize[1],
+ region['w'],
+ region['s'],
+ region['e'],
+ region['n']
+ ))
# list of layers
item = mapTree.GetFirstChild(mapTree.root)[0]
More information about the grass-commit
mailing list