[GRASS-SVN] r47987 - in grass/trunk/gui/wxpython: . gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Aug 30 16:24:01 EDT 2011
Author: martinl
Date: 2011-08-30 13:24:01 -0700 (Tue, 30 Aug 2011)
New Revision: 47987
Modified:
grass/trunk/gui/wxpython/gui_modules/globalvar.py
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/preferences.py
grass/trunk/gui/wxpython/gui_modules/workspace.py
grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: added option to disable aligning extent to display size
Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py 2011-08-30 18:25:21 UTC (rev 47986)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py 2011-08-30 20:24:01 UTC (rev 47987)
@@ -110,6 +110,7 @@
_("Comp. region"),
_("Show comp. extent"),
_("Display mode"),
+ _("Display resolution"),
_("Display geometry"),
_("Map scale"),
_("Go to"),
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-08-30 18:25:21 UTC (rev 47986)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-08-30 20:24:01 UTC (rev 47987)
@@ -167,10 +167,19 @@
"computational region, "
"computational region inside a display region "
"as a red box).")))
+ # set mode
+ self.statusbarWin['alignExtent'] = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
+ label = _("Align region extent based on display size"))
+ self.statusbarWin['alignExtent'].SetValue(UserSettings.Get(group = 'display', key = 'alignExtent', subkey = 'enabled'))
+ self.statusbarWin['alignExtent'].Hide()
+ self.statusbarWin['alignExtent'].SetToolTip(wx.ToolTip (_("Align region extent based on display "
+ "size from center point. "
+ "Default value for new map displays can "
+ "be set up in 'User GUI settings' dialog.")))
# set resolution
self.statusbarWin['resolution'] = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
label = _("Constrain display resolution to computational settings"))
- self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleResolution, self.statusbarWin['resolution'])
+ self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleUpdateMap, self.statusbarWin['resolution'])
self.statusbarWin['resolution'].SetValue(UserSettings.Get(group = 'display', key = 'compResolution', subkey = 'enabled'))
self.statusbarWin['resolution'].Hide()
self.statusbarWin['resolution'].SetToolTip(wx.ToolTip (_("Constrain display resolution "
@@ -730,25 +739,21 @@
if self.statusbarWin['render'].GetValue():
self.OnRender(None)
- def OnToggleResolution(self, event):
+ def OnToggleUpdateMap(self, event):
+ """!Update display when toggle display mode
"""
- Use resolution of computation region settings
- for redering image instead of display resolution
- """
# redraw map if auto-rendering is enabled
if self.statusbarWin['render'].GetValue():
self.OnRender(None)
def OnToggleStatus(self, event):
+ """!Toggle status text
"""
- Toggle status text
- """
self.StatusbarUpdate()
def OnChangeMapScale(self, event):
+ """!Map scale changed by user
"""
- Map scale changed by user
- """
scale = event.GetString()
try:
@@ -859,6 +864,7 @@
"""!Update statusbar content"""
self.statusbarWin['region'].Hide()
+ self.statusbarWin['alignExtent'].Hide()
self.statusbarWin['resolution'].Hide()
self.statusbarWin['mapscale'].Hide()
self.statusbarWin['goto'].Hide()
@@ -965,20 +971,26 @@
# disable long help
self.StatusbarEnableLongHelp(False)
- elif self.statusbarWin['toggle'].GetSelection() == 4: # Display mode
+ elif self.statusbarWin['toggle'].GetSelection() == 4: # Align extent
self.statusbar.SetStatusText("", 0)
+ self.statusbarWin['alignExtent'].Show()
+ # disable long help
+ self.StatusbarEnableLongHelp(False)
+
+ elif self.statusbarWin['toggle'].GetSelection() == 5: # Display resolution
+ self.statusbar.SetStatusText("", 0)
self.statusbarWin['resolution'].Show()
# disable long help
self.StatusbarEnableLongHelp(False)
- elif self.statusbarWin['toggle'].GetSelection() == 5: # Display geometry
+ elif self.statusbarWin['toggle'].GetSelection() == 6: # Display geometry
self.statusbar.SetStatusText("rows=%d; cols=%d; nsres=%.2f; ewres=%.2f" %
(self.Map.region["rows"], self.Map.region["cols"],
self.Map.region["nsres"], self.Map.region["ewres"]), 0)
# enable long help
self.StatusbarEnableLongHelp()
- elif self.statusbarWin['toggle'].GetSelection() == 6: # Map scale
+ elif self.statusbarWin['toggle'].GetSelection() == 7: # Map scale
# TODO: need to be fixed...
### screen X region problem
### user should specify ppm
@@ -1027,7 +1039,7 @@
# disable long help
self.StatusbarEnableLongHelp(False)
- elif self.statusbarWin['toggle'].GetSelection() == 7: # go to
+ elif self.statusbarWin['toggle'].GetSelection() == 8: # go to
self.statusbar.SetStatusText("")
region = self.Map.GetCurrentRegion()
precision = int(UserSettings.Get(group = 'projection', key = 'format',
@@ -1068,7 +1080,7 @@
# disable long help
self.StatusbarEnableLongHelp(False)
- elif self.statusbarWin['toggle'].GetSelection() == 8: # projection
+ elif self.statusbarWin['toggle'].GetSelection() == 9: # projection
self.statusbar.SetStatusText("")
epsg = UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'epsg')
if epsg:
@@ -1094,6 +1106,7 @@
"""!Reposition checkbox in statusbar"""
# reposition checkbox
widgets = [(0, self.statusbarWin['region']),
+ (0, self.statusbarWin['alignExtent']),
(0, self.statusbarWin['resolution']),
(0, self.statusbarWin['mapscale']),
(0, self.statusbarWin['progress']),
@@ -1912,12 +1925,13 @@
zoommenu.Destroy()
def SetProperties(self, render = False, mode = 0, showCompExtent = False,
- constrainRes = False, projection = False):
+ constrainRes = False, projection = False, alignExtent = True):
"""!Set properies of map display window"""
self.statusbarWin['render'].SetValue(render)
self.statusbarWin['toggle'].SetSelection(mode)
self.StatusbarUpdate()
self.statusbarWin['region'].SetValue(showCompExtent)
+ self.statusbarWin['alignExtent'].SetValue(alignExtent)
self.statusbarWin['resolution'].SetValue(constrainRes)
self.statusbarWin['projection'].SetValue(projection)
if showCompExtent:
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-08-30 18:25:21 UTC (rev 47986)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-08-30 20:24:01 UTC (rev 47987)
@@ -1637,10 +1637,8 @@
if newreg != {}:
# LL locations
if self.parent.Map.projinfo['proj'] == 'll':
- if newreg['n'] > 90.0:
- newreg['n'] = 90.0
- if newreg['s'] < -90.0:
- newreg['s'] = -90.0
+ self.region['n'] = min(self.region['n'], 90.0)
+ self.region['s'] = max(self.region['s'], -90.0)
ce = newreg['w'] + (newreg['e'] - newreg['w']) / 2
cn = newreg['s'] + (newreg['n'] - newreg['s']) / 2
@@ -1648,9 +1646,13 @@
# calculate new center point and display resolution
self.Map.region['center_easting'] = ce
self.Map.region['center_northing'] = cn
- self.Map.region["ewres"] = (newreg['e'] - newreg['w']) / self.Map.width
- self.Map.region["nsres"] = (newreg['n'] - newreg['s']) / self.Map.height
- self.Map.AlignExtentFromDisplay()
+ self.Map.region['ewres'] = (newreg['e'] - newreg['w']) / self.Map.width
+ self.Map.region['nsres'] = (newreg['n'] - newreg['s']) / self.Map.height
+ if self.parent.statusbarWin['alignExtent'].IsChecked():
+ self.Map.AlignExtentFromDisplay()
+ else:
+ for k in ('n', 's', 'e', 'w'):
+ self.Map.region[k] = newreg[k]
if hasattr(self, "digit") and \
hasattr(self, "moveInfo"):
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2011-08-30 18:25:21 UTC (rev 47986)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2011-08-30 20:24:01 UTC (rev 47987)
@@ -150,6 +150,9 @@
'driver': {
'type': 'cairo'
},
+ 'alignExtent' : {
+ 'enabled' : True
+ },
'compResolution' : {
'enabled' : False
},
@@ -1560,12 +1563,25 @@
pos = (row, 1))
#
+ # Align extent to display size
+ #
+ row += 1
+ alignExtent = wx.CheckBox(parent = panel, id = wx.ID_ANY,
+ label = _("Align region extent based on display size"),
+ name = "IsChecked")
+ alignExtent.SetValue(self.settings.Get(group = 'display', key = 'alignExtent', subkey = 'enabled'))
+ self.winId['display:alignExtent:enabled'] = alignExtent.GetId()
+
+ gridSizer.Add(item = alignExtent,
+ pos = (row, 0), span = (1, 2))
+
+ #
# Use computation resolution
#
row += 1
compResolution = wx.CheckBox(parent = panel, id = wx.ID_ANY,
- label = _("Constrain display resolution to computational settings"),
- name = "IsChecked")
+ label = _("Constrain display resolution to computational settings"),
+ name = "IsChecked")
compResolution.SetValue(self.settings.Get(group = 'display', key = 'compResolution', subkey = 'enabled'))
self.winId['display:compResolution:enabled'] = compResolution.GetId()
Modified: grass/trunk/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/workspace.py 2011-08-30 18:25:21 UTC (rev 47986)
+++ grass/trunk/gui/wxpython/gui_modules/workspace.py 2011-08-30 20:24:01 UTC (rev 47987)
@@ -155,6 +155,7 @@
"pos" : pos,
"size" : size,
"extent" : extent,
+ "alignExtent" : bool(int(display.get('alignExtent', "0"))),
"constrainRes" : bool(int(display.get('constrainRes', "0"))),
"projection" : projection,
"viewMode" : display.get('viewMode', '2d')} )
@@ -910,23 +911,25 @@
file.write('%s<display render="%d" '
'mode="%d" showCompExtent="%d" '
+ 'alignExtent="%d" '
'constrainRes="%d" '
'dim="%d,%d,%d,%d" '
'extent="%f,%f,%f,%f" '
'viewMode="%s" >\n' % (' ' * self.indent,
- int(mapTree.mapdisplay.statusbarWin['render'].IsChecked()),
- mapTree.mapdisplay.statusbarWin['toggle'].GetSelection(),
- int(mapTree.mapdisplay.statusbarWin['region'].IsChecked()),
- int(mapTree.mapdisplay.statusbarWin['resolution'].IsChecked()),
- displayPos[0],
- displayPos[1],
- displaySize[0],
- displaySize[1],
- region['w'],
- region['s'],
- region['e'],
- region['n'],
- viewmode
+ int(mapTree.mapdisplay.statusbarWin['render'].IsChecked()),
+ mapTree.mapdisplay.statusbarWin['toggle'].GetSelection(),
+ int(mapTree.mapdisplay.statusbarWin['region'].IsChecked()),
+ int(mapTree.mapdisplay.statusbarWin['alignExtent'].IsChecked()),
+ int(mapTree.mapdisplay.statusbarWin['resolution'].IsChecked()),
+ displayPos[0],
+ displayPos[1],
+ displaySize[0],
+ displaySize[1],
+ region['w'],
+ region['s'],
+ region['e'],
+ region['n'],
+ viewmode
))
# projection statusbar info
if mapTree.mapdisplay.statusbarWin['projection'].IsChecked() and \
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2011-08-30 18:25:21 UTC (rev 47986)
+++ grass/trunk/gui/wxpython/wxgui.py 2011-08-30 20:24:01 UTC (rev 47987)
@@ -828,6 +828,7 @@
mapdisp.SetProperties(render = display['render'],
mode = display['mode'],
showCompExtent = display['showCompExtent'],
+ alignExtent = display['alignExtent'],
constrainRes = display['constrainRes'],
projection = display['projection']['enabled'])
More information about the grass-commit
mailing list