[GRASS-SVN] r67864 - in grass/trunk/gui/wxpython: core gui_core lmgr mapdisp mapwin nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 17 05:52:55 PST 2016


Author: martinl
Date: 2016-02-17 05:52:55 -0800 (Wed, 17 Feb 2016)
New Revision: 67864

Modified:
   grass/trunk/gui/wxpython/core/gconsole.py
   grass/trunk/gui/wxpython/core/giface.py
   grass/trunk/gui/wxpython/core/layerlist.py
   grass/trunk/gui/wxpython/core/render.py
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/gui/wxpython/core/workspace.py
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/lmgr/giface.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
   grass/trunk/gui/wxpython/mapdisp/main.py
   grass/trunk/gui/wxpython/mapwin/buffered.py
   grass/trunk/gui/wxpython/nviz/mapwindow.py
   grass/trunk/gui/wxpython/nviz/tools.py
Log:
wxGUI: rename map layer type '3d-raster' to 'raster_3d' (sync with g.list)


Modified: grass/trunk/gui/wxpython/core/gconsole.py
===================================================================
--- grass/trunk/gui/wxpython/core/gconsole.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/core/gconsole.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -676,7 +676,7 @@
         name = task.get_name()
         for p in task.get_options()['params']:
             prompt = p.get('prompt', '')
-            if prompt in ('raster', 'vector', '3d-raster') and p.get('value', None):
+            if prompt in ('raster', 'vector', 'raster_3d') and p.get('value', None):
                 if p.get('age', 'old') == 'new' or \
                         name in ('r.colors', 'r3.colors', 'v.colors', 'v.proj', 'r.proj'):
                     # if multiple maps (e.g. r.series.interp), we need add each

Modified: grass/trunk/gui/wxpython/core/giface.py
===================================================================
--- grass/trunk/gui/wxpython/core/giface.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/core/giface.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -77,7 +77,7 @@
 
         Launches property dialog if needed (raster, vector, etc.)
 
-        :param ltype: layer type (raster, vector, 3d-raster, ...)
+        :param ltype: layer type (raster, vector, raster_3d, ...)
         :param name: layer name
         :param checked: if True layer is checked
         :param opacity: layer opacity level

Modified: grass/trunk/gui/wxpython/core/layerlist.py
===================================================================
--- grass/trunk/gui/wxpython/core/layerlist.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/core/layerlist.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -73,7 +73,7 @@
                     opacity=1, label=None, pos=0):
         """Creates new layer and adds it to the list (insert to the first position).
 
-        :param ltype: layer type (raster, vector, 3d-raster, ...)
+        :param ltype: layer type (raster, vector, raster_3d, ...)
         :param cmd: command (given as a list)
         :param active: if True layer is active
         :param hidden: if True layer is hidden
@@ -357,16 +357,7 @@
 
     def AddLayer(self, index, layer):
         """Adds layer to renderer (prepends)."""
-        mapType = None
-        if layer.mapType == 'raster':
-            mapType = 'raster'
-        elif layer.mapType == 'vector':
-            mapType = 'vector'
-        elif layer.mapType == 'raster_3d':
-            mapType = '3d-raster'
-        elif layer.mapType == 'rgb':
-            mapType = 'rgb'
-        self._renderer.AddLayer(ltype=mapType, command=layer.cmd,
+        self._renderer.AddLayer(ltype=layer.mapType, command=layer.cmd,
                                 name=layer.name, active=layer.active,
                                 hidden=False, opacity=layer.opacity,
                                 render=True, pos=-1)

Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/core/render.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -133,7 +133,7 @@
             return None
 
         # ignore in 2D
-        if self.type == '3d-raster':
+        if self.type == 'raster_3d':
             return None
 
         Debug.msg (3, "Layer.Render(): type=%s, name=%s, file=%s" % \
@@ -465,7 +465,7 @@
         self.layers = self.Map.GetListOfLayers(ltype='overlay', active=True)
         if not overlaysOnly:
             self.layers += self.Map.GetListOfLayers(active=True,
-                                                    ltype='3d-raster',
+                                                    ltype='raster_3d',
                                                     except_ltype=True)
         
         # reset progress

Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/core/utils.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -94,7 +94,7 @@
     :param fullyQualified: change map name to be fully qualified
     :param param: params directory
     :param str layerType: check also layer type ('raster', 'vector',
-                          '3d-raster', ...)
+                          'raster_3d', ...)
     
     :return: tuple (name, found)
     """
