[GRASS-SVN] r47045 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 7 05:58:37 EDT 2011
Author: annakrat
Date: 2011-07-07 02:58:36 -0700 (Thu, 07 Jul 2011)
New Revision: 47045
Modified:
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
grass/trunk/gui/wxpython/gui_modules/wxnviz.py
Log:
wxNviz: isosurfaces: inout mode
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-07 09:48:54 UTC (rev 47044)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-07 09:58:36 UTC (rev 47045)
@@ -1397,7 +1397,13 @@
gridSizer = wx.GridBagSizer(vgap = 3, hgap = 3)
self.win['volume']['attr'] = {}
- row = 0
+ inout = wx.CheckBox(parent = panel, id = wx.ID_ANY,
+ label = _("toggle normal direction"))
+ gridSizer.Add(item = inout, pos = (0,0), span = (1,2), flag = wx.ALIGN_CENTER_VERTICAL)
+ inout.Bind(wx.EVT_CHECKBOX, self.OnInOutMode)
+ self.win['volume']['inout'] = inout.GetId()
+
+ row = 1
for code, attrb in (('topo', _("Topography level")),
('color', _("Color")),
('mask', _("Mask")),
@@ -2894,7 +2900,20 @@
if self.mapDisplay.statusbarWin['render'].IsChecked():
self.mapWindow.Refresh(False)
+
+ def OnInOutMode(self, event):
+ """!Change isosurfaces mode inout"""
+ data = self.GetLayerData('volume')['volume']
+ id = data['object']['id']
+ isosurfId = self.FindWindowById(self.win['volume']['isosurfs']).GetSelection()
+ ret = self._display.SetIsosurfaceInOut(id, isosurfId, event.GetInt())
+ if ret == 1:
+ data['isosurface'][isosurfId]['inout'] = event.GetInt()
+
+ if self.mapDisplay.statusbarWin['render'].IsChecked():
+ self.mapWindow.Refresh(False)
+
def OnVolumeIsosurfMap(self, event):
"""!Set surface attribute"""
if self.vetoGSelectEvt:
@@ -3661,18 +3680,21 @@
self.SetMapObjUseMap(nvizType = 'volume',
attrb = attrb, map = data[attrb]['map'])
-
- ret = gcmd.RunCommand('r3.info', read = True, flags = 'r', map = layer.name)
- if ret:
- range = []
- for value in ret.strip('\n').split('\n'):
- range.append(value.split('=')[1])
- topo = self.FindWindowById(self.win['volume']['topo']['const'])
- if fs:
- topo.SetRange(min_val = float(range[0]), max_val = float(range[1]))
- else:
- topo.SetRange(minVal = int(range[0]), maxVal = int(range[1]))
-
+ # set topo range
+ ret = gcmd.RunCommand('r3.info', read = True, flags = 'r', map = layer.name)
+ if ret:
+ range = []
+ for value in ret.strip('\n').split('\n'):
+ range.append(value.split('=')[1])
+ topo = self.FindWindowById(self.win['volume']['topo']['const'])
+ if fs:
+ topo.SetRange(min_val = float(range[0]), max_val = float(range[1]))
+ else:
+ topo.SetRange(minVal = int(range[0]), maxVal = int(range[1]))
+ # set inout
+ if 'inout' in data:
+ self.FindWindowById(self.win['volume']['inout']).SetValue(data['inout'])
+
def SetPage(self, name):
"""!Get named page"""
if name == 'view':
Modified: grass/trunk/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2011-07-07 09:48:54 UTC (rev 47044)
+++ grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2011-07-07 09:58:36 UTC (rev 47045)
@@ -1257,6 +1257,29 @@
return 1
+ def SetIsosurfaceInOut(self, id, isosurf_id, inout):
+ """!Set inout mode
+
+ @param inout mode true/false
+
+ @return 1 on success
+ @return -1 volume set not found
+ @return -2 isosurface not found
+ @return -3 on failure
+ """
+ if not GVL_vol_exists(id):
+ return -1
+
+ if isosurf_id > GVL_isosurf_num_isosurfs(id) - 1:
+ return -2
+
+ ret = GVL_isosurf_set_flags(id, isosurf_id, inout)
+
+ if ret < 0:
+ return -3
+
+ return 1
+
def GetCPlaneCurrent(self):
return Nviz_get_current_cplane(self.data)
More information about the grass-commit
mailing list