[GRASS-SVN] r32657 - in grass/branches/develbranch_6: gui/wxpython/gui_modules gui/wxpython/nviz include lib/nviz lib/ogsf visualization/nviz2/cmd

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 9 17:28:55 EDT 2008


Author: martinl
Date: 2008-08-09 17:28:55 -0400 (Sat, 09 Aug 2008)
New Revision: 32657

Added:
   grass/branches/develbranch_6/gui/wxpython/nviz/volume.cpp
Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py
   grass/branches/develbranch_6/gui/wxpython/nviz/draw.cpp
   grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp
   grass/branches/develbranch_6/gui/wxpython/nviz/load.cpp
   grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h
   grass/branches/develbranch_6/gui/wxpython/nviz/nviz_types.i
   grass/branches/develbranch_6/gui/wxpython/nviz/surface.cpp
   grass/branches/develbranch_6/include/nviz.h
   grass/branches/develbranch_6/include/ogsf_proto.h
   grass/branches/develbranch_6/lib/nviz/draw.c
   grass/branches/develbranch_6/lib/nviz/map_obj.c
   grass/branches/develbranch_6/lib/ogsf/GVL2.c
   grass/branches/develbranch_6/lib/ogsf/gvld.c
   grass/branches/develbranch_6/visualization/nviz2/cmd/main.c
Log:
wxGUI/nviz: improvements in 3d raster data visualization (isosurface mode), some ogsflib doxygen updates

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2008-08-09 21:28:55 UTC (rev 32657)
@@ -193,8 +193,8 @@
         """
         if Debug.get_level() == 0:
             # don't redirect when debugging is enabled
-            #sys.stdout = self.cmd_stdout
-            #sys.stderr = self.cmd_stderr
+            sys.stdout = self.cmd_stdout
+            sys.stderr = self.cmd_stderr
             
             return True
 

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-08-09 21:28:55 UTC (rev 32657)
@@ -2627,7 +2627,7 @@
                         "Switching back to 2D display mode.\n\nDetails: %s" % nviz.errorMsg)
             if not nviz.haveNviz:
                 msg = _("Unable to start Nviz. Python extension "
-                        "for Nviz was not found. "
+                        "for Nviz was not found or loaded properly. "
                         "Switching back to 2D display mode.\n\nDetails: %s" % nviz.errorMsg)
 
             if msg:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz.py	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz.py	2008-08-09 21:28:55 UTC (rev 32657)
@@ -7,6 +7,7 @@
  - GLWindow
  - NvizToolWindow
  - ViewPositionWindow
+ - IsoSurfList
 
 (C) 2008 by the GRASS Development Team
 
@@ -264,12 +265,15 @@
         if self.render['quick'] is False:
             self.parent.onRenderGauge.SetValue(1)
             wx.Yield()
-            self.nvizClass.Draw(False, False, False)
+            self.nvizClass.Draw(False, -1)
         elif self.render['quick'] is True:
             # quick
-            self.nvizClass.Draw(True,
-                                self.render['vlines'],
-                                self.render['vpoints'])
+            mode = wxnviz.DRAW_QUICK_SURFACE | wxnviz.DRAW_QUICK_VOLUME
+            if self.render['vlines']:
+                mode |= wxnviz.DRAW_QUICK_VLINES
+            if self.render['vpoints']:
+                mode |= wxnviz.DRAW_QUICK_VPOINTS
+            self.nvizClass.Draw(True, mode)
         else: # None -> reuse last rendered image
             pass # TODO
 
@@ -405,6 +409,8 @@
 
             elif type == '3d-raster':
                 data[nvizType] = {}
+                for sec in ('attribute', 'draw', 'position'):
+                    data[nvizType][sec] = {}
 
                 # reset to default properties 
                 self.SetVolumeDefaultProp(data[nvizType])
@@ -426,7 +432,7 @@
 
         # set id
         if id > 0:
-            if type == 'raster':
+            if type in ('raster', '3d-raster'):
                data[nvizType]['object'] = { 'id' : id,
                                             'init' : False }
             elif type == 'vector':
@@ -487,12 +493,12 @@
         
         # update tools window
         if hasattr(self.parent, "nvizToolWin") and \
-                item == self.GetSelectedLayer(type='item') and \
-                layer.type == 'raster':
+                item == self.GetSelectedLayer(type='item'):
             toolWin = self.parent.nvizToolWin
-            win = toolWin.FindWindowById( \
-                toolWin.win['vector']['lines']['surface'])
-            win.SetItems(self.layers[layer.type]['name'])
+            if layer.type == 'raster':
+                win = toolWin.FindWindowById( \
+                    toolWin.win['vector']['lines']['surface'])
+                win.SetItems(self.layers[layer.type]['name'])
 
             toolWin.UpdatePage(nvizType)
             toolWin.SetPage(nvizType)
@@ -632,17 +638,14 @@
         #
         # draw
         #
+        data['draw']['all'] = False # apply only for current surface
         for control, value in UserSettings.Get(group='nviz', key='surface', subkey='draw').iteritems():
             if control[:3] == 'res':
-                if not data['draw'].has_key('resolution'):
-                    data['draw']['resolution'] = { 'all' : False }
                 if 'surface:draw:%s' % 'resolution' not in self.update:
                     self.update.append('surface:draw:%s' % 'resolution')
-                    data['draw']['resolution'] = { 'all' : False,
-                                                   control[4:] : value }
-                else:
-                    data['draw']['resolution'][control[4:]] = value
+                data['draw']['resolution'][control[4:]] = value
                 continue
+            
             elif control not in ('style', 'shading'):
                 self.update.append('surface:draw:%s' % control)
 
@@ -653,17 +656,15 @@
                     data['draw']['mode'] = {}
                 continue
 
-            data['draw'][control] = { 'value' : value,
-                                      'all' : False }
-        
+            data['draw'][control] = { 'value' : value }
+            
         value, desc = self.GetSurfaceMode(UserSettings.Get(group='nviz', key='surface', subkey=['draw', 'mode']),
                                           UserSettings.Get(group='nviz', key='surface', subkey=['draw', 'style']),
                                           UserSettings.Get(group='nviz', key='surface', subkey=['draw', 'shading']))
 
         data['draw']['mode'] = { 'value' : value,
-                                 'desc' : desc,
-                                 'all' : False }
-
+                                 'desc' : desc, }
+        
     def LoadVector(self, item, vecType=None):
         """Load 2D or 3D vector map overlay
 
@@ -854,7 +855,14 @@
 
     def SetVolumeDefaultProp(self, data):
         """Set default volume properties"""
