[GRASS-SVN] r51771 - in grass/branches/develbranch_6/gui/wxpython:
core nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 26 07:24:15 EDT 2012
Author: annakrat
Date: 2012-05-26 04:24:15 -0700 (Sat, 26 May 2012)
New Revision: 51771
Modified:
grass/branches/develbranch_6/gui/wxpython/core/settings.py
grass/branches/develbranch_6/gui/wxpython/core/workspace.py
grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py
Log:
wxNviz: revert changes in zexag and improve its behaviour for latlon projections (merged from trunk, r51695, r51702)
Modified: grass/branches/develbranch_6/gui/wxpython/core/settings.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/settings.py 2012-05-26 11:20:48 UTC (rev 51770)
+++ grass/branches/develbranch_6/gui/wxpython/core/settings.py 2012-05-26 11:24:15 UTC (rev 51771)
@@ -708,7 +708,7 @@
self.internalSettings['nviz']['view']['height'] = {}
self.internalSettings['nviz']['view']['height']['value'] = -1
self.internalSettings['nviz']['view']['z-exag'] = {}
- self.internalSettings['nviz']['view']['z-exag']['original'] = 1
+ self.internalSettings['nviz']['view']['z-exag']['llRatio'] = 1
self.internalSettings['nviz']['view']['rotation'] = None
self.internalSettings['nviz']['view']['focus'] = {}
self.internalSettings['nviz']['view']['focus']['x'] = -1
Modified: grass/branches/develbranch_6/gui/wxpython/core/workspace.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/workspace.py 2012-05-26 11:20:48 UTC (rev 51770)
+++ grass/branches/develbranch_6/gui/wxpython/core/workspace.py 2012-05-26 11:24:15 UTC (rev 51771)
@@ -469,7 +469,7 @@
view['z-exag']['value'] = self.__processLayerNvizNode(node_zexag, 'value', float)
view['z-exag']['min'] = self.__processLayerNvizNode(node_zexag, 'min', int)
view['z-exag']['max'] = self.__processLayerNvizNode(node_zexag, 'max', int)
- iview['z-exag']['original'] = self.__processLayerNvizNode(node_zexag, 'original', float)
+ iview['z-exag']['llRatio'] = self.__processLayerNvizNode(node_zexag, 'llRatio', float)
node_focus = node_view.find('focus')
iview['focus'] = {}
iview['focus']['x'] = self.__processLayerNvizNode(node_focus, 'x', int)
@@ -892,7 +892,7 @@
self.file.write('%s<value>%.2f</value>\n' % (' ' * self.indent, view['z-exag']['value']))
self.file.write('%s<min>%d</min>\n' % (' ' * self.indent, view['z-exag']['min']))
self.file.write('%s<max>%d</max>\n' % (' ' * self.indent, view['z-exag']['max']))
- self.file.write('%s<original>%.2f</original>\n' % (' ' * self.indent, iview['z-exag']['original']))
+ self.file.write('%s<llRatio>%.2f</llRatio>\n' % (' ' * self.indent, iview['z-exag']['llRatio']))
self.indent -= 4
self.file.write('%s</z-exag>\n' % (' ' * self.indent))
# focus (look here)
Modified: grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py 2012-05-26 11:20:48 UTC (rev 51770)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py 2012-05-26 11:24:15 UTC (rev 51771)
@@ -1082,9 +1082,8 @@
view = self.view
iview = self.iview
if zexag and 'value' in view['z-exag']:
- self._display.SetZExag(self.iview['z-exag']['original'] * view['z-exag']['value'])
+ self._display.SetZExag(view['z-exag']['value'] / iview['z-exag']['llRatio'])
-
self._display.SetView(view['position']['x'], view['position']['y'],
iview['height']['value'],
view['persp']['value'],
@@ -1756,18 +1755,29 @@
def ResetView(self):
"""!Reset to default view"""
- self.iview['z-exag']['original'], \
+ zexagOriginal, \
self.iview['height']['value'], \
self.iview['height']['min'], \
self.iview['height']['max'] = self._display.SetViewDefault()
-
- ## set initial z-exag value at 1X
- self.view['z-exag']['value'] = 1.0
+ ## hack for latlon projection
+ ## TODO find more precise way or better rewrite it in OGSF
+ self.iview['z-exag']['llRatio'] = 1
+ if grass.locn_is_latlong():
+ self.iview['z-exag']['llRatio'] = \
+ math.pi / 180 * 6371000 * math.cos((grass.region()['n'] + grass.region()['s']) / 2)
+
+ self.view['z-exag']['value'] = round(zexagOriginal * self.iview['z-exag']['llRatio'])
self.view['z-exag']['min'] = UserSettings.Get(group = 'nviz', key = 'view',
- subkey = ('z-exag', 'min'))
+ subkey = ('z-exag', 'min'))
zexagMax = UserSettings.Get(group = 'nviz', key = 'view',
- subkey = ('z-exag', 'max'))
+ subkey = ('z-exag', 'max'))
+ if zexagMax <= self.view['z-exag']['value']:
+ self.view['z-exag']['max'] = self.view['z-exag']['value'] * 2
+ elif self.view['z-exag']['value'] < 1:
+ self.view['z-exag']['max'] = 10 * self.view['z-exag']['value']
+ else:
+ self.view['z-exag']['max'] = zexagMax
self.view['position']['x'] = UserSettings.Get(group = 'nviz', key = 'view',
subkey = ('position', 'x'))
@@ -2395,7 +2405,7 @@
subcmd += "height=%d " % (self.iview['height']['value'])
subcmd += "perspective=%d " % (self.view['persp']['value'])
subcmd += "twist=%d " % (self.view['twist']['value'])
- subcmd += "zexag=%d " % (self.view['z-exag']['value'] * self.iview['z-exag']['original'])
+ subcmd += "zexag=%f " % (self.view['z-exag']['value'] / self.iview['z-exag']['llRatio'])
subcmd += "focus=%d,%d,%d " % (self.iview['focus']['x'],self.iview['focus']['y'],self.iview['focus']['z'])
cmd += subcmd
More information about the grass-commit
mailing list