[GRASS-SVN] r42635 - in grass/trunk: gui/wxpython
gui/wxpython/gui_modules include lib/nviz lib/ogsf
visualization/nviz2/cmd
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jun 22 18:56:59 EDT 2010
Author: martinl
Date: 2010-06-22 22:56:59 +0000 (Tue, 22 Jun 2010)
New Revision: 42635
Modified:
grass/trunk/gui/wxpython/gui_modules/globalvar.py
grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
grass/trunk/gui/wxpython/gui_modules/preferences.py
grass/trunk/gui/wxpython/gui_modules/wxnviz.py
grass/trunk/gui/wxpython/wxgui.py
grass/trunk/include/nviz.h
grass/trunk/lib/nviz/draw.c
grass/trunk/lib/nviz/map_obj.c
grass/trunk/lib/nviz/nviz.c
grass/trunk/lib/ogsf/GS2.c
grass/trunk/visualization/nviz2/cmd/args.c
grass/trunk/visualization/nviz2/cmd/local_proto.h
grass/trunk/visualization/nviz2/cmd/main.c
Log:
nvizlib: fringe implemented (including nviz_cmd and wxNviz)
Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py 2010-06-22 22:56:59 UTC (rev 42635)
@@ -98,6 +98,12 @@
FN.FNB_BACKGROUND_GRADIENT | \
FN.FNB_NODRAG | \
FN.FNB_TABS_BORDER_SIMPLE
+
+FNPageDStyle = FN.FNB_FANCY_TABS | \
+ FN.FNB_BOTTOM | \
+ FN.FNB_NO_NAV_BUTTONS | \
+ FN.FNB_NO_X_BUTTON
+
FNPageColor = wx.Colour(125,200,175)
"""!Dialog widget dimension"""
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-06-22 22:56:59 UTC (rev 42635)
@@ -179,6 +179,7 @@
if layer:
if layer.type == 'raster':
self.lmgr.nviz.UpdatePage('surface')
+ self.lmgr.nviz.UpdatePage('fringe')
elif layer.type == 'vector':
self.lmgr.nviz.UpdatePage('vector')
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2010-06-22 22:56:59 UTC (rev 42635)
@@ -38,6 +38,7 @@
from preferences import globalSettings as UserSettings
from preferences import PreferencesBaseDialog
from nviz_mapdisp import wxUpdateView, wxUpdateLight, wxUpdateProperties
+from debug import Debug
import wxnviz
# sys.path.append(os.path.join(globalvar.ETCWXDIR, "nviz"))
@@ -62,22 +63,18 @@
self.win = {} # window ids
self.page = {} # page ids
-
+
# view page
self.AddPage(page = self._createViewPage(),
text = " %s " % _("View"))
- # surface page
- self.AddPage(page = self._createSurfacePage(),
- text = " %s " % _("Surface"))
- # vector page
- self.AddPage(page = self._createVectorPage(),
- text = " %s " % _("Vector"))
- # volume page
- self.AddPage(page = self._createVolumePage(),
- text = " %s " % _("Volume"))
- # light page
- self.AddPage(page = self._createLightPage(),
- text = " %s " % _("Light"))
+
+ # data page
+ self.AddPage(page = self._createDataPage(),
+ text = " %s " % _("Data"))
+
+ # appearance page
+ self.AddPage(page = self._createAppearancePage(),
+ text = " %s " % _("Appearance"))
self.UpdateSettings()
self.pageChanging = False
@@ -257,6 +254,36 @@
return panel
+ def _createDataPage(self):
+ """!Create data (surface, vector, volume) settings page"""
+ self.notebookData = FN.FlatNotebook(parent = self, id = wx.ID_ANY,
+ style = globalvar.FNPageDStyle)
+ # surface page
+ self.notebookData.AddPage(page = self._createSurfacePage(),
+ text = " %s " % _("Surface"))
+ # vector page
+ self.notebookData.AddPage(page = self._createVectorPage(),
+ text = " %s " % _("Vector"))
+ # volume page
+ self.notebookData.AddPage(page = self._createVolumePage(),
+ text = " %s " % _("Volume"))
+
+ return self.notebookData
+
+ def _createAppearancePage(self):
+ """!Create data (surface, vector, volume) settings page"""
+ self.notebookAppearance = FN.FlatNotebook(parent = self, id = wx.ID_ANY,
+ style = globalvar.FNPageDStyle)
+ # light page
+ self.notebookAppearance.AddPage(page = self._createLightPage(),
+ text = " %s " % _("Lighting"))
+
+ # fringe page
+ self.notebookAppearance.AddPage(page = self._createFringePage(),
+ text = " %s " % _("Fringe"))
+
+ return self.notebookAppearance
+
def _createSurfacePage(self):
"""!Create view settings page"""
panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
@@ -1192,7 +1219,100 @@
panel.SetSizer(pageSizer)
return panel
+
+ def _createFringePage(self):
+ """!Create fringe page"""
+ panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
+ panel.SetupScrolling(scroll_x = False)
+
+ self.page['fringe'] = { 'id' : 2 }
+ self.win['fringe'] = {}
+
+ pageSizer = wx.BoxSizer(wx.VERTICAL)
+
+ # selection
+ rbox = wx.StaticBox (parent = panel, id = wx.ID_ANY,
+ label = " %s " % (_("Surface")))
+ rboxSizer = wx.StaticBoxSizer(rbox, wx.VERTICAL)
+ rmaps = gselect.Select(parent = panel, type = 'raster',
+ onPopup = self.GselectOnPopup)
+ self.win['fringe']['surface'] = rmaps.GetId()
+ rboxSizer.Add(item = rmaps, proportion = 0,
+ flag = wx.ALL,
+ border = 3)
+ pageSizer.Add(item = rboxSizer, proportion = 0,
+ flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
+ border = 3)
+
+ ebox = wx.StaticBox (parent = panel, id = wx.ID_ANY,
+ label = " %s " % (_("Edges with fringe")))
+ eboxSizer = wx.StaticBoxSizer(ebox, wx.HORIZONTAL)
+ for edge in [(_("N && W"), "nw"),
+ (_("N && E"), "ne"),
+ (_("S && W"), "sw"),
+ (_("S && E"), "se")]:
+ chkbox = wx.CheckBox(parent = panel,
+ label = edge[0],
+ name = edge[1])
+ eboxSizer.Add(item = chkbox, proportion = 0,
+ flag = wx.ADJUST_MINSIZE | wx.LEFT | wx.RIGHT, border = 5)
+ chkbox.Bind(wx.EVT_CHECKBOX, self.OnFringe)
+
+ pageSizer.Add(item = eboxSizer, proportion = 0,
+ flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
+ border = 3)
+
+ sbox = wx.StaticBox (parent = panel, id = wx.ID_ANY,
+ label = " %s " % (_("Settings")))
+ sboxSizer = wx.StaticBoxSizer(sbox, wx.HORIZONTAL)
+ gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+
+ # elevation
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("Elevation of fringe from bottom:")),
+ pos = (0, 0),
+ flag = wx.ALIGN_CENTER_VERTICAL)
+ 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'))
+ self.win['fringe']['elev'] = spin.GetId()
+ gridSizer.Add(item = spin, pos = (0, 1))
+
+ # color
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("Color:")),
+ pos = (1, 0),
+ flag = wx.ALIGN_CENTER_VERTICAL)
+ color = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
+ size = globalvar.DIALOG_COLOR_SIZE)
+ color.SetColour(UserSettings.Get(group = 'nviz', key = 'fringe',
+ subkey = 'color'))
+ self.win['fringe']['color'] = color.GetId()
+ gridSizer.Add(item = color, pos = (1, 1))
+
+ sboxSizer.Add(item = gridSizer, proportion = 1,
+ flag = wx.ALL | wx.EXPAND, border = 3)
+ pageSizer.Add(item = sboxSizer, proportion = 0,
+ flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
+ border = 3)
+
+ panel.SetSizer(pageSizer)
+
+ return panel
+ def OnFringe(self, event):
+ """!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.mapWindow.Refresh(False)
+
def OnScroll(self, event, win, data):
"""!Generic scrolling handler"""
winName = self.__GetWindowName(win, event.GetId())
@@ -2262,6 +2382,7 @@
self.pageChanging = True
layer = self.mapWindow.GetSelectedLayer()
data = self.mapWindow.GetSelectedLayer(type = 'nviz')
+ Debug.msg(1, "NvizToolWindow.UpdatePage(): %s", pageId)
if pageId == 'view':
self.SetPage('view')
@@ -2299,7 +2420,11 @@
self.FindWindowById(self.win['light']['z'][control]).SetValue(zval)
self.FindWindowById(self.win['light']['bright'][control]).SetValue(bval)
self.FindWindowById(self.win['light']['ambient'][control]).SetValue(aval)
-
+ elif pageId == 'fringe':
+ mapLayer = self.mapWindow.GetSelectedLayer()
+ win = self.FindWindowById(self.win['fringe']['surface'])
+ win.SetValue(mapLayer.GetName())
+
self.Update()
self.pageChanging = False
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2010-06-22 22:56:59 UTC (rev 42635)
@@ -523,6 +523,10 @@
'bright' : 80,
'ambient' : 20,
},
+ 'fringe' : {
+ 'elev' : 55,
+ 'color' : (128, 128, 128, 255), # grey
+ },
},
'modeler' : {
'action' : {
Modified: grass/trunk/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2010-06-22 22:56:59 UTC (rev 42635)
@@ -663,7 +663,7 @@
GS_get_trans(id, byref(x), byref(y), byref(z))
Debug.msg(3, "Nviz::GetSurfacePosition(): id=%d, x=%f, y=%f, z=%f",
- id, x, y, z)
+ id, x.value, y.value, z.value)
return [x.value, y.value, z.value]
@@ -1119,3 +1119,17 @@
"""!Draw lighting model"""
if self.showLight:
GS_draw_lighting_model()
+
+ def SetFringe(self, sid, color, elev, nw = False, ne = False, sw = False, se = False):
+ """!Set fringe
+
+ @param sid surface id
+ @param color color
+ @param elev elevation (height)
+ @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,
+ sid, Nviz_color_from_str(scolor),
+ elev, int(nw), int(ne), int(sw), int(se))
+
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/gui/wxpython/wxgui.py 2010-06-22 22:56:59 UTC (rev 42635)
@@ -195,15 +195,10 @@
def __createNoteBook(self):
"""!Creates notebook widgets"""
- nbStyle = FN.FNB_FANCY_TABS | \
- FN.FNB_BOTTOM | \
- FN.FNB_NO_NAV_BUTTONS | \
- FN.FNB_NO_X_BUTTON
-
if globalvar.hasAgw:
- self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, agwStyle = nbStyle)
+ self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, agwStyle = globalvar.FNPageDStyle)
else:
- self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, style = nbStyle)
+ self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, style = globalvar.FNPageDStyle)
# create displays notebook widget and add it to main notebook page
cbStyle = globalvar.FNPageStyle
Modified: grass/trunk/include/nviz.h
===================================================================
--- grass/trunk/include/nviz.h 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/include/nviz.h 2010-06-22 22:56:59 UTC (rev 42635)
@@ -76,6 +76,14 @@
float x, y, z, w; /* position */
} light_data;
+struct fringe_data
+{
+ int id;
+ unsigned long color;
+ float elev;
+ int where[4];
+};
+
typedef struct
{
/* ranges */
@@ -89,37 +97,16 @@
/* light */
light_data light[MAX_LIGHTS];
-
+
+ /* fringe */
+ int num_fringes;
+ struct fringe_data **fringe;
+
/* background color */
int bgcolor;
} nv_data;
-/* The following structure is used to associate client data with surfaces.
- * We do this so that we don't have to rely on the surface ID (which is libal to change
- * between subsequent executions of nviz) when saving set-up info to files.
- */
-
-typedef struct
-{
- /* We use logical names to assign textual names to map objects.
- When Nviz needs to refer to a map object it uses the logical name
- rather than the map ID. By setting appropriate logical names, we
- can reuse names inbetween executions of Nviz. The Nviz library
- also provides a mechanism for aliasing between logical names.
- Thus several logical names may refer to the same map object.
- Aliases are meant to support the case in which two logical names
- happen to be the same. The Nviz library automatically assigns
- logical names uniquely if they are not specified in the creation
- of a map object. When loading a saved file containing several map
- objects, it is expected that the map 0bjects will be aliased to
- their previous names. This ensures that old scripts will work.
- */
-
- char *logical_name;
-
-} nv_clientdata;
-
struct render_window
{
#if defined(OPENGL_X11)
@@ -182,8 +169,11 @@
/* nviz.c */
void Nviz_init_data(nv_data *);
+void Nviz_destroy_data(nv_data *);
void Nviz_set_bgcolor(nv_data *, int);
int Nviz_color_from_str(const char *);
+struct fringe_data *Nviz_new_fringe(nv_data *, int, unsigned long,
+ double, int, int, int, int);
/* position.c */
void Nviz_init_view(nv_data *);
Modified: grass/trunk/lib/nviz/draw.c
===================================================================
--- grass/trunk/lib/nviz/draw.c 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/lib/nviz/draw.c 2010-06-22 22:56:59 UTC (rev 42635)
@@ -198,8 +198,9 @@
*/
int Nviz_draw_all(nv_data * data)
{
+ int i;
int draw_surf, draw_vect, draw_site, draw_vol;
-
+
draw_surf = 1;
draw_vect = 1;
draw_site = 1;
@@ -232,6 +233,11 @@
if (draw_vol)
Nviz_draw_all_vol(data);
+ for(i = 0; i < data->num_fringes; i++) {
+ struct fringe_data * f = data->fringe[i];
+ GS_draw_fringe(f->id, f->color, f->elev, f->where);
+ }
+
GS_done_draw();
GS_set_draw(GSD_BACK);
Modified: grass/trunk/lib/nviz/map_obj.c
===================================================================
--- grass/trunk/lib/nviz/map_obj.c 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/lib/nviz/map_obj.c 2010-06-22 22:56:59 UTC (rev 42635)
@@ -46,8 +46,6 @@
int new_id, i;
int num_surfs, *surf_list;
- nv_clientdata *client_data;
-
/*
* For each type of map obj do the following --
* 1) Verify we havn't maxed out the number of
@@ -162,36 +160,7 @@
G_warning(_("Nviz_new_map_obj(): unsupported data type"));
return -1;
}
-
- /* initialize the client data filled for the new map object */
- client_data = (nv_clientdata *) G_malloc(sizeof(nv_clientdata));
-
- if (name) {
- client_data->logical_name = G_store(name);
- }
- else {
- char temp_space[80];
- time_t tp;
-
- /* Need to generate a random id */
- time(&tp);
- switch (type) {
- case MAP_OBJ_SURF:{
- sprintf(temp_space, "%s*%ld", "surface", tp);
- break;
- }
- default:{
- sprintf(temp_space, "%s*%ld", "unknown", tp);
- break;
- }
- }
- client_data->logical_name = G_store(temp_space);
- }
-
- G_debug(3, "new_map_obj(): logical name=%s", client_data->logical_name);
-
- GS_Set_ClientData(new_id, (void *)client_data);
-
+
return new_id;
}
Modified: grass/trunk/lib/nviz/nviz.c
===================================================================
--- grass/trunk/lib/nviz/nviz.c 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/lib/nviz/nviz.c 2010-06-22 22:56:59 UTC (rev 42635)
@@ -43,9 +43,28 @@
Nviz_new_light(data);
}
+ /* fringe */
+ data->num_fringes = 0;
+ data->fringe = NULL;
+
return;
}
+/*! \brief Free allocated space by nv_data struct
+
+ \param data nviz data
+*/
+void Nviz_destroy_data(nv_data *data)
+{
+ int i;
+ for (i = 0; data->num_fringes; i++) {
+ G_free(data->fringe[i]);
+ data->fringe[i] = NULL;
+ }
+ data->num_fringes = 0;
+ data->fringe = NULL;
+}
+
/*!
\brief Set background color
@@ -79,3 +98,46 @@
return (red & RED_MASK) + ((int)((grn) << 8) & GRN_MASK) +
((int)((blu) << 16) & BLU_MASK);
}
+
+/*! Add new 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_new_fringe(nv_data *data,
+ int id, unsigned long color,
+ double elev, int nw, int ne, int sw, int se)
+{
+ int 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];
+ }
+
+
+ f = (struct fringe_data *) G_malloc(sizeof(struct fringe_data));
+ 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;
+
+ data->fringe = (struct fringe_data **) G_realloc(data->fringe, data->num_fringes + 1 * sizeof(struct fringe_data *));
+ data->fringe[data->num_fringes++] = f;
+
+ return f;
+}
Modified: grass/trunk/lib/ogsf/GS2.c
===================================================================
--- grass/trunk/lib/ogsf/GS2.c 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/lib/ogsf/GS2.c 2010-06-22 22:56:59 UTC (rev 42635)
@@ -801,17 +801,19 @@
}
/*!
- \brief Draw fringe around data at selected corners
+ \brief Draw fringe around data (surface) at selected corners
\param id surface id
- \param clr ?
+ \param clr color
\param elev elevation value
- \param where ?
+ \param where nw/ne/sw/se edges - 0 (turn off) 1 (turn on)
*/
void GS_draw_fringe(int id, unsigned long clr, float elev, int *where)
{
geosurf *gs;
+ G_debug(3, "GS_draw_fringe(): id: %d clr: %ld elev %f edges: %d %d %d %d",
+ id, clr, elev, where[0], where[1], where[2], where[3]);
if ((gs = gs_get_surf(id)))
gsd_display_fringe(gs, clr, elev, where);
Modified: grass/trunk/visualization/nviz2/cmd/args.c
===================================================================
--- grass/trunk/visualization/nviz2/cmd/args.c 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/visualization/nviz2/cmd/args.c 2010-06-22 22:56:59 UTC (rev 42635)
@@ -30,6 +30,7 @@
static void args_viewpoint(struct GParams *);
static void args_volume(struct GParams *);
static void args_lighting(struct GParams *);
+static void args_fringe(struct GParams *);
/*!
\brief Parse command
@@ -69,6 +70,9 @@
/*** lighting ***/
args_lighting(params);
+
+ /*** fringe ***/
+ args_fringe(params);
/*** output image ***/
/* output */
@@ -138,7 +142,8 @@
params->color_const->multiple = YES;
params->color_const->label = _("Color value(s)");
params->color_const->guisection = _("Surfaces");
-
+ params->color_const->answer = NULL;
+
/* mask */
params->mask_map = G_define_standard_option(G_OPT_R_MAP);
params->mask_map->multiple = YES;
@@ -601,6 +606,36 @@
params->light_ambient->options="0-100";
}
+void args_fringe(struct GParams *params)
+{
+ params->fringe = G_define_option();
+ params->fringe->key = "fringe";
+ params->fringe->type = TYPE_STRING;
+ params->fringe->options = "nw,ne,sw,se";
+ params->fringe->descriptions = _("nw;North-West edge;"
+ "ne;North-East edge;"
+ "sw;South-West edge;"
+ "se;South-East edge");
+ params->fringe->description = _("Fringe edges");
+ params->fringe->guisection = _("Fringe");
+ params->fringe->multiple = YES;
+
+ params->fringe_color = G_define_standard_option(G_OPT_C_FG);
+ params->fringe_color->key = "fringe_color";
+ params->fringe_color->label = _("Fringe color");
+ params->fringe_color->guisection = _("Fringe");
+ params->fringe_color->answer = "grey";
+
+ params->fringe_elev = G_define_option();
+ params->fringe_elev->key = "fringe_elevation";
+ params->fringe_elev->type = TYPE_INTEGER;
+ params->fringe_elev->required = NO;
+ params->fringe_elev->multiple = NO;
+ params->fringe_elev->description = _("Fringe elevation");
+ params->fringe_elev->guisection = _("Fringe");
+ params->fringe_elev->answer = "55";
+}
+
/*!
\brief Get number of answers of given option
Modified: grass/trunk/visualization/nviz2/cmd/local_proto.h
===================================================================
--- grass/trunk/visualization/nviz2/cmd/local_proto.h 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/visualization/nviz2/cmd/local_proto.h 2010-06-22 22:56:59 UTC (rev 42635)
@@ -28,7 +28,9 @@
/* output */
*output, *format, *size,
/* lighting */
- *light_pos, *light_color, *light_bright, *light_ambient;
+ *light_pos, *light_color, *light_bright, *light_ambient,
+ /* fringe */
+ *fringe, *fringe_color, *fringe_elev;
};
/* args.c */
Modified: grass/trunk/visualization/nviz2/cmd/main.c
===================================================================
--- grass/trunk/visualization/nviz2/cmd/main.c 2010-06-22 17:07:57 UTC (rev 42634)
+++ grass/trunk/visualization/nviz2/cmd/main.c 2010-06-22 22:56:59 UTC (rev 42635)
@@ -32,12 +32,12 @@
struct GModule *module;
struct GParams *params;
- int ret;
+ int i, ret;
int red, grn, blu;
double vp_height, z_exag; /* calculated viewpoint height, z-exag */
int width, height; /* output image size */
char *output_name;
-
+
nv_data data;
struct render_window *offscreen;
@@ -165,6 +165,27 @@
Nviz_set_light_color(&data, 1, red, grn, blu);
Nviz_set_light_ambient(&data, 1,
atof(params->light_ambient->answer) / 100.0);
+
+ /* define fringes */
+ if (params->fringe->answer) {
+ int nw, ne, sw, se;
+
+ i = 0;
+ nw = ne = sw = se = 0;
+ while(params->fringe->answers[i]) {
+ const char *edge = params->fringe->answers[i++];
+ if (strcmp(edge, "nw") == 0)
+ nw = 1;
+ else if (strcmp(edge, "ne") == 0)
+ ne = 1;
+ else if (strcmp(edge, "sw") == 0)
+ sw = 1;
+ else if (strcmp(edge, "se") == 0)
+ se = 1;
+ }
+ Nviz_new_fringe(&data, -1, Nviz_color_from_str(params->fringe_color->answer),
+ atof(params->fringe_elev->answer), nw, ne, sw, se);
+ }
GS_clear(data.bgcolor);
More information about the grass-commit
mailing list