-        pass
+        #
+        # draw
+        #
+        data['draw']['all'] = False # apply only for current volume set
+        for control, value in UserSettings.Get(group='nviz', key='volume', subkey='draw').iteritems():
+            if 'volume:draw:%s' % control not in self.update:
+                self.update.append('volume:draw:%s' % control)
+            data['draw'][control] = { 'value' : value }
         
     def Reset(self):
         """Reset (unload data)"""
@@ -968,7 +976,7 @@
             coarse = data['draw']['resolution']['coarse']
             fine   = data['draw']['resolution']['fine']
 
-            if data['draw']['resolution']['all']:
+            if data['draw']['all']:
                 self.nvizClass.SetSurfaceRes(-1, fine, coarse)
             else:
                 self.nvizClass.SetSurfaceRes(id, fine, coarse)
@@ -983,7 +991,7 @@
                                         shade=data['draw']['mode']['desc']['shading'],
                                         string=True)
             style = data['draw']['mode']['value']
-            if data['draw']['mode']['all']:
+            if data['draw']['all']:
                 self.nvizClass.SetSurfaceStyle(-1, style)
             else:
                 self.nvizClass.SetSurfaceStyle(id, style)
@@ -992,7 +1000,7 @@
         # wire color
         if 'surface:draw:wire-color' in self.update:
             color = data['draw']['wire-color']['value']
-            if data['draw']['wire-color']['all']:
+            if data['draw']['all']:
                 self.nvizClass.SetWireColor(-1, str(color))
             else:
                 self.nvizClass.SetWireColor(id, str(color))
@@ -1215,7 +1223,7 @@
                            range=(0, 1),
                            bind=(self.OnViewChange, self.OnViewChanged, self.OnViewChangedSpin))
         self.CreateControl(panel, dict=self.win['view'], name='z-exag', sliderHor=False,
-                           range=(0, 1),
+                           range=(1, 1),
                            bind=(self.OnViewChange, self.OnViewChanged, self.OnViewChangedSpin))
         heightSizer = wx.GridBagSizer(vgap=3, hgap=3)
         heightSizer.Add(item=wx.StaticText(panel, id=wx.ID_ANY, label=_("Height:")),
@@ -1301,17 +1309,6 @@
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
-        # labels
-        # col = 0
-        #         for type in (_("Attribute"),
-        #                      _("Use"),
-        #                      _("Map"),
-        #                      _("Constant")):
-        #             gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
-        #                                              label=type),
-        #                           pos=(0, col))
-        #             col += 1
-
         # type 
         self.win['surface']['attr'] = {}
         row = 0
@@ -1377,7 +1374,8 @@
             else:
                 self.win['surface'][code]['const'] = None
 
-            self.SetSurfaceUseMap(code) # -> enable map / disable constant
+            self.SetMapObjUseMap(nvizType='surface',
+                                 attrb=code) # -> enable map / disable constant
                 
             row += 1
 
@@ -1795,15 +1793,108 @@
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         
         self.win['volume'] = {}
+
+        #
+        # draw
+        #
+        self.win['volume']['draw'] = {}
+        box = wx.StaticBox (parent=panel, id=wx.ID_ANY,
+                            label=" %s " % (_("Draw")))
+        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
+        gridSizer.AddGrowableCol(4)
+
+        # mode
+        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
+                                         label=_("Mode:")),
+                      pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+        mode = wx.Choice (parent=panel, id=wx.ID_ANY, size=(150, -1),
+                          choices = [_("isosurfaces"),
+                                     _("slides")])
+        mode.SetSelection(0)
+        mode.SetName("selection")
+        # mode.Bind(wx.EVT_CHOICE, self.OnSurfaceMode)
+        self.win['volume']['draw']['mode'] = mode.GetId()
+        gridSizer.Add(item=mode, flag=wx.ALIGN_CENTER_VERTICAL,
+                      pos=(0, 1))
+
+        # shading
+        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
+                                         label=_("Shading:")),
+                      pos=(0, 2), flag=wx.ALIGN_CENTER_VERTICAL)
+        shade = wx.Choice (parent=panel, id=wx.ID_ANY, size=(100, -1),
+                           choices = [_("flat"),
+                                      _("gouraud")])
+        shade.SetName("selection")
+        self.win['volume']['draw']['shading'] = shade.GetId()
+        # shade.Bind(wx.EVT_CHOICE, self.OnSurfaceMode)
+        gridSizer.Add(item=shade, flag=wx.ALIGN_CENTER_VERTICAL,
+                      pos=(0, 3))
+
+        # resolution (mode)
+        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
+                                         label=_("Resolution:")),
+                      pos=(0, 4), flag=wx.ALIGN_CENTER_VERTICAL)
+        resol = wx.SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
+                            initial=1,
+                            min=1,
+                            max=100)
+        resol.SetName("value")
+        self.win['volume']['draw']['resolution'] = resol.GetId()
+        # resC.Bind(wx.EVT_SPINCTRL, self.OnSurfaceResolution)
+        gridSizer.Add(item=resol, pos=(0, 5))
         
+        boxSizer.Add(item=gridSizer, proportion=1,
+                     flag=wx.ALL | wx.EXPAND, border=3)
+        pageSizer.Add(item=boxSizer, proportion=0,
+                      flag=wx.EXPAND | wx.ALL,
+                      border=5)
+
         #
-        # volume attributes
+        # manage isosurfaces
         #
         box = wx.StaticBox (parent=panel, id=wx.ID_ANY,
-                            label=" %s " % (_("Volume attributes")))
+                            label=" %s " % (_("List of isosurfaces")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
+        # list
+        isolevel = IsoSurfList(parent=panel, size=(300, 150))
+        self.win['volume']['isosurfs'] = isolevel.GetId()
+        gridSizer.Add(item=isolevel, pos=(0, 0), span=(4, 1))
+        
+        # buttons (add, delete, move up, move down)
+        btnAdd = wx.Button(parent=panel, id=wx.ID_ADD)
+        btnAdd.Bind(wx.EVT_BUTTON, self.OnVolumeIsosurfAdd)
+        gridSizer.Add(item=btnAdd,
+                      pos=(0, 1))
+        btnDelete = wx.Button(parent=panel, id=wx.ID_DELETE)
+        btnDelete.Enable(False)
+        gridSizer.Add(item=btnDelete,
+                      pos=(1, 1))
+        btnMoveUp = wx.Button(parent=panel, id=wx.ID_UP)
+        btnMoveUp.Enable(False)
+        gridSizer.Add(item=btnMoveUp,
+                      pos=(2, 1))
+        btnMoveDown = wx.Button(parent=panel, id=wx.ID_DOWN)
+        btnMoveDown.Enable(False)
+        gridSizer.Add(item=btnMoveDown,
+                      pos=(3, 1))
+
+        boxSizer.Add(item=gridSizer, proportion=1,
+                     flag=wx.ALL | wx.EXPAND, border=3)
+        pageSizer.Add(item=boxSizer, proportion=0,
+                      flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
+                      border=5)
+        
+        #
+        # isosurface attributes
+        #
+        box = wx.StaticBox (parent=panel, id=wx.ID_ANY,
+                            label=" %s " % (_("Isosurface attributes")))
+        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
+
         self.win['volume']['attr'] = {}
         row = 0
         for code, attrb in (('topo', _("Topography level")),
@@ -1813,34 +1904,40 @@
                             ('shine', _("Shininess")),
                             ('emit', _("Emission"))):
             self.win['volume'][code] = {} 
+            # label
             gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
                                              label=attrb + ':'),
                           pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
