[GRASS-SVN] r33312 - grass/branches/develbranch_6/visualization/nviz2/cmd

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 7 07:50:38 EDT 2008


Author: martinl
Date: 2008-09-07 07:50:38 -0400 (Sun, 07 Sep 2008)
New Revision: 33312

Modified:
   grass/branches/develbranch_6/visualization/nviz2/cmd/args.c
   grass/branches/develbranch_6/visualization/nviz2/cmd/local_proto.h
   grass/branches/develbranch_6/visualization/nviz2/cmd/surface.c
   grass/branches/develbranch_6/visualization/nviz2/cmd/vector.c
Log:
nviz_cmd: options for position (surface, vlines, vpoints)


Modified: grass/branches/develbranch_6/visualization/nviz2/cmd/args.c
===================================================================
--- grass/branches/develbranch_6/visualization/nviz2/cmd/args.c	2008-09-07 11:49:01 UTC (rev 33311)
+++ grass/branches/develbranch_6/visualization/nviz2/cmd/args.c	2008-09-07 11:50:38 UTC (rev 33312)
@@ -279,6 +279,17 @@
     params->shade->answer = "gouraud";
     params->shade->guisection = _("Draw");
 
+    /* position */
+    params->surface_pos = G_define_option();
+    params->surface_pos->key = "position";
+    params->surface_pos->key_desc = "x,y,z";
+    params->surface_pos->type = TYPE_INTEGER;
+    params->surface_pos->required = YES;
+    params->surface_pos->multiple = YES;
+    params->surface_pos->description = _("Position");
+    params->surface_pos->guisection = _("Draw");
+    params->surface_pos->answer = "0,0,0";
+    
     return;
 }
 
@@ -336,6 +347,17 @@
     params->vline_height->options = "0-1000";
     params->vline_height->answer = "0";
 
+    /* position */
+    params->vline_pos = G_define_option();
+    params->vline_pos->key = "vline_position";
+    params->vline_pos->key_desc = "x,y,z";
+    params->vline_pos->type = TYPE_INTEGER;
+    params->vline_pos->required = YES;
+    params->vline_pos->multiple = YES;
+    params->vline_pos->description = _("Position");
+    params->vline_pos->guisection = _("Vector lines");
+    params->vline_pos->answer = "0,0,0";
+
     return;
 }
 
@@ -394,6 +416,17 @@
     params->vpoint_marker->answer = "sphere";
     params->vpoint_marker->guisection = _("Vector points");
 
+    /* position */
+    params->vpoint_pos = G_define_option();
+    params->vpoint_pos->key = "vpoint_position";
+    params->vpoint_pos->key_desc = "x,y,z";
+    params->vpoint_pos->type = TYPE_INTEGER;
+    params->vpoint_pos->required = YES;
+    params->vpoint_pos->multiple = YES;
+    params->vpoint_pos->description = _("Position");
+    params->vpoint_pos->guisection = _("Vector points");
+    params->vpoint_pos->answer = "0,0,0";
+    
     return;
 }
 

Modified: grass/branches/develbranch_6/visualization/nviz2/cmd/local_proto.h
===================================================================
--- grass/branches/develbranch_6/visualization/nviz2/cmd/local_proto.h	2008-09-07 11:49:01 UTC (rev 33311)
+++ grass/branches/develbranch_6/visualization/nviz2/cmd/local_proto.h	2008-09-07 11:50:38 UTC (rev 33312)
@@ -14,11 +14,11 @@
       *mask_map, *transp_map, *transp_const, *shine_map, *shine_const,
       *emit_map, *emit_const,
     /* surface draw mode */
-      *mode, *res_fine, *res_coarse, *style, *shade, *wire_color,
+      *mode, *res_fine, *res_coarse, *style, *shade, *wire_color, *surface_pos,
     /* vector lines */
-      *vlines, *vline_width, *vline_color, *vline_mode, *vline_height,
+      *vlines, *vline_width, *vline_color, *vline_mode, *vline_height, *vline_pos,
     /* vector points */