@@ -156,11 +156,11 @@
             mapname = v
             mapset = ''
             if fullyQualified and '@' not in mapname:
-                if layerType in ('raster', 'vector', '3d-raster', 'rgb', 'his'):
+                if layerType in ('raster', 'vector', 'raster_3d', 'rgb', 'his'):
                     try:
                         if layerType in ('raster', 'rgb', 'his'):
                             findType = 'cell'
-                        elif layerType == '3d-raster':
+                        elif layerType == 'raster_3d':
                             findType = 'grid3'
                         else:
                             findType = layerType
@@ -948,7 +948,7 @@
     return (rgb, label)
 
 command2ltype = {'d.rast'         : 'raster',
-                 'd.rast3d'       : '3d-raster',
+                 'd.rast3d'       : 'raster_3d',
                  'd.rgb'          : 'rgb',
                  'd.his'          : 'his',
                  'd.shade'        : 'shaded',

Modified: grass/trunk/gui/wxpython/core/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/core/workspace.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/core/workspace.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -895,7 +895,7 @@
                     self.file.write('%s<nviz>\n' % (' ' * self.indent))
                     if maplayer.type == 'raster':
                         self.__writeNvizSurface(nviz['surface'])
-                    if maplayer.type == '3d-raster':
+                    if maplayer.type == 'raster_3d':
                         self.__writeNvizVolume(nviz['volume'])
                     elif maplayer.type == 'vector':
                         self.__writeNvizVector(nviz['vector'])

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -564,7 +564,7 @@
             addLayer = False
             for p in self.task.params:
                 if p.get('age', 'old') == 'new' and \
-                   p.get('prompt', '') in ('raster', 'vector', '3d-raster'):
+                   p.get('prompt', '') in ('raster', 'vector', 'raster_3d'):
                     addLayer = True
             
             if addLayer:
@@ -2551,7 +2551,7 @@
                     element = p.get('element', '') 
                     if age == 'old' and \
                             element in ('cell', 'grid3', 'vector') and \
-                            prompt in ('raster', '3d-raster', 'vector'):
+                            prompt in ('raster', 'raster_3d', 'vector'):
                         return p.get('name', None)
         return None
 

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -1889,19 +1889,16 @@
         for layerName in mapLayers:
             if ltype == 'raster':
                 cmd = ['d.rast', 'map=%s' % layerName]
-                wxType = 'raster'
             elif ltype == 'raster_3d':
                 cmd = ['d.rast3d', 'map=%s' % layerName]
-                wxType = '3d-raster'
             elif ltype == 'vector':
                 cmd = ['d.vect', 'map=%s' % layerName] + GetDisplayVectSettings()
-                wxType = 'vector'
             else:
                 GError(parent = self,
                        message = _("Unsupported map layer type <%s>.") % ltype)
                 return
             
-            newItem = maptree.AddLayer(ltype = wxType,
+            newItem = maptree.AddLayer(ltype = ltype,
                                        lname = layerName,
                                        lchecked = check,
                                        lopacity = 1.0,
@@ -1933,21 +1930,11 @@
     def AddOrUpdateMap(self, mapName, ltype):
         """Add map layer or update"""
         # start new map display if no display is available
+        if ltype not in ['raster', 'raster_3d', 'vector']:
+            GError(parent = self,
+                   message = _("Unsupported map layer type <%s>.") % ltype)
+            return
 
-        # TODO: standardize type identifiers
-        convertType = {'raster': 'raster',
-                       '3d-raster': 'raster_3d',
-                       'vector': 'vector'}
-        try:
-            grassType = convertType[ltype]
-        except KeyError:
-            if ltype in convertType.values():
-                grassType = ltype
-            else:
-                GError(parent = self,
-                       message = _("Unsupported map layer type <%s>.") % ltype)
-                return
-
         if not self.currentPage:
             self.AddMaps([mapName], grassType, check = True)
         else:
@@ -1974,7 +1961,7 @@
         if not self.currentPage:
             self.NewDisplay(show = True)
         
-        self._popupMenu((('layer3d-raster', self.OnAddRaster3D),
+        self._popupMenu((('layerRaster_3d', self.OnAddRaster3D),
                          (None, None),
                          ('layerRgb',    self.OnAddRasterRGB),
                          ('layerHis',    self.OnAddRasterHIS),
@@ -2037,7 +2024,7 @@
     def OnAddRaster3D(self, event):
         """Add 3D raster map to the current layer tree"""
         self.notebook.SetSelectionByName('layers')
-        self.GetLayerTree().AddLayer('3d-raster')
+        self.GetLayerTree().AddLayer('raster_3d')
 
     def OnAddRasterRGB(self, event):
         """Add RGB raster map to the current layer tree"""

Modified: grass/trunk/gui/wxpython/lmgr/giface.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/giface.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/lmgr/giface.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -95,7 +95,7 @@
 
         Launches property dialog if needed (raster, vector, etc.)
 
-        :param ltype: layer type (raster, vector, 3d-raster, ...)
+        :param ltype: layer type (raster, vector, raster_3d, ...)
         :param name: layer name
         :param checked: if True layer is checked
         :param opacity: layer opacity level

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -100,7 +100,7 @@
                             label = _('Add rhumbline layer')),
     'layerLabels'  : MetaIcon(img = 'label',
                             label = _('Add labels')),
-    'layer3d-raster'  : MetaIcon(img = 'raster3d',
+    'layerRaster_3d'  : MetaIcon(img = 'raster3d',
                             label = _('Add 3D raster map layer'),
                             desc  =  _('Note that 3D raster data are rendered only in 3D view mode')),
     'layerWms'      :  MetaIcon(img = 'wms',
@@ -217,7 +217,7 @@
 
     def _setIcons(self, il):
         self._icon = {}
-        for iconName in ("layerRaster", "layer3d-raster", "layerRgb",
+        for iconName in ("layerRaster", "layerRaster_3d", "layerRgb",
                          "layerHis", "layerShaded", "layerRastarrow",
                          "layerRastnum", "layerVector", "layerThememap",
                          "layerThemechart", "layerGrid", "layerGeodesic",
@@ -439,7 +439,7 @@
         if ltype not in ("group", "command"):
             if numSelected == 1:
                 self.popupMenu.AppendSeparator()
-                if ltype != '3d-raster':
+                if ltype != 'raster_3d':
                     item = wx.MenuItem(self.popupMenu, id = self.popupID['opacity'], text=_("Change opacity level"))
                     item.SetBitmap(MetaIcon(img = 'layer-opacity').GetBitmap(self.bmpsize))
                     self.popupMenu.AppendItem(item)
@@ -449,11 +449,11 @@
                 self.popupMenu.AppendItem(item)
                 self.Bind(wx.EVT_MENU, self.OnPopupProperties, id = self.popupID['properties'])
             
-                if ltype in ('raster', 'vector', '3d-raster') and self.mapdisplay.IsPaneShown('3d'):
+                if ltype in ('raster', 'vector', 'raster_3d') and self.mapdisplay.IsPaneShown('3d'):
                     self.popupMenu.Append(self.popupID['nviz'], _("3D view properties"))
                     self.Bind (wx.EVT_MENU, self.OnNvizProperties, id = self.popupID['nviz'])
 
-            if same and ltype in ('raster', 'vector', 'rgb', '3d-raster'):
+            if same and ltype in ('raster', 'vector', 'rgb', 'raster_3d'):
                 self.popupMenu.AppendSeparator()
                 item = wx.MenuItem(self.popupMenu, id = self.popupID['zoom'], text = _("Zoom to selected map(s)"))
                 item.SetBitmap(MetaIcon(img = 'zoom-layer').GetBitmap(self.bmpsize))
@@ -639,7 +639,7 @@
                 self.popupMenu.AppendItem(item)
                 self.Bind (wx.EVT_MENU, self.OnMetadata, id = self.popupID['meta'])
             
-        elif mltype and mltype == '3d-raster':
+        elif mltype and mltype == 'raster_3d':
             if numSelected == 1:
                 self.popupMenu.AppendSeparator()
                 self.popupMenu.Append(self.popupID['color'], _("Set color table"))
@@ -698,7 +698,7 @@
             cmd = ['r.info']
         elif mltype == 'vector':
             cmd = ['v.info']
-        elif mltype == '3d-raster':
+        elif mltype == 'raster_3d':
             cmd = ['r3.info']
         cmd.append('map=%s' % mapLayer.GetName())
 
@@ -733,7 +733,7 @@
                 rast.append(mapLayer.GetName())
             elif mltype == 'vector':
                 vect.append(mapLayer.GetName())
-            elif mltype == '3d-raster':
+            elif mltype == 'raster_3d':
                 rast3d.append(mapLayer.GetName())
             elif mltype == 'rgb':
                 for rname in mapLayer.GetName().splitlines():
@@ -749,7 +749,7 @@
         
         # print output to command log area
         if len(cmd) > 1:
-            if mltype == '3d-raster':
+            if mltype == 'raster_3d':
                 cmd.append('-3')
             self._giface.RunCmd(cmd, compReg = False,
                                 notification=Notification.NO_NOTIFICATION)
@@ -773,7 +773,7 @@
         raster2d = []
         raster3d = []
         for layer in self.GetSelectedLayers():
-            if self.GetLayerInfo(layer, key='type') == '3d-raster':
+            if self.GetLayerInfo(layer, key='type') == 'raster_3d':
                 raster3d.append(self.GetLayerInfo(layer, key = 'maplayer').GetName())
             else:
                 raster2d.append(self.GetLayerInfo(layer, key = 'maplayer').GetName())
@@ -805,7 +805,7 @@
             key = 'vector'
             module = 'vect'
             label = _('Vector map')
-        elif ltype == '3d-raster':
+        elif ltype == 'raster_3d':
             key = 'raster_3d'
             module = 'rast3d'
             label = _('3D raster map')
@@ -877,7 +877,7 @@
         raster2d = []
         raster3d = []
         for layer in self.GetSelectedLayers():
-            if self.GetLayerInfo(layer, key='type') == '3d-raster':
+            if self.GetLayerInfo(layer, key='type') == 'raster_3d':
                 raster3d.append(self.GetLayerInfo(layer, key = 'maplayer').GetName())
             else:
                 raster2d.append(self.GetLayerInfo(layer, key = 'maplayer').GetName())
@@ -1010,7 +1010,7 @@
             self.lmgr.nviz.SetPage('surface')
         elif ltype == 'vector':
             self.lmgr.nviz.SetPage('vector')
-        elif ltype == '3d-raster':
+        elif ltype == 'raster_3d':
             self.lmgr.nviz.SetPage('volume')
         
     def OnRenameLayer (self, event):
@@ -1035,7 +1035,7 @@
         """Add new item to the layer tree, create corresponding MapLayer instance.
         Launch property dialog if needed (raster, vector, etc.)
 
-        :param ltype: layer type (raster, vector, 3d-raster, ...)
+        :param ltype: layer type (raster, vector, raster_3d, ...)
         :param lname: layer name
         :param lchecked: if True layer is checked
         :param lopacity: layer opacity level
@@ -1127,7 +1127,7 @@
         else:
             if ltype in self._icon:
                 self.SetItemImage(layer, self._icon[ltype])
-                # do not use title() - will not work with ltype == '3d-raster'
+                # do not use title() - will not work with ltype == 'raster_3d'
                 self.SetItemText(layer, '%s %s' % (LMIcons["layer"+ltype[0].upper()+ltype[1:]].GetLabel(),
                                                    _('(double click to set properties)') + ' ' * 15))
             else:
@@ -1369,7 +1369,7 @@
             if checked: # enable
                 if mapLayer.type == 'raster':
                     self.mapdisplay.MapWindow.LoadRaster(item)
-                elif mapLayer.type == '3d-raster':
+                elif mapLayer.type == 'raster_3d':
                     self.mapdisplay.MapWindow.LoadRaster3d(item)
                 elif mapLayer.type == 'vector':
                     vInfo = gvector.vector_info_topo(mapLayer.GetName())
@@ -1381,7 +1381,7 @@
             else: # disable
                 if mapLayer.type == 'raster':
                     self.mapdisplay.MapWindow.UnloadRaster(item)
-                elif mapLayer.type == '3d-raster':
+                elif mapLayer.type == 'raster_3d':
                     self.mapdisplay.MapWindow.UnloadRaster3d(item)
                 elif mapLayer.type == 'vector':
                     self.mapdisplay.MapWindow.UnloadVector(item)
@@ -1493,7 +1493,7 @@
                 elif type == 'vector':
                     self.lmgr.nviz.UpdatePage('vector')
                     self.lmgr.nviz.SetPage('vector')
-                elif type == '3d-raster':
+                elif type == 'raster_3d':
                     self.lmgr.nviz.UpdatePage('volume')
                     self.lmgr.nviz.SetPage('volume')
 
@@ -1709,7 +1709,7 @@
                     
                     mapWin.LoadRaster(layer)
                     
-                elif mapLayer.type == '3d-raster':
+                elif mapLayer.type == 'raster_3d':
                     if mapWin.IsLoaded(layer):
                         mapWin.UnloadRaster3d(layer)
                     
@@ -1722,7 +1722,7 @@
                     mapWin.LoadVector(layer)
 
                 # reset view when first layer loaded
-                nlayers = len(mapWin.Map.GetListOfLayers(ltype = ('raster', '3d-raster', 'vector'),
+                nlayers = len(mapWin.Map.GetListOfLayers(ltype = ('raster', 'raster_3d', 'vector'),
                                                          active = True))
                 if nlayers < 2:
                     mapWin.ResetView()

Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/mapdisp/main.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -319,7 +319,7 @@
 
         Launches property dialog if needed (raster, vector, etc.)
 
-        :param ltype: layer type (raster, vector, 3d-raster, ...)
+        :param ltype: layer type (raster, vector, raster_3d, ...)
         :param name: layer name
         :param checked: if True layer is checked
         :param opacity: layer opacity level

Modified: grass/trunk/gui/wxpython/mapwin/buffered.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/buffered.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/mapwin/buffered.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -1814,7 +1814,7 @@
             # only one raster is used: g.region does not support multiple
             if l.type == 'raster':
                 rast.append(l.GetName())
-            elif l.type == '3d-raster':
+            elif l.type == 'raster_3d':
                 rast3d = l.GetName()
             elif l.type == 'vector':
                 if self.digit and \

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -942,7 +942,7 @@
                     if event.CmdDown() and id1 == data['surface']['object']['id']:
                         break
                     
-                elif mapLayer.GetType() == '3d-raster':
+                elif mapLayer.GetType() == 'raster_3d':
                     if 'x' not in data['volume']['position']:
                         data['volume']['position']['x'] = 0
                         data['volume']['position']['y'] = 0
@@ -1304,7 +1304,7 @@
                 continue
                 
             if not item.IsChecked() or \
-                    type not in ('raster', 'vector', '3d-raster'):
+                    type not in ('raster', 'vector', 'raster_3d'):
                 item = self.tree.GetNextItem(item)
                 continue
             
@@ -1339,7 +1339,7 @@
             try:
                 if type ==  'raster':
                     self.LoadRaster(item)
-                elif type ==  '3d-raster':
+                elif type ==  'raster_3d':
                     self.LoadRaster3d(item)
                 elif type ==  'vector':
                     layer = self.tree.GetLayerInfo(item, key = 'maplayer')
@@ -1384,7 +1384,7 @@
             try:
                 if ltype ==  'raster':
                     self.UnloadRaster(layer)
-                elif ltype ==  '3d-raster':
+                elif ltype ==  'raster_3d':
                     self.UnloadRaster3d(layer) 
                 elif ltype ==  'vector':
                     maplayer = self.tree.GetLayerInfo(layer, key = 'maplayer')
@@ -1473,7 +1473,7 @@
                 self.SetVectorSurface(data['vector']['points'])
                 self.SetVectorSurface(data['vector']['lines'])
                 
-            elif mapType ==  '3d-raster':
+            elif mapType ==  'raster_3d':
                 # reset to default properties 
                 data[nvizType] = self.nvizDefault.SetVolumeDefaultProp()
                 
@@ -1509,7 +1509,7 @@
         
         # set id
         if id > 0:
-            if mapType in ('raster', '3d-raster'):
+            if mapType in ('raster', 'raster_3d'):
                 data[nvizType]['object'] = { 'id' : id,
                                             'init' : False }
             elif mapType ==  'vector':
@@ -1542,14 +1542,14 @@
         """
         layer = self.tree.GetLayerInfo(item, key = 'maplayer')
         
-        if layer.type not in ('raster', '3d-raster'):
+        if layer.type not in ('raster', 'raster_3d'):
             return
         
         if layer.type ==  'raster':
             id = self._display.LoadSurface(str(layer.name), None, None)
             nvizType = 'surface'
             errorMsg = _("Loading raster map")
-        elif layer.type ==  '3d-raster':
+        elif layer.type ==  'raster_3d':
             id = self._display.LoadVolume(str(layer.name), None, None)
             nvizType = 'volume'
             errorMsg = _("Loading 3d raster map")
@@ -1557,7 +1557,7 @@
             id = -1
         
         if id < 0:
-            if layer.type in ('raster', '3d-raster'):
+            if layer.type in ('raster', 'raster_3d'):
                 self.log.WriteError("%s <%s> %s" % (errorMsg, layer.name, _("failed")))
             else:
                 self.log.WriteError(_("Unsupported layer type '%s'") % layer.type)
@@ -1664,7 +1664,7 @@
         """
         layer = self.tree.GetLayerInfo(item, key = 'maplayer')
         
-        if layer.type not in ('raster', '3d-raster'):
+        if layer.type not in ('raster', 'raster_3d'):
             return
         
         data = self.tree.GetLayerInfo(item, key = 'nviz')
@@ -1702,7 +1702,7 @@
                 win.SetItems(self.GetLayerNames(layer.type))
                 win = toolWin.FindWindowById(toolWin.win['surface']['map'])
                 win.SetValue('')
-            if layer.type ==  '3d-raster':
+            if layer.type ==  'raster_3d':
                 win = toolWin.FindWindowById(toolWin.win['volume']['map'])
                 win.SetValue('')
             if layer.type ==  'vector':
@@ -2258,7 +2258,7 @@
                         return data['vector']['points']['object']['id']
                     elif vsubtyp ==  'vline':
                         return data['vector']['lines']['object']['id']
-                elif type ==  '3d-raster':
+                elif type ==  'raster_3d':
                     return data['volume']['object']['id']
             except KeyError:
                 return -1
@@ -2290,7 +2290,7 @@
         for item in self.layers:
             if self.tree.GetLayerInfo(item, key = 'type') == 'raster':
                 rasters.append(item)
-            elif self.tree.GetLayerInfo(item, key = 'type') == '3d-raster':
+            elif self.tree.GetLayerInfo(item, key = 'type') == 'raster_3d':
                 volumes.append(item)
             elif self.tree.GetLayerInfo(item, key = 'type') == 'vector':
                 vectors.append(item)

Modified: grass/trunk/gui/wxpython/nviz/tools.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/tools.py	2016-02-17 13:23:33 UTC (rev 67863)
+++ grass/trunk/gui/wxpython/nviz/tools.py	2016-02-17 13:52:55 UTC (rev 67864)
@@ -129,7 +129,7 @@
         
     def SetInitialMaps(self):
         """Set initial raster and vector map"""
-        for ltype in ('raster', 'vector', '3d-raster'):
+        for ltype in ('raster', 'vector', 'raster_3d'):
             selectedLayer = self.tree.GetSelectedLayer(multi = False, checkedOnly = True)
             if selectedLayer is None:
                 continue
@@ -147,7 +147,7 @@
                 self.FindWindowById(self.win['fringe']['map']).SetValue(selection)
             elif ltype == 'vector':
                 self.FindWindowById(self.win['vector']['map']).SetValue(selection)
-            elif ltype == '3d-raster':
+            elif ltype == 'raster_3d':
                 self.FindWindowById(self.win['volume']['map']).SetValue(selection)
                
     def UpdateState(self, **kwargs):
@@ -1515,8 +1515,6 @@
     def GselectOnPopup(self, ltype, exclude = False):
         """Update gselect.Select() items"""
         maps = list()
-        # TODO: sync the element names
-        ltype = '3d-raster' if ltype == 'raster_3d' else ltype
         for layer in self.mapWindow.Map.GetListOfLayers(ltype = ltype, active = True):
             maps.append(layer.GetName())
         return maps, exclude
@@ -2055,7 +2053,7 @@
         elif nvizType == 'vector':
             return self._getLayerPropertiesByName(name, mapType = 'vector')
         elif nvizType == 'volume':
-            return self._getLayerPropertiesByName(name, mapType = '3d-raster')
+            return self._getLayerPropertiesByName(name, mapType = 'raster_3d')
         
         return None
 
@@ -2063,7 +2061,7 @@
         """Get layer (render.Layer) by name and type.
 
         :param name: layer name
-        :param mapType: map type (raster, vector, 3d-raster)
+        :param mapType: map type (raster, vector, raster_3d)
         """
         layers = self.mapWindow.Map.GetListOfLayers(ltype = mapType, name = name)
         if layers:
@@ -2074,7 +2072,7 @@
         """Get nviz properties stored in layertree items by name and type.
 
         :param name: layer name
-        :param mapType: map type (raster, vector, 3d-raster)
+        :param mapType: map type (raster, vector, raster_3d)
         """
         items = self.tree.FindItemByData(key = 'name', value = name)
         if not items:
@@ -2810,12 +2808,12 @@
         """3D Raster map selected, update surface page"""
         name = event.GetString()
         try:
-            data = self._getLayerPropertiesByName(name, mapType = '3d-raster')['volume']
+            data = self._getLayerPropertiesByName(name, mapType = 'raster_3d')['volume']
         except:
             self.EnablePage('volume', False)
             return
         
-        layer = self._getMapLayerByName(name, mapType = '3d-raster')
+        layer = self._getMapLayerByName(name, mapType = 'raster_3d')
         self.EnablePage('volume', True)
         self.UpdateVolumePage(layer, data, updateName = False)
         
@@ -3023,7 +3021,7 @@
                                                    'value' : str(value),
                                                    'update' : None }
         else: # volume / isosurface
-            data = self._getLayerPropertiesByName(name, mapType = '3d-raster')
+            data = self._getLayerPropertiesByName(name, mapType = 'raster_3d')
             list = self.FindWindowById(self.win['volume']['isosurfs'])
             id = list.GetSelection()
             if id != -1:
@@ -3131,7 +3129,7 @@
                                                        'value' : str(value),
                                                        'update' : None }
             else:
-                data = self._getLayerPropertiesByName(name, mapType = '3d-raster')
+                data = self._getLayerPropertiesByName(name, mapType = 'raster_3d')
                 list = self.FindWindowById(self.win['volume']['isosurfs'])
                 id = list.GetSelection()
                 if id > -1:
@@ -3771,7 +3769,7 @@
         
         if event:
             name = self.FindWindowById(self.win['volume']['map']).GetValue()
-            layer = self._getMapLayerByName(name, mapType = '3d-raster')
+            layer = self._getMapLayerByName(name, mapType = 'raster_3d')
             self.UpdateVolumePage(layer, data, updateName = False)
             
         sizer.Layout()
@@ -3924,7 +3922,7 @@
         
         # update dialog
         name = self.FindWindowById(self.win['volume']['map']).GetValue()
-        layer = self._getMapLayerByName(name, mapType = '3d-raster')
+        layer = self._getMapLayerByName(name, mapType = 'raster_3d')
         
         if mode == 'isosurf':
             data = self.GetLayerData('volume')['volume']['isosurface'][selection]
@@ -3944,7 +3942,7 @@
         list = self.FindWindowById(self.win['volume'][mode + 's'])
         
         name = self.FindWindowById(self.win['volume']['map']).GetValue()
-        layer = self._getMapLayerByName(name, mapType = '3d-raster')
+        layer = self._getMapLayerByName(name, mapType = 'raster_3d')
         data = self.GetLayerData('volume')['volume']
         id = data['object']['id']
         
@@ -4019,7 +4017,7 @@
             list.SetSelection(list.GetCount()-1)
         
         name = self.FindWindowById(self.win['volume']['map']).GetValue()
-        layer = self._getMapLayerByName(name, mapType = '3d-raster')
+        layer = self._getMapLayerByName(name, mapType = 'raster_3d')
         data = self.GetLayerData('volume')['volume']
 
         vid = data['object']['id']
@@ -4063,7 +4061,7 @@
             return # this should not happen
         
         name = self.FindWindowById(self.win['volume']['map']).GetValue()
-        layer = self._getMapLayerByName(name, mapType = '3d-raster')
+        layer = self._getMapLayerByName(name, mapType = 'raster_3d')
         data = self.GetLayerData('volume')['volume']
         
         id = data['object']['id']
@@ -4104,7 +4102,7 @@
             return # this should not happen
         
         name = self.FindWindowById(self.win['volume']['map']).GetValue()
-        layer = self._getMapLayerByName(name, mapType = '3d-raster')
+        layer = self._getMapLayerByName(name, mapType = 'raster_3d')
         data = self.GetLayerData('volume')['volume']
         
         id = data['object']['id']
@@ -4559,7 +4557,7 @@
                     if layer:
                         self.UpdateVectorPage(layer, data['vector'])
                 elif pageId == 'volume':
-                    layer = self._getMapLayerByName(name, mapType = '3d-raster')
+                    layer = self._getMapLayerByName(name, mapType = 'raster_3d')
                     if layer:
                         self.UpdateVolumePage(layer, data['volume'])
         elif pageId == 'light':



More information about the grass-commit mailing list