-            use = wx.Choice (parent=panel, id=wx.ID_ANY, size=(100, -1),
-                             choices = [_("map")])
-            if code not in ('topo', 'color', 'shine'):
+            if code != 'topo':
+                use = wx.Choice (parent=panel, id=wx.ID_ANY, size=(100, -1),
+                                 choices = [_("map")])
+            else:
+                use = None
+            # check for required properties
+            if code not in ('topo', 'color'):
                 use.Insert(item=_("unset"), pos=0)
                 self.win['volume'][code]['required'] = False
             else:
-                self.win['surface'][code]['required'] = True
-            if code != 'mask':
+                self.win['volume'][code]['required'] = True
+            if use and code != 'mask':
                 use.Append(item=_('constant'))
-            self.win['surface'][code]['use'] = use.GetId()
-            use.Bind(wx.EVT_CHOICE, self.OnSurfaceUse)
-            gridSizer.Add(item=use, flag=wx.ALIGN_CENTER_VERTICAL,
-                          pos=(row, 1))
+            if use:
+                self.win['volume'][code]['use'] = use.GetId()
+                use.Bind(wx.EVT_CHOICE, self.OnSurfaceUse)
+                gridSizer.Add(item=use, flag=wx.ALIGN_CENTER_VERTICAL,
+                              pos=(row, 1))
             
-            map = gselect.Select(parent=panel, id=wx.ID_ANY,
-                                 # size=globalvar.DIALOG_GSELECT_SIZE,
-                                 size=(200, -1),
-                                 type="raster")
-            self.win['volume'][code]['map'] = map.GetId() - 1 # FIXME
-            map.Bind(wx.EVT_TEXT, self.OnSurfaceMap)
-            # changing map topography not allowed
-            if code == 'topo':
-                map.Enable(False)
-            gridSizer.Add(item=map, flag=wx.ALIGN_CENTER_VERTICAL,
-                          pos=(row, 2))
+            if code != 'topo':
+                map = gselect.Select(parent=panel, id=wx.ID_ANY,
+                                     # size=globalvar.DIALOG_GSELECT_SIZE,
+                                     size=(200, -1),
+                                     type="raster")
+                self.win['volume'][code]['map'] = map.GetId() - 1 # FIXME
+                map.Bind(wx.EVT_TEXT, self.OnSurfaceMap)
+                gridSizer.Add(item=map, flag=wx.ALIGN_CENTER_VERTICAL,
+                              pos=(row, 2))
+            else:
+                map = None
             
             if code == 'color':
                 value = csel.ColourSelect(panel, id=wx.ID_ANY,
@@ -1850,7 +1947,11 @@
             elif code == 'mask':
                 value = None
             else:
-                value = wx.SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
+                if code == 'topo':
+                    size = (200, -1)
+                else:
+                    size = (65, -1)
+                value = wx.SpinCtrl(parent=panel, id=wx.ID_ANY, size=size,
                                     initial=0)
                 if code == 'topo':
                     value.SetRange(minVal=-1e9, maxVal=1e9)
@@ -1862,20 +1963,26 @@
             
             if value:
                 self.win['volume'][code]['const'] = value.GetId()
-                value.Enable(False)
-                gridSizer.Add(item=value, flag=wx.ALIGN_CENTER_VERTICAL,
-                              pos=(row, 3))
+                if code == 'topo':
+                    gridSizer.Add(item=value, flag=wx.ALIGN_CENTER_VERTICAL,
+                                  pos=(row, 2))
+                else:
+                    value.Enable(False)
+                    gridSizer.Add(item=value, flag=wx.ALIGN_CENTER_VERTICAL,
+                                  pos=(row, 3))
             else:
                 self.win['volume'][code]['const'] = None
             
-            ### self.SetSurfaceUseMap(code) # -> enable map / disable constant
+            if code != 'topo':
+                self.SetMapObjUseMap(nvizType='volume',
+                                     attrb=code) # -> enable map / disable constant
                 
             row += 1
         
         boxSizer.Add(item=gridSizer, proportion=1,
                      flag=wx.ALL | wx.EXPAND, border=3)
         pageSizer.Add(item=boxSizer, proportion=0,
-                      flag=wx.EXPAND | wx.ALL,
+                      flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                       border=5)
         
         panel.SetSizer(pageSizer)
@@ -2493,7 +2600,8 @@
             else:
                 value = self.FindWindowById(self.win['surface'][attrb]['const']).GetValue()
 
-        self.SetSurfaceUseMap(attrb, useMap)
+        self.SetMapObjUseMap(nvizType='surface',
+                             attrb=attrb, map=useMap)
         
         self.mapWindow.update.append('surface:attribute:%s' % attrb)
         data = self.mapWindow.GetSelectedLayer(type='nviz')
@@ -2505,7 +2613,7 @@
         if self.parent.autoRender.IsChecked():
             self.mapWindow.Refresh(False)
 
-    def SetSurfaceUseMap(self, attrb, map=None):
+    def SetMapObjUseMap(self, nvizType, attrb, map=None):
         if attrb in ('topo', 'color', 'shine'):
             incSel = -1 # decrement selection (no 'unset')
         else:
@@ -2513,20 +2621,21 @@
 
         if map is True: # map
             if attrb != 'topo': # changing map topography not allowed
-                self.FindWindowById(self.win['surface'][attrb]['map'] + 1).Enable(True) # FIXME
-            if self.win['surface'][attrb]['const']:
-                self.FindWindowById(self.win['surface'][attrb]['const']).Enable(False)
-            self.FindWindowById(self.win['surface'][attrb]['use']).SetSelection(1 + incSel)
+                # not sure why, but here must be disabled both ids, should be fixed!
+                self.FindWindowById(self.win[nvizType][attrb]['map'] + 1).Enable(True)
+            if self.win[nvizType][attrb]['const']:
+                self.FindWindowById(self.win[nvizType][attrb]['const']).Enable(False)
+            self.FindWindowById(self.win[nvizType][attrb]['use']).SetSelection(1 + incSel)
         elif map is False: # const
-            self.FindWindowById(self.win['surface'][attrb]['map'] + 1).Enable(False)
-            if self.win['surface'][attrb]['const']:
-                self.FindWindowById(self.win['surface'][attrb]['const']).Enable(True)
-            self.FindWindowById(self.win['surface'][attrb]['use']).SetSelection(2 + incSel)
+            self.FindWindowById(self.win[nvizType][attrb]['map'] + 1).Enable(False)
+            if self.win[nvizType][attrb]['const']:
+                self.FindWindowById(self.win[nvizType][attrb]['const']).Enable(True)
+            self.FindWindowById(self.win[nvizType][attrb]['use']).SetSelection(2 + incSel)
         else: # unset
-            self.FindWindowById(self.win['surface'][attrb]['map'] + 1).Enable(False)
-            if self.win['surface'][attrb]['const']:
-                self.FindWindowById(self.win['surface'][attrb]['const']).Enable(False)
-            self.FindWindowById(self.win['surface'][attrb]['use']).SetSelection(0)
+            self.FindWindowById(self.win[nvizType][attrb]['map'] + 1).Enable(False)
+            if self.win[nvizType][attrb]['const']:
+                self.FindWindowById(self.win[nvizType][attrb]['const']).Enable(False)
+            self.FindWindowById(self.win[nvizType][attrb]['use']).SetSelection(0)
 
     def OnSurfaceMap(self, event):
         """Set surface attribute"""
@@ -2574,7 +2683,7 @@
         if apply and self.parent.autoRender.IsChecked():
             self.mapWindow.Refresh(False)
 
-    def SetSurfaceResolution(self, all=False):
+    def SetSurfaceResolution(self):
         """Set draw resolution"""
         coarse = self.FindWindowById(self.win['surface']['draw']['res-coarse']).GetValue()
         fine = self.FindWindowById(self.win['surface']['draw']['res-fine']).GetValue()
@@ -2582,12 +2691,11 @@
         self.mapWindow.update.append('surface:draw:resolution')
         data = self.mapWindow.GetSelectedLayer(type='nviz')
         data['surface']['draw']['resolution'] = { 'coarse' : coarse,
-                                                  'fine' : fine,
-                                                  'all' : all } 
-
+                                                  'fine' : fine }
+        
         self.mapWindow.UpdateLayerProperties()
 
