[GRASS-SVN] r52298 - in grass/trunk: gui/wxpython/core gui/wxpython/nviz include include/defs lib/ogsf
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 4 02:14:21 PDT 2012
Author: annakrat
Date: 2012-07-04 02:14:20 -0700 (Wed, 04 Jul 2012)
New Revision: 52298
Modified:
grass/trunk/gui/wxpython/core/settings.py
grass/trunk/gui/wxpython/nviz/tools.py
grass/trunk/gui/wxpython/nviz/workspace.py
grass/trunk/gui/wxpython/nviz/wxnviz.py
grass/trunk/include/defs/ogsf.h
grass/trunk/include/ogsf.h
grass/trunk/lib/ogsf/GVL2.c
grass/trunk/lib/ogsf/gvl.c
grass/trunk/lib/ogsf/gvld.c
Log:
wxNviz: optionally display wire box for volumes (not only for quick draw mode)
Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/gui/wxpython/core/settings.py 2012-07-04 09:14:20 UTC (rev 52298)
@@ -672,6 +672,7 @@
'mode' : 0, # isosurfaces
'shading' : 1, # gouraud
'resolution' : 3, # polygon resolution
+ 'box' : False # draw wire box
},
'shine': {
'map' : False,
Modified: grass/trunk/gui/wxpython/nviz/tools.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/tools.py 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/gui/wxpython/nviz/tools.py 2012-07-04 09:14:20 UTC (rev 52298)
@@ -1564,6 +1564,14 @@
resol.Bind(wx.EVT_TEXT, self.OnVolumeResolution)
gridSizer.Add(item = resol, pos = (0, 5))
+ # draw wire box
+ box = wx.CheckBox(parent = panel, id = wx.ID_ANY,
+ label = _("Draw wire box"))
+ box.SetName("value")
+ self.win['volume']['draw']['box'] = box.GetId()
+ box.Bind(wx.EVT_CHECKBOX, self.OnVolumeDrawBox)
+ gridSizer.Add(item = box, pos = (1, 0), span = (1, 6))
+
boxSizer.Add(item = gridSizer, proportion = 0,
flag = wx.ALL | wx.EXPAND, border = 3)
pageSizer.Add(item = boxSizer, proportion = 0,
@@ -3668,6 +3676,17 @@
"""!Set isosurface/slice draw mode"""
self.SetVolumeDrawMode(event.GetSelection())
+ def OnVolumeDrawBox(self, event):
+ """!Set wire box drawing"""
+ data = self.GetLayerData('volume')['volume']
+ vid = data['object']['id']
+ checked = self.FindWindowById(self.win['volume']['draw']['box']).GetValue()
+ self._display.SetVolumeDrawBox(vid, checked)
+ data['draw']['box']['enabled'] = checked
+
+ if self.mapDisplay.IsAutoRendered():
+ self.mapWindow.Refresh(False)
+
def SetVolumeDrawMode(self, selection):
"""!Set isosurface draw mode"""
data = self.GetLayerData('volume')['volume']
@@ -4769,6 +4788,8 @@
value = 1
if control == 'resolution':
value = idata[data['draw']['mode']['desc']]['value']
+ if control == 'box':
+ value = idata['enabled']
if win.GetName() == "selection":
win.SetSelection(value)
Modified: grass/trunk/gui/wxpython/nviz/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/workspace.py 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/gui/wxpython/nviz/workspace.py 2012-07-04 09:14:20 UTC (rev 52298)
@@ -120,6 +120,10 @@
desc = 'slice'
data['draw']['mode'] = { 'value' : sel,
'desc' : desc, }
+ elif control == 'box':
+ box = UserSettings.Get(group = 'nviz', key = 'volume', subkey = ['draw', 'box'])
+ data['draw']['box'] = {'enabled': box}
+
else:
data['draw'][control] = {}
data['draw'][control]['isosurface'] = { 'value' : value }
Modified: grass/trunk/gui/wxpython/nviz/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/wxnviz.py 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/gui/wxpython/nviz/wxnviz.py 2012-07-04 09:14:20 UTC (rev 52298)
@@ -1645,7 +1645,25 @@
GVL_set_trans(id, x, y, z)
return 1
-
+
+ def SetVolumeDrawBox(self, id, ifBox):
+ """!Display volume wire box
+
+ @param id volume id
+ @param ifBox True to draw wire box, False otherwise
+
+ @return 1 on success
+ @return -1 volume not found
+ """
+ if not GVL_vol_exists(id):
+ return -1
+
+ Debug.msg(3, "Nviz::SetVolumeDrawBox(): id=%d, ifBox=%d", id, ifBox)
+
+ GVL_set_draw_wire(id, int(ifBox))
+
+ return 1
+
def GetCPlaneCurrent(self):
return Nviz_get_current_cplane(self.data)
Modified: grass/trunk/include/defs/ogsf.h
===================================================================
--- grass/trunk/include/defs/ogsf.h 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/include/defs/ogsf.h 2012-07-04 09:14:20 UTC (rev 52298)
@@ -243,6 +243,7 @@
int GVL_get_volname(int, char *);
void GVL_set_trans(int, float, float, float);
int GVL_get_trans(int, float *, float *, float *);
+void GVL_set_draw_wire(int, int);
void GVL_draw_vol(int);
void GVL_draw_wire(int);
void GVL_alldraw_vol(void);
Modified: grass/trunk/include/ogsf.h
===================================================================
--- grass/trunk/include/ogsf.h 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/include/ogsf.h 2012-07-04 09:14:20 UTC (rev 52298)
@@ -443,6 +443,7 @@
double xmin, xmax, ymin, ymax, zmin, zmax;
double xrange, yrange, zrange;
float x_trans, y_trans, z_trans;
+ int draw_wire;
int n_isosurfs;
geovol_isosurf *isosurf[MAX_ISOSURFS];
Modified: grass/trunk/lib/ogsf/GVL2.c
===================================================================
--- grass/trunk/lib/ogsf/GVL2.c 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/lib/ogsf/GVL2.c 2012-07-04 09:14:20 UTC (rev 52298)
@@ -374,6 +374,27 @@
}
/*!
+ \brief Set drawing wire box
+
+ \param id volume set id
+ \param draw_wire 1 for drawing wire, 0 otherwise
+ */
+void GVL_set_draw_wire(int id, int draw_wire)
+{
+ geovol *gvl;
+
+ G_debug(3, "GVL_set_draw_wire");
+
+ gvl = gvl_get_vol(id);
+
+ if (gvl) {
+ gvl->draw_wire = draw_wire;
+ }
+
+ return;
+}
+
+/*!
\brief Draw volume set
\param vid volume set id
@@ -386,6 +407,9 @@
if (gvl) {
gvld_vol(gvl);
+ if (gvl->draw_wire) {
+ gvld_wind3_box(gvl);
+ }
}
return;
Modified: grass/trunk/lib/ogsf/gvl.c
===================================================================
--- grass/trunk/lib/ogsf/gvl.c 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/lib/ogsf/gvl.c 2012-07-04 09:14:20 UTC (rev 52298)
@@ -212,6 +212,7 @@
gvl->zrange = gvl->zmax - gvl->zmin;
gvl->x_trans = gvl->y_trans = gvl->z_trans = 0.0;
+ gvl->draw_wire = 0;
gvl->n_isosurfs = 0;
G_zero(gvl->isosurf, sizeof(geovol_isosurf *) * MAX_ISOSURFS);
Modified: grass/trunk/lib/ogsf/gvld.c
===================================================================
--- grass/trunk/lib/ogsf/gvld.c 2012-07-04 08:21:01 UTC (rev 52297)
+++ grass/trunk/lib/ogsf/gvld.c 2012-07-04 09:14:20 UTC (rev 52298)
@@ -67,7 +67,7 @@
*/
int gvld_wire_vol(geovol * gvl)
{
- G_debug(5, "gvld_vol(): id=%d", gvl->gvol_id);
+ G_debug(5, "gvld_wire_vol(): id=%d", gvl->gvol_id);
gvld_wind3_box(gvl);
More information about the grass-commit
mailing list