[GRASS-SVN] r43026 - in grass/trunk/gui/wxpython: . gui_modules
icons
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 9 14:16:57 EDT 2010
Author: martinl
Date: 2010-08-09 18:16:56 +0000 (Mon, 09 Aug 2010)
New Revision: 43026
Modified:
grass/trunk/gui/wxpython/gui_modules/goutput.py
grass/trunk/gui/wxpython/gui_modules/layertree.py
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
grass/trunk/gui/wxpython/gui_modules/render.py
grass/trunk/gui/wxpython/gui_modules/toolbars.py
grass/trunk/gui/wxpython/icons/icon.py
grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI/nviz: fix volumes
Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -460,7 +460,7 @@
#
try:
layertype = {'d.rast' : 'raster',
- 'd.rast3d' : 'raster3d',
+ 'd.rast3d' : '3d-raster',
'd.rgb' : 'rgb',
'd.his' : 'his',
'd.shaded' : 'shaded',
Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -279,7 +279,7 @@
self.popupMenu.Append(self.popupID3, text=_("Properties"))
self.Bind(wx.EVT_MENU, self.OnPopupProperties, id=self.popupID3)
- if ltype in ('raster', 'vector', 'raster3d') and self.mapdisplay.toolbars['nviz']:
+ if ltype in ('raster', 'vector', '3d-raster') and self.mapdisplay.toolbars['nviz']:
self.popupMenu.Append(self.popupID11, _("3D view properties"))
self.Bind (wx.EVT_MENU, self.OnNvizProperties, id=self.popupID11)
@@ -618,7 +618,7 @@
self.lmgr.nviz.SetPage('surface')
elif ltype == 'vector':
self.lmgr.nviz.SetPage('vector')
- elif ltype == 'raster3d':
+ elif ltype == '3d-raster':
self.lmgr.nviz.SetPage('volume')
def RenameLayer (self, event):
@@ -812,11 +812,7 @@
# run properties dialog if no properties given
if len(cmd) == 0:
self.PropertiesDialog(layer, show=True)
-
- if ltype == '3d-raster' and \
- not self.mapdisplay.toolbars['nviz']:
- self.EnableItem(layer, False)
-
+
else: # group
self.SetPyData(layer, ({'cmd': None,
'type' : ltype,
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -395,10 +395,6 @@
self.toolbars['nviz'] = toolbars.NvizToolbar(self, self.Map)
self.toolbars['map'].Enable2D(False)
- # update layer tree (-> enable 3d-rasters)
- if self.tree:
- self.tree.EnableItemType(type='3d-raster', enable=True)
-
# update status bar
self.statusbarWin['toggle'].Enable(False)
@@ -479,11 +475,6 @@
# remove nviz notebook page
self._layerManager.RemoveNviz()
- # update layer tree (-> disable 3d-rasters)
- if self.tree:
- self.tree.EnableItemType(type='3d-raster', enable=False)
-
-
self.MapWindow.UpdateMap()
self.toolbars['map'].combo.SetValue (_("2D view"))
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -762,18 +762,22 @@
if self.tree:
self.tree.rerender = False
- if render:
- # update display size
- self.Map.ChangeMapSize(self.GetClientSize())
- if self.parent.statusbarWin['resolution'].IsChecked():
- # use computation region resolution for rendering
- windres = True
+ try:
+ if render:
+ # update display size
+ self.Map.ChangeMapSize(self.GetClientSize())
+ if self.parent.statusbarWin['resolution'].IsChecked():
+ # use computation region resolution for rendering
+ windres = True
+ else:
+ windres = False
+ self.mapfile = self.Map.Render(force = True, mapWindow = self.parent,
+ windres = windres)
else:
- windres = False
- self.mapfile = self.Map.Render(force=True, mapWindow=self.parent,
- windres=windres)
- else:
- self.mapfile = self.Map.Render(force=False, mapWindow=self.parent)
+ self.mapfile = self.Map.Render(force = False, mapWindow = self.parent)
+ except gcmd.GException, e:
+ gcmd.GError(message = e)
+ self.mapfile = None
self.img = self.GetImage() # id=99
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -886,9 +886,9 @@
# selection
box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
- label = " %s " % (_("3D Raster map")))
+ label = " %s " % (_("3D raster map")))
boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
- rmaps = gselect.Select(parent = panel, type = 'raster3d',
+ rmaps = gselect.Select(parent = panel, type = 'raster3D',
onPopup = self.GselectOnPopup)
rmaps.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetRaster3D)
self.win['volume']['map'] = rmaps.GetId()
@@ -1326,7 +1326,7 @@
elif nvizType == 'vector':
return self.mapWindow.GetLayerByName(name, mapType = 'vector', dataType = 'nviz')
elif nvizType == 'volume':
- return self.mapWindow.GetLayerByName(name, mapType = 'raster3d', dataType = 'nviz')
+ return self.mapWindow.GetLayerByName(name, mapType = '3d-raster', dataType = 'nviz')
return None
@@ -1521,12 +1521,12 @@
"""!3D Raster map selected, update surface page"""
name = event.GetString()
try:
- data = self.mapWindow.GetLayerByName(name, mapType = 'raster3d', dataType = 'nviz')['surface']
+ data = self.mapWindow.GetLayerByName(name, mapType = '3d-raster', dataType = 'nviz')['volume']
except:
self.EnablePage('volume', False)
return
- layer = self.mapWindow.GetLayerByName(name, mapType = 'raster3d')
+ layer = self.mapWindow.GetLayerByName(name, mapType = '3d-raster')
self.EnablePage('volume', True)
self.UpdateVolumePage(layer, data, updateName = False)
@@ -1665,7 +1665,7 @@
'value' : str(value),
'update' : None }
else: # volume / isosurface
- data = self.mapWindow.GetLayerByName(name, mapType = 'raster3d', dataType = 'nviz')
+ data = self.mapWindow.GetLayerByName(name, mapType = '3d-raster', dataType = 'nviz')
list = self.FindWindowById(self.win['volume']['isosurfs'])
id = list.GetSelection()
data[nvizType]['isosurface'][id][attrb] = { 'map' : useMap,
@@ -1760,12 +1760,13 @@
'value' : str(value),
'update' : None }
else:
- data = self.mapWindow.GetLayerByName(name, mapType = 'raster3d', dataType = 'nviz')
+ data = self.mapWindow.GetLayerByName(name, mapType = '3d-raster', dataType = 'nviz')
list = self.FindWindowById(self.win['volume']['isosurfs'])
id = list.GetSelection()
- data[nvizType]['isosurface'][id][attrb] = { 'map' : useMap,
- 'value' : str(value),
- 'update' : None }
+ if id > -1:
+ data[nvizType]['isosurface'][id][attrb] = { 'map' : useMap,
+ 'value' : str(value),
+ 'update' : None }
# update properties
event = wxUpdateProperties(data = data)
@@ -2272,7 +2273,7 @@
# update dialog
name = self.FindWindowById(self.win['volume']['map']).GetValue()
- layer = self.mapWindow.GetLayerByName(name, mapType = 'raster3d')
+ layer = self.mapWindow.GetLayerByName(name, mapType = '3d-raster')
data = self.GetLayerData('volume')['volume']['isosurface'][selection]
self.UpdateVolumeIsosurfPage(layer, data)
@@ -2294,7 +2295,7 @@
list.SetSelection(item)
name = self.FindWindowById(self.win['volume']['map']).GetValue()
- layer = self.mapWindow.GetLayerByName(name, mapType = 'raster3d')
+ layer = self.mapWindow.GetLayerByName(name, mapType = '3d-raster')
data = self.GetLayerData('volume')['volume']
id = data['object']['id']
@@ -2355,7 +2356,7 @@
list.SetSelection(list.GetCount()-1)
name = self.FindWindowById(self.win['volume']['map']).GetValue()
- layer = self.mapWindow.GetLayerByName(name, mapType = 'raster3d')
+ layer = self.mapWindow.GetLayerByName(name, mapType = '3d-raster')
data = self.GetLayerData('volume')['volume']
id = data['object']['id']
@@ -2382,7 +2383,7 @@
return # this should not happen
name = self.FindWindowById(self.win['volume']['map']).GetValue()
- layer = self.mapWindow.GetLayerByName(name, mapType = 'raster3d')
+ layer = self.mapWindow.GetLayerByName(name, mapType = '3d-raster')
data = self.GetLayerData('volume')['volume']
id = data['object']['id']
@@ -2414,7 +2415,7 @@
return # this should not happen
name = self.FindWindowById(self.win['volume']['map']).GetValue()
- layer = self.mapWindow.GetLayerByName(name, mapType = 'raster3d')
+ layer = self.mapWindow.GetLayerByName(name, mapType = '3d-raster')
data = self.GetLayerData('volume')['volume']
id = data['object']['id']
@@ -2470,7 +2471,7 @@
layer = self.mapWindow.GetLayerByName(name, mapType = 'vector')
self.UpdateVectorPage(layer, data['vector'])
elif pageId == 'volume':
- layer = self.mapWindow.GetLayerByName(name, mapType = 'raster3d')
+ layer = self.mapWindow.GetLayerByName(name, mapType = '3d-raster')
self.UpdateVectorPage(layer, data['vector'])
elif pageId == 'light':
zval = self.mapWindow.light['position']['z']
@@ -2712,14 +2713,10 @@
"""!Update volume page"""
if updateName:
self.FindWindowById(self.win['volume']['map']).SetValue(layer.name)
- # self.FindWindowById(self.win['volume']['desc']).SetLabel(desc)
-
list = self.FindWindowById(self.win['volume']['isosurfs'])
- #
# draw
- #
- for control, data in data['draw'].iteritems():
+ for control, idata in data['draw'].iteritems():
if control == 'all': # skip 'all' property
continue
@@ -2731,7 +2728,7 @@
else:
value = 1
else:
- value = data['value']
+ value = idata['value']
if win.GetName() == "selection":
win.SetSelection(value)
@@ -2740,7 +2737,7 @@
self.SetIsosurfaceMode(data['draw']['shading']['value'])
self.SetIsosurfaceResolution(data['draw']['resolution']['value'])
-
+
self.UpdateVolumeIsosurfPage(layer, data['attribute'])
def UpdateVolumeIsosurfPage(self, layer, data):
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -131,7 +131,7 @@
'overlay')
if self.type not in layertypes:
- raise gcmd.GException(_("<%(name)s>: layer type <%(type)s> is not supported yet.") % \
+ raise gcmd.GException(_("<%(name)s>: layer type <%(type)s> is not supported") % \
{'type' : self.type, 'name' : self.name})
#
Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -1706,6 +1706,7 @@
self.workspaceOpen = wx.NewId()
self.workspaceSave = wx.NewId()
self.addrast = wx.NewId()
+ self.addrast3d = wx.NewId()
self.addshaded = wx.NewId()
self.addvect = wx.NewId()
self.addthematic = wx.NewId()
@@ -1735,6 +1736,9 @@
(self.addrast, 'addrast', Icons["addrast"].GetBitmap(),
wx.ITEM_NORMAL, Icons["addrast"].GetLabel(), Icons["addrast"].GetDesc(),
self.parent.OnAddRaster),
+ (self.addrast3d, 'addrast3d', Icons["addrast3d"].GetBitmap(),
+ wx.ITEM_NORMAL, Icons["addrast3d"].GetLabel(), Icons["addrast3d"].GetDesc(),
+ self.parent.OnAddRaster3D),
(self.addshaded, 'addshaded', Icons["addshaded"].GetBitmap(),
wx.ITEM_NORMAL, _("Add various raster-based map layers"), "",
self.parent.OnAddRasterMisc),
Modified: grass/trunk/gui/wxpython/icons/icon.py
===================================================================
--- grass/trunk/gui/wxpython/icons/icon.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/icons/icon.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -192,9 +192,9 @@
"addvect" : MetaIcon (img=Icons["addvect"],
label=_("Add vector map layer (Ctrl+V)")),
"addcmd" : MetaIcon (img=Icons["addcmd"],
- label=_("Add command map layer")),
+ label=_("Add command layer")),
"addgrp" : MetaIcon (img=Icons["addgrp"],
- label=_("Add map layer group")),
+ label=_("Add group")),
"addovl" : MetaIcon (img=Icons["addovl"],
label=_("Add grid or vector labels overlay")),
"delcmd" : MetaIcon (img=Icons["delcmd"],
@@ -228,7 +228,8 @@
"addtext" : MetaIcon (img=Icons["addtext"],
label=_("Add text layer")),
"addrast3d" : MetaIcon (img=Icons["addrast3d"],
- label=_("Add 3D raster map layer")),
+ label=_("Add 3D raster map layer"),
+ desc = _("Note that 3D raster data are rendered only in 3D view mode")),
"settings" : MetaIcon (img=Icons["settings"],
label=_("Show GUI settings")),
# digit
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2010-08-09 16:45:03 UTC (rev 43025)
+++ grass/trunk/gui/wxpython/wxgui.py 2010-08-09 18:16:56 UTC (rev 43026)
@@ -98,14 +98,15 @@
GIS. Includes command console page for typing GRASS (and other)
commands, tree widget page for managing map layers.
"""
- def __init__(self, parent, id=wx.ID_ANY, title=_("GRASS GIS Layer Manager"),
- workspace=None):
+ def __init__(self, parent, id = wx.ID_ANY, title = _("GRASS GIS Layer Manager"),
+ workspace = None,
+ size = (575, 450), style = wx.DEFAULT_FRAME_STYLE, **kwargs):
self.parent = parent
self.baseTitle = title
self.iconsize = (16, 16)
- wx.Frame.__init__(self, parent=parent, id=id, size=(550, 450),
- style=wx.DEFAULT_FRAME_STYLE)
+ wx.Frame.__init__(self, parent = parent, id = id, size = size,
+ style = style, **kwargs)
self.SetTitle(self.baseTitle)
self.SetName("LayerManager")
@@ -1138,7 +1139,6 @@
return self.curr_page.maptree.mapdisplay
- # toolBar button handlers
def OnAddRaster(self, event):
"""!Add raster map layer"""
# start new map display if no display is available
@@ -1146,7 +1146,15 @@
self.NewDisplay(show=False)
self.AddRaster(event)
+
+ def OnAddRaster3D(self, event):
+ """!Add 3D raster map layer"""
+ # start new map display if no display is available
+ if not self.curr_page:
+ self.NewDisplay(show=False)
+ self.AddRaster3D(event)
+
def OnAddRasterMisc(self, event):
"""!Add raster menu"""
# start new map display if no display is available
@@ -1156,12 +1164,6 @@
point = wx.GetMousePosition()
rastmenu = wx.Menu()
- # add items to the menu
- addrast3d = wx.MenuItem(rastmenu, -1, Icons ["addrast3d"].GetLabel())
- addrast3d.SetBitmap(Icons["addrast3d"].GetBitmap (self.iconsize))
- rastmenu.AppendItem(addrast3d)
- self.Bind(wx.EVT_MENU, self.AddRaster3d, addrast3d)
-
addshaded = wx.MenuItem(rastmenu, -1, Icons ["addshaded"].GetLabel())
addshaded.SetBitmap(Icons["addshaded"].GetBitmap (self.iconsize))
rastmenu.AppendItem(addshaded)
@@ -1271,7 +1273,7 @@
self.notebook.SetSelection(0)
self.curr_page.maptree.AddLayer('raster')
- def AddRaster3d(self, event):
+ def AddRaster3D(self, event):
self.notebook.SetSelection(0)
self.curr_page.maptree.AddLayer('3d-raster')
More information about the grass-commit
mailing list