[GRASS-SVN] r31893 - in grass-addons/visualization/nviz2/wxpython:
. nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 30 06:34:45 EDT 2008
Author: martinl
Date: 2008-06-30 06:34:45 -0400 (Mon, 30 Jun 2008)
New Revision: 31893
Modified:
grass-addons/visualization/nviz2/wxpython/nviz.py
grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp
grass-addons/visualization/nviz2/wxpython/nviz/nviz.h
grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp
grass-addons/visualization/nviz2/wxpython/preferences.py
Log:
nviz2: wxGUI set draw resolution (fine, wire)
Modified: grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp 2008-06-30 09:49:08 UTC (rev 31892)
+++ grass-addons/visualization/nviz2/wxpython/nviz/draw.cpp 2008-06-30 10:34:45 UTC (rev 31893)
@@ -30,6 +30,8 @@
Nviz_draw_cplane(data, -1, -1);
+ data->draw_coarse = 1;
+
if (data->draw_coarse) { /* coarse */
GS_set_draw(GSD_BACK);
GS_ready_draw();
Modified: grass-addons/visualization/nviz2/wxpython/nviz/nviz.h
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/nviz.h 2008-06-30 09:49:08 UTC (rev 31892)
+++ grass-addons/visualization/nviz2/wxpython/nviz/nviz.h 2008-06-30 10:34:45 UTC (rev 31893)
@@ -79,6 +79,7 @@
int UnsetSurfaceMask(int);
int UnsetSurfaceTransp(int);
int UnsetSurfaceEmit(int);
+ int SetSurfaceRes(int, int, int, int, int);
};
#endif /* __NVIZ_H__ */
Modified: grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp 2008-06-30 09:49:08 UTC (rev 31892)
+++ grass-addons/visualization/nviz2/wxpython/nviz/surface.cpp 2008-06-30 10:34:45 UTC (rev 31893)
@@ -206,3 +206,19 @@
{
return Nviz_unset_attr(id, MAP_OBJ_SURF, attr);
}
+
+/*!
+ \brief Set surface resolution
+
+ \param id surface id
+ \param xres,yres x/y resolution
+ \param xwire,ywire x/y wire resolution
+
+ \return -1 on error
+ \return 0 on success
+*/
+int Nviz::SetSurfaceRes(int id, int xres, int yres,
+ int xwire, int ywire)
+{
+ return GS_set_drawres(id, xres, yres, xwire, ywire);
+}
Modified: grass-addons/visualization/nviz2/wxpython/nviz.py
===================================================================
--- grass-addons/visualization/nviz2/wxpython/nviz.py 2008-06-30 09:49:08 UTC (rev 31892)
+++ grass-addons/visualization/nviz2/wxpython/nviz.py 2008-06-30 10:34:45 UTC (rev 31893)
@@ -284,6 +284,12 @@
"""
for raster in self.Map.GetListOfLayers(l_type='raster', l_active=True):
id = self.nvizClass.LoadRaster(str(raster.name), None, None)
+ # set resolution
+ res = UserSettings.Get(group='nviz', key='surface',
+ subkey=['draw', 'res-fine'])
+ wire = UserSettings.Get(group='nviz', key='surface',
+ subkey=['draw', 'res-coarse'])
+ self.nvizClass.SetSurfaceRes(id, res, res, wire, wire)
self.object[self.Map.GetLayerIndex(raster)] = id
def Reset(self):
@@ -628,8 +634,11 @@
initial=1,
min=1,
max=100)
+ self.win['surface']['res'] = resolution.GetId()
gridSizer.Add(item=resolution, flag=wx.ALIGN_CENTER_VERTICAL,
pos=(0, 3))
+ # update resolution widget
+ self.SetSurfaceMode(mode.GetSelection())
# style
gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
@@ -915,7 +924,7 @@
del self.mapWindow.update[attr]
# drawing mode
- if self.update.has_key('draw-mode'):
+ if self.mapWindow.update.has_key('draw-mode'):
self.mapWindow.nvizClass.SetDrawMode(self.update['draw-mode'])
self.mapWindow.Refresh(False)
@@ -1013,16 +1022,29 @@
def OnSurfaceMode(self, event):
"""Drawing mode changed"""
- selection = event.GetSelection()
+ self.SetSurfaceMode(event.GetSelection())
+ event.Skip()
+
+ def SetSurfaceMode(self, selection):
+ """Set drawing mode and resolution"""
+ win = self.FindWindowById(self.win['surface']['res'])
if selection == 0: # coarse
self.mapWindow.update['draw-mode'] = wxnviz.DRAW_COARSE
+ if not win.IsEnabled():
+ win.Enable(True)
+ win.SetValue(UserSettings.Get(group='nviz', key='surface',
+ subkey=['draw', 'res-coarse']))
elif selection == 1: # fine
self.mapWindow.update['draw-mode'] = wxnviz.DRAW_FINE
+ if not win.IsEnabled():
+ win.Enable(True)
+ win.SetValue(UserSettings.Get(group='nviz', key='surface',
+ subkey=['draw', 'res-fine']))
+
elif selection == 2: # both
self.mapWindow.update['draw-mode'] = wxnviz.DRAW_BOTH
+ self.FindWindowById(self.win['surface']['res']).Enable(False)
- event.Skip()
-
def OnSurfaceStyle(self, event):
pass
Modified: grass-addons/visualization/nviz2/wxpython/preferences.py
===================================================================
--- grass-addons/visualization/nviz2/wxpython/preferences.py 2008-06-30 09:49:08 UTC (rev 31892)
+++ grass-addons/visualization/nviz2/wxpython/preferences.py 2008-06-30 10:34:45 UTC (rev 31893)
@@ -237,9 +237,9 @@
'color' : (136, 136, 136, 255),
'mode' : 1, # fine
'style' : 1, # surface
- 'shading' : 1, # gouraud
- 'res-fine' : 1,
- 'res-coarse' : 1,
+ 'shading' : 100, # gouraud
+ 'res-fine' : 6,
+ 'res-coarse' : 9,
},
'position' : {
'x' : 0,
More information about the grass-commit
mailing list