-    def SetSurfaceMode(self, all=False):
+    def SetSurfaceMode(self):
         """Set draw mode
 
         @param apply allow auto-rendering
@@ -2618,7 +2726,6 @@
         self.mapWindow.update.append('surface:draw:mode')
         data = self.mapWindow.GetSelectedLayer(type='nviz')
         data['surface']['draw']['mode'] = { 'value' : value,
-                                            'all' : False,
                                             'desc' : desc }
 
         self.mapWindow.UpdateLayerProperties()
@@ -2646,8 +2753,8 @@
 
         self.mapWindow.update.append('surface:draw:wire-color')
         data = self.mapWindow.GetSelectedLayer(type='nviz')
-        data['surface']['draw']['wire-color'] = { 'value' : value,
-                                                  'all' : all }
+        data['surface']['draw']['wire-color'] = { 'value' : value }
+        
         self.mapWindow.UpdateLayerProperties()
 
         if self.parent.autoRender.IsChecked():
@@ -2900,7 +3007,25 @@
                 
         if self.parent.autoRender.IsChecked():
             self.mapWindow.Refresh(False)
+
+    def OnVolumeIsosurfAdd(self, event):
+        """Add new isosurface to the list"""
+        list = self.FindWindowById(self.win['volume']['isosurfs'])
+        level = self.FindWindowById(self.win['volume']['topo']['const']).GetValue()
         
+        list.Append("%s %s" % (_("Level"), str(level)))
+        list.Check(list.GetCount()-1)
+        
+        # add isosurface
+        layer = self.mapWindow.GetSelectedLayer()
+        data = self.mapWindow.GetSelectedLayer(type='nviz')['volume']
+        id = data['object']['id']
+        
+        self.mapWindow.nvizClass.AddIsosurface(id, level)
+        self.mapWindow.nvizClass.SetIsosurfaceColor(id, 0, True, str(layer.name))
+
+        event.Skip()
+        
     def UpdatePage(self, pageId):
         """Update dialog (selected page)"""
         self.pageChanging = True
@@ -2912,15 +3037,16 @@
             hmin = self.mapWindow.iview['height']['min']
             hmax = self.mapWindow.iview['height']['max']
             for control in ('spin', 'slider'):
-                self.FindWindowById(self.win['view']['z-exag'][control]).SetRange(0,
+                self.FindWindowById(self.win['view']['z-exag'][control]).SetRange(1,
                                                                                   max)
                 self.FindWindowById(self.win['view']['height'][control]).SetRange(hmin,
                                                                                   hmax)
         elif pageId == 'surface':
             if self.notebook.GetSelection() != self.page['surface']['id']:
-                if self.page['vector']['id'] > -1:
-                    self.notebook.RemovePage(self.page['vector']['id'])
-                    self.page['vector']['id'] = -1
+                for page in ('vector', 'volume'):
+                    if self.page[page]['id'] > -1:
+                        self.notebook.RemovePage(self.page[page]['id'])
+                        self.page[page]['id'] = -1
 
                 self.page['surface']['id'] = 1
                 self.page['settings']['id'] = 2
@@ -2935,9 +3061,10 @@
         
         elif pageId == 'vector':
             if self.notebook.GetSelection() != self.page['vector']['id']:
-                if self.page['surface']['id'] > -1:
-                    self.notebook.RemovePage(self.page['surface']['id'])
-                    self.page['surface']['id'] = -1
+                for page in ('surface', 'volume'):
+                    if self.page[page]['id'] > -1:
+                        self.notebook.RemovePage(self.page[page]['id'])
+                        self.page[page]['id'] = -1
                     
                 self.page['vector']['id'] = 1
                 self.page['settings']['id'] = 2
@@ -2952,9 +3079,10 @@
             
         elif pageId == 'volume':
             if self.notebook.GetSelection() != self.page['volume']['id']:
-                if self.page['volume']['id'] > -1:
-                    self.notebook.RemovePage(self.page['volume']['id'])
-                    self.page['volume']['id'] = -1
+                for page in ('surface', 'vector'):
+                    if self.page[page]['id'] > -1:
+                        self.notebook.RemovePage(self.page[page]['id'])
+                        self.page[page]['id'] = -1
                     
                 self.page['volume']['id'] = 1
                 self.page['settings']['id'] = 2
@@ -2978,7 +3106,8 @@
                 self.FindWindowById(self.win['surface'][attr]['map']).SetValue(layer.name)
             else:
                 self.FindWindowById(self.win['surface'][attr]['map']).SetValue('')
-            self.SetSurfaceUseMap(attr, True) # -> map
+            self.SetMapObjUseMap(nvizType='surface',
+                                 attrb=attr, map=True) # -> map
 
         if data['attribute'].has_key('color'):
             value = data['attribute']['color']['value']
@@ -2987,9 +3116,11 @@
             else: # constant
                 color = map(int, value.split(':'))
                 self.FindWindowById(self.win['surface']['color']['const']).SetColour(color)
-            self.SetSurfaceUseMap(attr, data['attribute']['color']['map'])
+            self.SetMapObjUseMap(nvizType='surface',
+                                 attrb=attr, map=data['attribute']['color']['map'])
 
-        self.SetSurfaceUseMap('shine', data['attribute']['shine']['map'])
+        self.SetMapObjUseMap(nvizType='surface',
+                             attrb='shine', map=data['attribute']['shine']['map'])
         value = data['attribute']['shine']['value']
         if data['attribute']['shine']['map']:
             self.FindWindowById(self.win['surface']['shine']['map']).SetValue(value)
@@ -3000,6 +3131,8 @@
         # draw
         #
         for control, dict in data['draw'].iteritems():
+            if control == 'all': # skip 'all' property
+                continue
             if control == 'resolution':
                 self.FindWindowById(self.win['surface']['draw']['res-coarse']).SetValue(dict['coarse'])
                 self.FindWindowById(self.win['surface']['draw']['res-fine']).SetValue(dict['fine'])
@@ -3150,8 +3283,21 @@
 
     def UpdateVolumePage(self, layer, data):
         """Update volume layer properties page"""
-        pass
-    
+        #
+        # draw
+        #
+        for control, dict in data['draw'].iteritems():
+            if control == 'all': # skip 'all' property
+                continue
+
+            win = self.FindWindowById(self.win['volume']['draw'][control])
+            if win.GetName() == "selection":
+                win.SetSelection(dict['value'])
+            else:
+                win.SetValue(dict['value'])
+
+        self.FindWindowById(self.win['volume']['color']['map']).SetValue("precip3d.500z50 at PERMANENT")
+        
     def SetPage(self, name):
         """Get named page"""
         self.notebook.SetSelection(self.page[name]['id'])
@@ -3226,3 +3372,9 @@
             self.mapWindow.Refresh(eraseBackground=False)
         
         event.Skip()
+
+class IsoSurfList(wx.CheckListBox):
+    """List of loaded volume isosurfaces (volume properties page)"""
+    def __init__(self, parent, id=wx.ID_ANY, size=wx.DefaultSize):
+        wx.CheckListBox.__init__(self, parent, id, size=size)
+    

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2008-08-09 21:28:55 UTC (rev 32657)
@@ -450,6 +450,15 @@
                         'map' : True,
                         'value' : (0, 0, 0, 255), # constant: black
                         },
+                    'draw' : {
+                        'mode' : 0, # isosurfaces
+                        'shading' : 1, # gouraud
+                        'resolution' : 3, # polygon resolution
+                        },
+                    'shine': {
+                        'map' : False,
+                        'value' : 60.0,
+                        },
                     },
                 'settings': {
                     'general' : {

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py	2008-08-09 21:28:55 UTC (rev 32657)
@@ -185,8 +185,8 @@
         elif name == 'draw':
             if self.inTag['nviz'] and self.inTag['surface']:
                 tagName = str(name)
+                self.layerNviz['surface'][tagName]['all'] = False
                 self.layerNviz['surface'][tagName]['mode'] = {}
-                self.layerNviz['surface'][tagName]['mode']['all'] = False
                 self.layerNviz['surface'][tagName]['mode']['value'] = -1 # to be calculated
                 self.layerNviz['surface'][tagName]['mode']['desc'] = {}
                 self.layerNviz['surface'][tagName]['mode']['desc']['shading'] = \
@@ -269,14 +269,12 @@
 
         elif name == 'resolution':
             if self.inTag['nviz'] and self.inTag['surface']:
-                self.layerNviz['surface']['draw']['resolution']['all'] = False
                 self.layerNviz['surface']['draw']['resolution'][self.resolutionType] = int(self.value)
                 del self.resolutionType
 
         elif name == 'wire_color':
             if self.inTag['nviz'] and self.inTag['surface']:
                 self.layerNviz['surface']['draw']['wire-color'] = {}
-                self.layerNviz['surface']['draw']['wire-color']['all'] = False
                 self.layerNviz['surface']['draw']['wire-color']['value'] = str(self.value)
 
         elif name == 'x':

Modified: grass/branches/develbranch_6/gui/wxpython/nviz/draw.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/draw.cpp	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/draw.cpp	2008-08-09 21:28:55 UTC (rev 32657)
@@ -22,14 +22,21 @@
 /*!
   \brief Draw map
 
-  \param quick true for forcing coarse draw mode 
+  Draw quick mode:
+   - DRAW_QUICK_SURFACE
+   - DRAW_QUICK_VLINES
+   - DRAW_QUICK_VPOINTS
+   - DRAW_QUICK_VOLUME
+   
+  \param quick if true draw in wiremode
+  \param quick_mode quick mode
 */
-void Nviz::Draw(bool quick, bool quick_vlines, bool quick_vpoints)
+void Nviz::Draw(bool quick, int quick_mode)
 {
     Nviz_draw_cplane(data, -1, -1); // ?
 
     if (quick) {
-	Nviz_draw_quick(data, quick_vlines, quick_vpoints); 
+	Nviz_draw_quick(data, quick_mode);
     }
     else {
 	Nviz_draw_all (data); 

Modified: grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/init.cpp	2008-08-09 21:28:55 UTC (rev 32657)
@@ -43,7 +43,7 @@
     // G_set_percent_routine(&print_percent);
 
     GS_libinit();
-    /* GVL_libinit(); TODO */
+    GVL_libinit();
 
     GS_set_swap_func(swap_gl);
 

Modified: grass/branches/develbranch_6/gui/wxpython/nviz/load.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/load.cpp	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/load.cpp	2008-08-09 21:28:55 UTC (rev 32657)
@@ -237,10 +237,7 @@
 		      G_fully_qualified_name(name, mapset), -1.0,
 		      data);
     }
-	    
-    /* focus on loaded data */
-    Nviz_set_focus_map(MAP_OBJ_UNDEFINED, -1);
-
+    
     G_debug(1, "Nviz::LoadVolume(): name=%s -> id=%d", name, id);
 
     return id;

Modified: grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/nviz.h	2008-08-09 21:28:55 UTC (rev 32657)
@@ -36,6 +36,10 @@
     int SetSurfaceAttr(int, int, bool, const char *);
     int UnsetSurfaceAttr(int, int);
 
+    /* volume.cpp */
+    int SetIsosurfaceAttr(int, int, int, bool, const char *);
+    int UnsetIsosurfaceAttr(int, int, int);
+
 public:
     /* constructor */
     Nviz(PyObject *);
@@ -68,7 +72,7 @@
     int UnloadVolume(int);
 
     /* draw.cpp */
-    void Draw(bool, bool, bool);
+    void Draw(bool, int);
     void EraseMap();
 
     /* surface.cpp */
@@ -94,6 +98,10 @@
     int SetVectorPointMode(int, const char*, int, float, int);
     int SetVectorPointHeight(int, float);
     int SetVectorPointSurface(int, int);
+
+    /* volume */
+    int AddIsosurface(int, int);
+    int SetIsosurfaceColor(int, int, bool, const char *);
 };
 
 #endif /* WXNVIZ_H */

Modified: grass/branches/develbranch_6/gui/wxpython/nviz/nviz_types.i
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/nviz_types.i	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/nviz_types.i	2008-08-09 21:28:55 UTC (rev 32657)
@@ -47,3 +47,10 @@
 #define ST_ASTER      8
 #define ST_GYRO       9
 #define ST_HISTOGRAM  10
+
+/* extracted from include/nviz.h */
+/* quick draw mode */
+#define DRAW_QUICK_SURFACE 0x01
+#define DRAW_QUICK_VLINES  0x02
+#define DRAW_QUICK_VPOINTS 0x04
+#define DRAW_QUICK_VOLUME  0x08

Modified: grass/branches/develbranch_6/gui/wxpython/nviz/surface.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/surface.cpp	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/surface.cpp	2008-08-09 21:28:55 UTC (rev 32657)
@@ -26,7 +26,8 @@
   \param value map name of value
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceTopo(int id, bool map, const char *value)
 {
@@ -41,7 +42,8 @@
   \param value map name of value
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceColor(int id, bool map, const char *value)
 {
@@ -58,7 +60,8 @@
   \param value map name of value
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceMask(int id, bool invert, const char *value)
 {
@@ -75,7 +78,8 @@
   \param value map name of value
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceTransp(int id, bool map, const char *value)
 {
@@ -90,7 +94,8 @@
   \param value map name of value
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceShine(int id, bool map, const char *value)
 {
@@ -105,7 +110,8 @@
   \param value map name of value
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceEmit(int id, bool map, const char *value)
 {
@@ -121,14 +127,15 @@
   \param value map name of value
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceAttr(int id, int attr, bool map, const char *value)
 {
     int ret;
 
     if (!GS_surf_exists(id)) {
-	return 0;
+	return -1;
     }
 
     if (map) {
@@ -152,7 +159,7 @@
     G_debug(1, "Nviz::SetSurfaceAttr(): id=%d, attr=%d, map=%d, value=%s",
 	    id, attr, map, value);
 
-    return ret;
+    return ret ? 1 : -2;
 }
 
 /*!
@@ -161,7 +168,9 @@
   \param id surface id
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
+  \return -1 on failure
 */
 
 int Nviz::UnsetSurfaceMask(int id)
@@ -175,7 +184,8 @@
   \param id surface id
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 
 int Nviz::UnsetSurfaceTransp(int id)
@@ -189,7 +199,8 @@
   \param id surface id
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 
 int Nviz::UnsetSurfaceEmit(int id)
@@ -204,18 +215,23 @@
   \param attr attribute descriptor
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::UnsetSurfaceAttr(int id, int attr)
 {
+    int ret;
+    
     if (!GS_surf_exists(id)) {
-	return 0;
+	return -1;
     }
 
     G_debug(1, "Nviz::UnsetSurfaceAttr(): id=%d, attr=%d",
 	    id, attr);
     
-    return Nviz_unset_attr(id, MAP_OBJ_SURF, attr);
+    ret = Nviz_unset_attr(id, MAP_OBJ_SURF, attr);
+    
+    return ret ? 1 : -2;
 }
 
 /*!
@@ -225,8 +241,9 @@
   \param fine x/y fine resolution
   \param coarse x/y coarse resolution
 
-  \return 0 on error
   \return 1 on success
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceRes(int id, int fine, int coarse)
 {
@@ -236,11 +253,11 @@
 
     if (id > 0) {
 	if (!GS_surf_exists(id)) {
-	    return 0;
+	    return -1;
 	}
 
 	if (GS_set_drawres(id, fine, fine, coarse, coarse) < 0) {
-	    return 0;
+	    return -2;
 	}
     }
     else {
@@ -268,7 +285,8 @@
   \param style draw style
 
   \return 1 on success
-  \return 0 on error
+  \return -1 surface not found
+  \return -2 setting attributes failed
 */
 int Nviz::SetSurfaceStyle(int id, int style)
 {
@@ -277,17 +295,17 @@
 
     if (id > 0) {
 	if (!GS_surf_exists(id)) {
-	    return 0;
+	    return -1;
 	}
 	
 	if (GS_set_drawmode(id, style) < 0) {
-	    return 0;
+	    return -2;
 	}
 	return 1;
     }
 
     if (GS_setall_drawmode(style) < 0) {
-	return 0;
+	return -2;
     }
 
     return 1;
@@ -302,6 +320,9 @@
   \param color color string (R:G:B)
 
   \return 1 on success
+  \return -1 surface not found
+  \return -2 setting attributes failed
+  \return 1 on success
   \return 0 on failure
 */
 int Nviz::SetWireColor(int id, const char* color_str)
@@ -315,7 +336,7 @@
 
     if (id > 0) {
 	if (!GS_surf_exists(id)) {
-	    return 0;
+	    return -1;
 	}
 	GS_set_wire_color(id, color);
     }
@@ -370,12 +391,13 @@
   \param x,y,z translation values
 
   \return 1 on success
-  \return 0 on failure
+  \return -1 surface not found
+  \return -2 setting position failed
 */
 int Nviz::SetSurfacePosition(int id, float x, float y, float z)
 {
     if (!GS_surf_exists(id)) {
-	return 0;
+	return -1;
     }
     
     G_debug(1, "Nviz::SetSurfacePosition(): id=%d, x=%f, y=%f, z=%f",

Added: grass/branches/develbranch_6/gui/wxpython/nviz/volume.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/volume.cpp	                        (rev 0)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/volume.cpp	2008-08-09 21:28:55 UTC (rev 32657)
@@ -0,0 +1,146 @@
+/**
+   \file volume.cpp
+   
+   \brief Experimental C++ wxWidgets Nviz prototype -- volume attributes
+
+   Used by wxGUI Nviz extension.
+
+   Copyright: (C) by the GRASS Development Team
+
+   This program is free software under the GNU General Public
+   License (>=v2). Read the file COPYING that comes with GRASS
+   for details.
+
+   \author Martin Landa <landa.martin gmail.com> (Google SoC 2008)
+
+   \date 2008
+*/
+
+#include "nviz.h"
+
+/**
+   \brief Add new isosurface
+
+   \param id volume id
+   \param level isosurface level (topography)
+
+   \return -1 on failure
+   \return 1 on success
+*/
+
+int Nviz::AddIsosurface(int id, int level)
+{
+    int nisosurfs;
+    
+    if (!GVL_vol_exists(id))
+	return -1;
+
+    if (GVL_isosurf_add(id) < 0)
+	return -1;
+
+    /* set topography level */
+    nisosurfs = GVL_isosurf_num_isosurfs(id);
+    
+    return GVL_isosurf_set_att_const(id, nisosurfs - 1,
+				     ATT_TOPO, level);
+}
+
+/*!
+  \brief Set surface color
+
+  \param id surface id
+  \param isosurf_id isosurface id (0 - MAX_ISOSURFS)
+  \param map if true use map otherwise constant
+  \param value map name of value
+
+  \return 1 on success
+  \return -1 volume not found
+  \return -2 isosurface not found
+  \return -3 setting attributes failed
+*/
+int Nviz::SetIsosurfaceColor(int id, int isosurf_id,
+			     bool map, const char *value)
+{
+    return SetIsosurfaceAttr(id, isosurf_id, ATT_COLOR, map, value);
+}
+
+/*!
+  \brief Set isosurface attribute
+
+  \param id volume id
+  \param isosurf_id isosurface id (0 - MAX_ISOSURFS)
+  \param attr attribute desc
+  \param map if true use map otherwise constant
+  \param value map name of value
+
+  \return 1 on success
+  \return -1 volume not found
+  \return -2 isosurface not found
+  \return -3 setting attributes failed
+*/
+int Nviz::SetIsosurfaceAttr(int id, int isosurf_id,
+			    int attr, bool map, const char *value)
+{
+    int ret;
+
+    if (!GVL_vol_exists(id)) {
+	return -1;
+    }
+    
+    if (isosurf_id > GVL_isosurf_num_isosurfs(id) - 1)
+	return -2;
+    
+    if (map) {
+	ret = GVL_isosurf_set_att_map(id, isosurf_id, attr,
+				      value);
+    }
+    else {
+	float val;
+	if (attr == ATT_COLOR) {
+	    val = Nviz_color_from_str(value);
+	}
+	else {
+	    val = atof(value);
+	}
+	ret = GVL_isosurf_set_att_const(id, isosurf_id, attr,
+					val);
+    }
+	
+    G_debug(1, "Nviz::SetIsosurfaceAttr(): id=%d, isosurf=%d, "
+	    "attr=%d, map=%d, value=%s",
+	    id, isosurf_id, attr, map, value);
+
+    return ret > 0 ? 1 : -2;
+}
+
+/*!
+  \brief Unset surface attribute
+
+  \param id surface id
+  \param isosurf_id isosurface id (0 - MAX_ISOSURFS)
+  \param attr attribute descriptor
+
+  \return 1 on success
+  \return -1 volume not found
+  \return -2 isosurface not found
+  \return -2 on failure
+*/
+int Nviz::UnsetIsosurfaceAttr(int id, int isosurf_id,
+			      int attr)
+{
+    int ret;
+    
+    if (!GVL_vol_exists(id)) {
+	return -1;
+    }
+
+    if (isosurf_id > GVL_isosurf_num_isosurfs(id) - 1)
+	return -2;
+    
+    G_debug(1, "Nviz::UnsetSurfaceAttr(): id=%d, isosurf_id=%d, attr=%d",
+	    id, isosurf_id, attr);
+    
+    ret = GVL_isosurf_unset_att(id, isosurf_id, attr);
+    
+    return ret > 0 ? 1 : -2;
+}


Property changes on: grass/branches/develbranch_6/gui/wxpython/nviz/volume.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/x-c++src
Name: svn:keywords
   + Author Date Id
Name: svn:eol-style
   + native

Modified: grass/branches/develbranch_6/include/nviz.h
===================================================================
--- grass/branches/develbranch_6/include/nviz.h	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/include/nviz.h	2008-08-09 21:28:55 UTC (rev 32657)
@@ -46,6 +46,12 @@
 #define DRAW_FINE 1
 #define DRAW_BOTH 2
 
+/* quick draw mode */
+#define DRAW_QUICK_SURFACE 0x01
+#define DRAW_QUICK_VLINES  0x02
+#define DRAW_QUICK_VPOINTS 0x04
+#define DRAW_QUICK_VOLUME  0x08
+
 #define RANGE (5 * GS_UNIT_SIZE)
 #define RANGE_OFFSET (2 * GS_UNIT_SIZE)
 #define ZRANGE (3 * GS_UNIT_SIZE)
@@ -153,7 +159,7 @@
 int Nviz_draw_all_site(nv_data *);
 int Nviz_draw_all_vol(nv_data *);
 int Nviz_draw_all(nv_data *);
-int Nviz_draw_quick(nv_data *, int, int);
+int Nviz_draw_quick(nv_data *, int);
 
 /* exag.c */
 int Nviz_get_exag_height(float *, float *, float *);

Modified: grass/branches/develbranch_6/include/ogsf_proto.h
===================================================================
--- grass/branches/develbranch_6/include/ogsf_proto.h	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/include/ogsf_proto.h	2008-08-09 21:28:55 UTC (rev 32657)
@@ -263,6 +263,7 @@
 void GVL_draw_vol(int);
 void GVL_draw_wire(int);
 void GVL_alldraw_vol(void);
+void GVL_alldraw_wire(void);
 int GVL_Set_ClientData(int, void *);
 void *GVL_Get_ClientData(int);
 void GVL_get_dims(int, int *, int *, int *);

Modified: grass/branches/develbranch_6/lib/nviz/draw.c
===================================================================
--- grass/branches/develbranch_6/lib/nviz/draw.c	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/lib/nviz/draw.c	2008-08-09 21:28:55 UTC (rev 32657)
@@ -172,9 +172,7 @@
 
 /*!
    \brief Draw all loaded volume sets
-
-   \todo To be implement
-
+   
    \param dc nviz data
 
    \return 1
@@ -253,44 +251,45 @@
 }
 
 /*!
-   \brief Draw all surfaces in wireframe
+   \brief Draw all surfaces in wireframe (quick mode)
 
-   \param dc nviz data
+   Draw modes:
+    - DRAW_QUICK_SURFACE
+    - DRAW_QUICK_VLINES
+    - DRAW_QUICK_VPOINTS
+    - DRAW_QUICK_VOLUME
 
+   \param data nviz data
+   \param draw_mode draw mode
+   
    \return 1
  */
-int Nviz_draw_quick(nv_data * data, int draw_vlines, int draw_vpoints)
+int Nviz_draw_quick(nv_data * data, int draw_mode)
 {
     GS_set_draw(GSD_BACK);
-
+    
     GS_ready_draw();
-
+    
     GS_clear(data->bgcolor);
-
+    
     /* draw surfaces */
-    GS_alldraw_wire();
-
+    if (draw_mode & DRAW_QUICK_SURFACE)
+	GS_alldraw_wire();
+    
     /* draw vector lines */
-    if (draw_vlines)
+    if (draw_mode & DRAW_QUICK_VLINES)
 	GV_alldraw_vect();
-
+    
     /* draw vector points */
-    if (draw_vpoints)
+    if (draw_mode & DRAW_QUICK_VPOINTS)
 	GP_alldraw_site();
-
-    /*
-       vol_list = GVL_get_vol_list(&max);
-       max = GVL_num_vols();
-       for (i = 0; i < max; i++) {
-       if (check_blank(interp, vol_list[i]) == 0) {
-       GVL_draw_wire(vol_list[i]);
-       }
-       }
-     */
-
+    
+    /* draw volumes */
+    if (draw_mode & DRAW_QUICK_VOLUME) {
+	GVL_alldraw_wire();
+    }
+    
     GS_done_draw();
-
-    // flythrough_postdraw_cb();
-
+    
     return 1;
 }

Modified: grass/branches/develbranch_6/lib/nviz/map_obj.c
===================================================================
--- grass/branches/develbranch_6/lib/nviz/map_obj.c	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/lib/nviz/map_obj.c	2008-08-09 21:28:55 UTC (rev 32657)
@@ -74,15 +74,15 @@
 
 	if (name) {
 	    /* map */
-	    if (!Nviz_set_attr
-		(new_id, MAP_OBJ_SURF, ATT_TOPO, MAP_ATT, name, -1.0, data)) {
+	    if (!Nviz_set_attr(new_id, MAP_OBJ_SURF, ATT_TOPO,
+			       MAP_ATT, name, -1.0, data)) {
 		return -1;
 	    }
 	}
 	else {
 	    /* constant */
-	    if (!Nviz_set_attr
-		(new_id, MAP_OBJ_SURF, ATT_TOPO, CONST_ATT, NULL, value,
+	    if (!Nviz_set_attr(new_id, MAP_OBJ_SURF, ATT_TOPO,
+			       CONST_ATT, NULL, value,
 		 data)) {
 		return -1;
 	    }

Modified: grass/branches/develbranch_6/lib/ogsf/GVL2.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/GVL2.c	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/lib/ogsf/GVL2.c	2008-08-09 21:28:55 UTC (rev 32657)
@@ -373,7 +373,7 @@
 }
 
 /*!
-   \brief Draw volume wire mode
+   \brief Draw volume in wire mode
 
    \param id volume set id
  */
@@ -381,7 +381,7 @@
 {
     geovol *gvl;
 
-    G_debug(3, "GVL_draw_wire");
+    G_debug(3, "GVL_draw_wire(): id=%d", id);
 
     gvl = gvl_get_vol(id);
 

Modified: grass/branches/develbranch_6/lib/ogsf/gvld.c
===================================================================
--- grass/branches/develbranch_6/lib/ogsf/gvld.c	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/lib/ogsf/gvld.c	2008-08-09 21:28:55 UTC (rev 32657)
@@ -58,7 +58,7 @@
 }
 
 /*!
-   \brief ADD
+   \brief Draw volume in wire mode (bounding box)
 
    \param gvl pointer to geovol struct
 
@@ -67,7 +67,7 @@
  */
 int gvld_wire_vol(geovol * gvl)
 {
-    G_debug(5, "gvld_vol");
+    G_debug(5, "gvld_vol(): id=%d", gvl->gvol_id);
 
     gvld_wind3_box(gvl);
 
@@ -81,7 +81,7 @@
 }
 
 /*!
-   \brief ADD
+   \brief Draw volume isosurfaces
 
    \param gvl pointer to geovol struct
 
@@ -400,7 +400,7 @@
 }
 
 /*!
-   \brief ADD
+   \brief Draw volume isosurface in draw mode
 
    \param gvl pointer to geovol struct
 
@@ -757,7 +757,7 @@
 }
 
 /*!
-   \brief Draw wind3 box
+   \brief Draw volume bounding box
 
    \param gvl pointer to geovol struct
 
@@ -767,7 +767,7 @@
 {
     float pt[3];
 
-    G_debug(5, "gvld_wind3_box");
+    G_debug(5, "gvld_wind3_box(): id=%d", gvl->gvol_id);
 
     gsd_pushmatrix();
 

Modified: grass/branches/develbranch_6/visualization/nviz2/cmd/main.c
===================================================================
--- grass/branches/develbranch_6/visualization/nviz2/cmd/main.c	2008-08-09 21:15:04 UTC (rev 32656)
+++ grass/branches/develbranch_6/visualization/nviz2/cmd/main.c	2008-08-09 21:28:55 UTC (rev 32657)
@@ -130,7 +130,7 @@
     }
     else {
 	z_exag = Nviz_get_exag();
-	G_message(_("Vertical exaggeration not given, using calculated value %f"),
+	G_message(_("Vertical exaggeration not given, using calculated value %.0f"),
 		  z_exag);
     }
     Nviz_change_exag(&data, z_exag);
@@ -140,7 +140,7 @@
     }
     else {
 	Nviz_get_exag_height(&vp_height, NULL, NULL);
-	G_message(_("Viewpoint height not given, using calculated value %f"),
+	G_message(_("Viewpoint height not given, using calculated value %.0f"),
 		  vp_height);
     }
     Nviz_set_viewpoint_height(&data, vp_height);



More information about the grass-commit mailing list