[GRASS-SVN] r53074 - in grass/trunk/gui/wxpython: core mapdisp nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Sep 3 08:44:53 PDT 2012
Author: annakrat
Date: 2012-09-03 08:44:52 -0700 (Mon, 03 Sep 2012)
New Revision: 53074
Modified:
grass/trunk/gui/wxpython/core/settings.py
grass/trunk/gui/wxpython/mapdisp/frame.py
grass/trunk/gui/wxpython/nviz/mapwindow.py
grass/trunk/gui/wxpython/nviz/tools.py
Log:
wxNviz: small changes in tooltips, default values suggested by Michael Barton
Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py 2012-09-03 15:23:00 UTC (rev 53073)
+++ grass/trunk/gui/wxpython/core/settings.py 2012-09-03 15:44:52 UTC (rev 53074)
@@ -706,7 +706,7 @@
'cplane' : {
'shading': 4,
'rotation':{
- 'rot': 0,
+ 'rot': 180,
'tilt': 0
},
'position':{
Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py 2012-09-03 15:23:00 UTC (rev 53073)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py 2012-09-03 15:44:52 UTC (rev 53074)
@@ -544,9 +544,9 @@
"""!Save map to image
"""
if self.IsPaneShown('3d'):
- filetype = "PPM file (*.ppm)|*.ppm|TIF file (*.tif)|*.tif"
- ltype = [{ 'ext' : 'ppm', 'type' : 'ppm' },
- { 'ext' : 'tif', 'type' : 'tif' }]
+ filetype = "TIF file (*.tif)|*.tif|PPM file (*.ppm)|*.ppm"
+ ltype = [{ 'ext' : 'tif', 'type' : 'tif' },
+ { 'ext' : 'ppm', 'type' : 'ppm' }]
else:
img = self.MapWindow.img
if not img:
Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py 2012-09-03 15:23:00 UTC (rev 53073)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py 2012-09-03 15:44:52 UTC (rev 53074)
@@ -168,7 +168,7 @@
self.Bind(EVT_UPDATE_PROP, self.UpdateMapObjProperties)
self.Bind(EVT_UPDATE_VIEW, self.OnUpdateView)
self.Bind(EVT_UPDATE_LIGHT, self.UpdateLight)
- self.Bind(EVT_UPDATE_CPLANE, self.UpdateCPlane)
+ self.Bind(EVT_UPDATE_CPLANE, self.OnUpdateCPlane)
self.Bind(wx.EVT_TIMER, self.OnTimerAnim, self.timerAnim)
self.Bind(wx.EVT_TIMER, self.OnTimerFly, self.timerFly)
@@ -1566,19 +1566,22 @@
except IndexError:
pass
- def UpdateCPlane(self, event):
+ def OnUpdateCPlane(self, event):
"""!Change cutting plane settings"""
- current = event.current
- for each in event.update:
+ self.UpdateCPlane(event.current, event.update)
+
+ def UpdateCPlane(self, index, changes):
+ """!Change cutting plane settings"""
+ for each in changes:
if each == 'rotation':
- self._display.SetCPlaneRotation(0, self.cplanes[current]['rotation']['tilt'],
- self.cplanes[current]['rotation']['rot'])
+ self._display.SetCPlaneRotation(0, self.cplanes[index]['rotation']['tilt'],
+ self.cplanes[index]['rotation']['rot'])
if each == 'position':
- self._display.SetCPlaneTranslation(self.cplanes[current]['position']['x'],
- self.cplanes[current]['position']['y'],
- self.cplanes[current]['position']['z'])
+ self._display.SetCPlaneTranslation(self.cplanes[index]['position']['x'],
+ self.cplanes[index]['position']['y'],
+ self.cplanes[index]['position']['z'])
if each == 'shading':
- self._display.SetFenceColor(self.cplanes[current]['shading'])
+ self._display.SetFenceColor(self.cplanes[index]['shading'])
def UnloadRaster(self, item):
"""!Unload 2d raster map
Modified: grass/trunk/gui/wxpython/nviz/tools.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/tools.py 2012-09-03 15:23:00 UTC (rev 53073)
+++ grass/trunk/gui/wxpython/nviz/tools.py 2012-09-03 15:44:52 UTC (rev 53074)
@@ -20,6 +20,7 @@
"""
import os
+import sys
import copy
import types
@@ -237,7 +238,7 @@
# perspective
# set initial defaults here (or perhaps in a default values file), not in user settings
#todo: consider setting an absolute max at 360 instead of undefined. (leave the default max value at pi)
- tooltip = _("Adjusts the viewer's angle of view")
+ tooltip = _("Adjusts the distance and angular perspective of the image viewpoint")
self._createControl(panel, data = self.win['view'], name = 'persp',
tooltip = tooltip, range = (1, 120),
bind = (self.OnViewChange, self.OnViewChanged, self.OnViewChangedText))
@@ -250,25 +251,23 @@
flag = wx.ALIGN_CENTER)
# twist
- tooltip = _("Rotates the scene about the horizontal axis."
- " An angle of 0 is flat. The scene rotates between -90 and 90 degrees.")
+ tooltip = _("Tilts the plane of the surface from the horizontal")
self._createControl(panel, data = self.win['view'], name = 'twist',
tooltip = tooltip, range = (-180,180),
bind = (self.OnViewChange, self.OnViewChanged, self.OnViewChangedText))
- gridSizer.Add(item = wx.StaticText(panel, id = wx.ID_ANY, label = _("Twist:")),
+ gridSizer.Add(item = wx.StaticText(panel, id = wx.ID_ANY, label = _("Tilt:")),
pos = (1, 1), flag = wx.ALIGN_CENTER)
gridSizer.Add(item = self.FindWindowById(self.win['view']['twist']['slider']), pos = (2, 1))
gridSizer.Add(item = self.FindWindowById(self.win['view']['twist']['text']), pos = (3, 1),
flag = wx.ALIGN_CENTER)
# height + z-exag
- tooltip = _("Adjusts the viewer's height above the scene")
+ tooltip = _("Adjusts the viewing height above the surface"
+ " (angle of view automatically adjusts to maintain the same center of view)")
self._createControl(panel, data = self.win['view'], name = 'height', sliderHor = False,
tooltip = tooltip, range = (0, 1),
bind = (self.OnViewChange, self.OnViewChanged, self.OnViewChangedText))
- tooltip = _("Adjusts the vertical exaggeration of the surface. "
- "As an example, if the easting and northing are in meters and the elevation in feet, "
- "a vertical exaggeration of .305 would produce a true (unexaggerated) surface. ")
+ tooltip = _("Adjusts the relative height of features above the plane of the surface")
self._createControl(panel, data = self.win['view'], name = 'z-exag', sliderHor = False,
tooltip = tooltip, range = (0, 10), floatSlider = True,
bind = (self.OnViewChange, self.OnViewChanged, self.OnViewChangedText))
@@ -485,7 +484,7 @@
key = 'animation', subkey = 'prefix'))
prefixCtrl.SetToolTipString(_("Generated files names will look like this: prefix_1.ppm, prefix_2.ppm, ..."))
fileTypeLabel = wx.StaticText(parent = panel, id = wx.ID_ANY, label = _("File format:"))
- fileTypeCtrl = wx.Choice(parent = panel, id = wx.ID_ANY, choices = ["PPM", "TIF"])
+ fileTypeCtrl = wx.Choice(parent = panel, id = wx.ID_ANY, choices = ["TIF", "PPM"])
save = wx.Button(parent = panel, id = wx.ID_ANY,
label = "Save")
@@ -872,7 +871,7 @@
self.win['surface']['position']['reset'] = reset.GetId()
self.win['surface']['position']['axis'] = axis.GetId()
- axis.SetSelection(0)
+ axis.SetSelection(2)
axis.Bind(wx.EVT_CHOICE, self.OnSurfaceAxis)
pslide = self.FindWindowById(self.win['surface']['position']['slider'])
@@ -1009,8 +1008,8 @@
self._createControl(panel, data = self.win['cplane']['rotation'], name = 'rot', size = 250,
range = (0, 360), sliderHor = True, tooltip = tooltip,
bind = (self.OnCPlaneChanging, self.OnCPlaneChangeDone, self.OnCPlaneChangeText))
- self.FindWindowById(self.win['cplane']['rotation']['rot']['slider']).SetValue(0)
- self.FindWindowById(self.win['cplane']['rotation']['rot']['text']).SetValue(0)
+ self.FindWindowById(self.win['cplane']['rotation']['rot']['slider']).SetValue(180)
+ self.FindWindowById(self.win['cplane']['rotation']['rot']['text']).SetValue(180)
gridSizer.Add(item = self.FindWindowById(self.win['cplane']['rotation']['rot']['slider']),
pos = (2, 1), flag = wx.EXPAND|wx.ALIGN_RIGHT)
gridSizer.Add(item = self.FindWindowById(self.win['cplane']['rotation']['rot']['text']),
@@ -1681,7 +1680,7 @@
self.win['volume']['position']['reset'] = reset.GetId()
self.win['volume']['position']['axis'] = axis.GetId()
- axis.SetSelection(0)
+ axis.SetSelection(2) # Z
axis.Bind(wx.EVT_CHOICE, self.OnVolumeAxis)
pslide = self.FindWindowById(self.win['volume']['position']['slider'])
@@ -2606,7 +2605,10 @@
ne = wx.Button(panel, id = wx.ID_ANY, label = _("NE"))
se = wx.Button(panel, id = wx.ID_ANY, label = _("SE"))
sw = wx.Button(panel, id = wx.ID_ANY, label = _("SW"))
- minWidth = sw.GetTextExtent(sw.GetLabel())[0] + 15
+ padding = 15
+ if sys.platform == 'darwin':
+ padding = 20
+ minWidth = sw.GetTextExtent(sw.GetLabel())[0] + padding
for win, name in zip((w, n, s, e, nw, ne, se, sw),
('w', 'n', 's', 'e', 'nw', 'ne', 'se', 'sw')):
win.SetMinSize((minWidth, -1))
@@ -2861,7 +2863,7 @@
for win in self.win['surface']['position'].itervalues():
if win == self.win['surface']['position']['axis']:
- self.FindWindowById(win).SetSelection(0)
+ self.FindWindowById(win).SetSelection(2) # Z
elif win == self.win['surface']['position']['reset']:
continue
else:
@@ -4132,7 +4134,7 @@
"""!Reset position of volume"""
for win in self.win['volume']['position'].itervalues():
if win == self.win['volume']['position']['axis']:
- self.FindWindowById(win).SetSelection(0)
+ self.FindWindowById(win).SetSelection(2) # Z
elif win == self.win['volume']['position']['reset']:
continue
else:
@@ -4254,6 +4256,9 @@
planeIndex = -1
self.EnablePage("cplane", enabled = False)
self.mapWindow.SelectCPlane(planeIndex)
+ if planeIndex >= 0:
+ self.mapWindow.UpdateCPlane(planeIndex, changes = ['rotation', 'position', 'shading'])
+
if self.mapDisplay.IsAutoRendered():
self.mapWindow.Refresh(False)
self.UpdateCPlanePage(planeIndex)
@@ -4320,8 +4325,10 @@
planeIndex = int(plane.split()[-1]) - 1
except:#TODO disabled page
planeIndex = -1
+
self.mapWindow.cplanes[planeIndex] = copy.deepcopy(UserSettings.Get(group = 'nviz',
key = 'cplane'))
+ self.mapWindow.cplanes[planeIndex]['on'] = True
event = wxUpdateCPlane(update = ('position','rotation','shading'), current = planeIndex)
wx.PostEvent(self.mapWindow, event)
self.OnCPlaneChangeDone(None)
@@ -4647,11 +4654,11 @@
#
dim = self._display.GetLongDim()
self.FindWindowById(self.win['surface']['position']['slider']).SetRange(-2 * dim, 2 * dim)
- if 'x' in data['position']:
- xval = data['position']['x']
- self.FindWindowById(self.win['surface']['position']['axis']).SetSelection(0)
+ if 'z' in data['position']:
+ zval = data['position']['z']
+ self.FindWindowById(self.win['surface']['position']['axis']).SetSelection(2)
for control in ('slider','text'):
- self.FindWindowById(self.win['surface']['position'][control]).SetValue(xval)
+ self.FindWindowById(self.win['surface']['position'][control]).SetValue(zval)
# enable/disable res widget + set draw mode
self.OnSurfaceMode(event = None)
@@ -4858,11 +4865,11 @@
#
# position
#
- if 'x' in data['position']:
- xval = data['position']['x']
- self.FindWindowById(self.win['volume']['position']['axis']).SetSelection(0)
+ if 'z' in data['position']:
+ zval = data['position']['z']
+ self.FindWindowById(self.win['volume']['position']['axis']).SetSelection(2)
for control in ('slider','text'):
- self.FindWindowById(self.win['volume']['position'][control]).SetValue(xval)
+ self.FindWindowById(self.win['volume']['position'][control]).SetValue(zval)
# set topo range
mapRange = self._get3dRange(name = layer.name)
desc = self.FindWindowById(self.win['volume']['desc'])
@@ -5059,8 +5066,7 @@
def __init__(self, parent, mapwindow, id = wx.ID_ANY,
**kwargs):
PositionWindow.__init__(self, parent, mapwindow, id, **kwargs)
- self.SetToolTipString(_("Adjusts the look direction (azimuth). "
- "Click and drag the puck to change the current eye position."))
+ self.SetToolTipString(_("Adjusts the distance and direction of the image viewpoint"))
self.data = self.mapWindow.view
self.PostDraw()
More information about the grass-commit
mailing list