-      *vpoints, *vpoint_size, *vpoint_marker, *vpoint_color, *vpoint_width,
+      *vpoints, *vpoint_size, *vpoint_marker, *vpoint_color, *vpoint_width, *vpoint_pos,
     /* volumes */
       *volume, *volume_mode, *volume_shade, *volume_pos, *volume_res, *isosurf_level,
     /* misc */

Modified: grass/branches/develbranch_6/visualization/nviz2/cmd/surface.c
===================================================================
--- grass/branches/develbranch_6/visualization/nviz2/cmd/surface.c	2008-09-07 11:49:01 UTC (rev 33311)
+++ grass/branches/develbranch_6/visualization/nviz2/cmd/surface.c	2008-09-07 11:50:38 UTC (rev 33312)
@@ -37,6 +37,8 @@
     int *surf_list, nsurfs;
     int id;
 
+    double x, y, z;
+
     nelev_map = opt_get_num_answers(params->elev_map);
     nelev_const = opt_get_num_answers(params->elev_const);
 
@@ -72,6 +74,13 @@
 			      i + 1);
 	    }
 	}
+
+	/* set position */
+	x = atof(params->surface_pos->answers[i]);
+	y = atof(params->surface_pos->answers[i+1]);
+	z = atof(params->surface_pos->answers[i+2]);
+
+	GS_set_trans(id, x, y, z);
     }
 
     /* set surface attributes */

Modified: grass/branches/develbranch_6/visualization/nviz2/cmd/vector.c
===================================================================
--- grass/branches/develbranch_6/visualization/nviz2/cmd/vector.c	2008-09-07 11:49:01 UTC (rev 33311)
+++ grass/branches/develbranch_6/visualization/nviz2/cmd/vector.c	2008-09-07 11:50:38 UTC (rev 33312)
@@ -22,7 +22,7 @@
 #include "local_proto.h"
 
 static int load_vectors(const struct Option *, const struct Option *,
-			const struct Option *, int, nv_data *);
+			const struct Option *, const struct Option *, int, nv_data *);
 
 /*!
    \brief Load vector maps (lines)
@@ -35,7 +35,8 @@
 int load_vlines(const struct GParams *params, nv_data * data)
 {
     return load_vectors(params->elev_map, params->elev_const,
-			params->vlines, MAP_OBJ_VECT, data);
+			params->vlines, params->vline_pos,
+			MAP_OBJ_VECT, data);
 }
 
 /*!
@@ -49,18 +50,22 @@
 int load_vpoints(const struct GParams *params, nv_data * data)
 {
     return load_vectors(params->elev_map, params->elev_const,
-			params->vpoints, MAP_OBJ_SITE, data);
+			params->vpoints, params->vpoint_pos,
+			MAP_OBJ_SITE, data);
 }
 
 int load_vectors(const struct Option *elev_map,
 		 const struct Option *elev_const, const struct Option *vect,
+		 const struct Option *position,
 		 int map_obj_type, nv_data * data)
 {
-    int i;
+    int i, id;
     int nvects;
 
     char *mapset;
 
+    double x, y, z;
+    
     if ((!elev_map->answer || elev_const->answer) && GS_num_surfs() == 0) {	/* load base surface if no loaded */
 	int *surf_list, nsurf;
 
@@ -77,10 +82,20 @@
 	if (mapset == NULL) {
 	    G_fatal_error(_("Vector map <%s> not found"), vect->answers[i]);
 	}
-	Nviz_new_map_obj(map_obj_type,
-			 G_fully_qualified_name(vect->answers[i], mapset),
-			 0.0, data);
+	id = Nviz_new_map_obj(map_obj_type,
+			      G_fully_qualified_name(vect->answers[i], mapset),
+			      0.0, data);
 
+	/* set position */
+	x = atof(position->answers[i]);
+	y = atof(position->answers[i+1]);
+	z = atof(position->answers[i+2]);
+
+	if (map_obj_type == MAP_OBJ_VECT)
+	    GV_set_trans(id, x, y, z);
+	else
+	    GP_set_trans(id, x, y, z);
+
 	nvects++;
     }
 



More information about the grass-commit mailing list