[GRASS-SVN] r42640 - in grass/branches/develbranch_6:
gui/wxpython/gui_modules include lib/nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 23 04:48:53 EDT 2010
Author: martinl
Date: 2010-06-23 08:48:53 +0000 (Wed, 23 Jun 2010)
New Revision: 42640
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py
grass/branches/develbranch_6/include/nviz.h
grass/branches/develbranch_6/lib/nviz/nviz.c
Log:
wxGUI/nviz: set fringe color/elevation
(merge r42639 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py 2010-06-23 08:44:27 UTC (rev 42639)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py 2010-06-23 08:48:53 UTC (rev 42640)
@@ -1256,6 +1256,7 @@
chkbox = wx.CheckBox(parent = panel,
label = edge[0],
name = edge[1])
+ self.win['fringe'][edge[1]] = chkbox.GetId()
eboxSizer.Add(item = chkbox, proportion = 0,
flag = wx.ADJUST_MINSIZE | wx.LEFT | wx.RIGHT, border = 5)
chkbox.Bind(wx.EVT_CHECKBOX, self.OnFringe)
@@ -1277,6 +1278,7 @@
spin = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
size = (65, -1), min = -1e6, max = 1e6)
spin.SetValue(UserSettings.Get(group = 'nviz', key = 'fringe', subkey = 'elev'))
+ spin.Bind(wx.EVT_SPINCTRL, self.OnFringe)
self.win['fringe']['elev'] = spin.GetId()
gridSizer.Add(item = spin, pos = (0, 1))
@@ -1289,6 +1291,7 @@
size = globalvar.DIALOG_COLOR_SIZE)
color.SetColour(UserSettings.Get(group = 'nviz', key = 'fringe',
subkey = 'color'))
+ color.Bind(csel.EVT_COLOURSELECT, self.OnFringe)
self.win['fringe']['color'] = color.GetId()
gridSizer.Add(item = color, pos = (1, 1))
@@ -1306,13 +1309,17 @@
"""!Show/hide fringe"""
enabled = event.IsChecked()
win = self.FindWindowById(event.GetId())
- print win.GetName()
+
data = self.mapWindow.GetSelectedLayer(type = 'nviz')['surface']
sid = data['object']['id']
elev = self.FindWindowById(self.win['fringe']['elev']).GetValue()
color = self.FindWindowById(self.win['fringe']['color']).GetValue()
- self._display.SetFringe(sid, color, elev, True, True, True, True)
+ self._display.SetFringe(sid, color, elev,
+ self.FindWindowById(self.win['fringe']['nw']).IsChecked(),
+ self.FindWindowById(self.win['fringe']['ne']).IsChecked(),
+ self.FindWindowById(self.win['fringe']['sw']).IsChecked(),
+ self.FindWindowById(self.win['fringe']['se']).IsChecked())
self.mapWindow.Refresh(False)
def OnScroll(self, event, win, data):
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py 2010-06-23 08:44:27 UTC (rev 42639)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py 2010-06-23 08:48:53 UTC (rev 42640)
@@ -1129,7 +1129,7 @@
@param nw,ne,sw,se fringe edges (turn on/off)
"""
scolor = str(color[0]) + ':' + str(color[1]) + ':' + str(color[2])
- Nviz_new_fringe(self.data,
+
+ Nviz_set_fringe(self.data,
sid, Nviz_color_from_str(scolor),
elev, int(nw), int(ne), int(sw), int(se))
-
Modified: grass/branches/develbranch_6/include/nviz.h
===================================================================
--- grass/branches/develbranch_6/include/nviz.h 2010-06-23 08:44:27 UTC (rev 42639)
+++ grass/branches/develbranch_6/include/nviz.h 2010-06-23 08:48:53 UTC (rev 42640)
@@ -174,6 +174,8 @@
int Nviz_color_from_str(const char *);
struct fringe_data *Nviz_new_fringe(nv_data *, int, unsigned long,
double, int, int, int, int);
+struct fringe_data *Nviz_set_fringe(nv_data *, int, unsigned long,
+ double, int, int, int, int);
/* position.c */
void Nviz_init_view(nv_data *);
Modified: grass/branches/develbranch_6/lib/nviz/nviz.c
===================================================================
--- grass/branches/develbranch_6/lib/nviz/nviz.c 2010-06-23 08:44:27 UTC (rev 42639)
+++ grass/branches/develbranch_6/lib/nviz/nviz.c 2010-06-23 08:48:53 UTC (rev 42640)
@@ -139,3 +139,51 @@
return f;
}
+
+/*! Set fringe
+
+ \param data nviz data
+ \param id surface id
+ \param color color
+ \param elev fringe elevation
+ \param nw,ne,sw,se 1 (turn on) 0 (turn off)
+
+ \return pointer to allocated fringe_data structure
+ \return NULL on error
+*/
+struct fringe_data *Nviz_set_fringe(nv_data *data,
+ int id, unsigned long color,
+ double elev, int nw, int ne, int sw, int se)
+{
+ int i, num;
+ int *surf;
+ struct fringe_data *f;
+
+ if (!GS_surf_exists(id)) {
+ /* select first surface from the list */
+ surf = GS_get_surf_list(&num);
+ if (num < 1)
+ return NULL;
+ id = surf[0];
+ }
+
+ for (i = 0; i < data->num_fringes; i++) {
+ f = data->fringe[i];
+ if (f->id == id) {
+ f->color = color;
+ f->elev = elev;
+ f->where[0] = nw;
+ f->where[1] = ne;
+ f->where[2] = sw;
+ f->where[3] = se;
+
+ return f;
+ }
+ }
+
+ f = Nviz_new_fringe(data,
+ id, color,
+ elev, nw, ne, sw, se);
+
+ return f;
+}
More information about the grass-commit
mailing list