[GRASS-SVN] r56502 - grass/trunk/misc/m.nviz.image

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 29 23:28:04 PDT 2013


Author: hamish
Date: 2013-05-29 23:28:03 -0700 (Wed, 29 May 2013)
New Revision: 56502

Modified:
   grass/trunk/misc/m.nviz.image/args.c
   grass/trunk/misc/m.nviz.image/local_proto.h
   grass/trunk/misc/m.nviz.image/vector.c
Log:
add option to drape 3D points on DEM surface

Modified: grass/trunk/misc/m.nviz.image/args.c
===================================================================
--- grass/trunk/misc/m.nviz.image/args.c	2013-05-30 05:59:51 UTC (rev 56501)
+++ grass/trunk/misc/m.nviz.image/args.c	2013-05-30 06:28:03 UTC (rev 56502)
@@ -361,6 +361,8 @@
     params->vline_mode->multiple = YES;
     params->vline_mode->description = _("Vector line display mode");
     params->vline_mode->options = "surface,flat";
+    params->vline_mode->descriptions = _("surface;drape on raster surface;"
+					 "flat;draw at constant elevation");
     params->vline_mode->answer = "surface";
     params->vline_mode->guisection = _("Vector lines");
 
@@ -414,7 +416,7 @@
     params->vpoint_size->type = TYPE_INTEGER;
     params->vpoint_size->required = NO;
     params->vpoint_size->multiple = YES;
-    params->vpoint_size->description = _("Icon size");
+    params->vpoint_size->description = _("Icon size (map units)");
     params->vpoint_size->guisection = _("Vector points");
     params->vpoint_size->options = "1-1000";
     params->vpoint_size->answer = "100";
@@ -461,7 +463,7 @@
     params->vpoint_color_column->key = "vpoint_color_column";
     params->vpoint_color_column->guisection = _("Vector points");
 
-    /* point mode */
+    /* point icon type */
     params->vpoint_marker = G_define_option();
     params->vpoint_marker->key = "vpoint_marker";
     params->vpoint_marker->key_desc = "string";
@@ -481,6 +483,21 @@
     params->vpoint_marker_column->key = "vpoint_marker_column";
     params->vpoint_marker_column->guisection = _("Vector points");
 
+    /* point mode */
+    params->vpoint_mode = G_define_option();
+    params->vpoint_mode->key = "vpoint_mode";
+    params->vpoint_mode->key_desc = "string";
+    params->vpoint_mode->type = TYPE_STRING;
+    params->vpoint_mode->required = NO;
+    params->vpoint_mode->multiple = YES;
+    params->vpoint_mode->description = _("3D vector point display mode");
+    params->vpoint_mode->options = "surface,3D";
+    params->vpoint_mode->descriptions = _("surface;drape on raster surface;"
+					  "3D;place at 3D point's z-elevation");
+					  /* TODO: "flat", place at a constant elevation */
+    params->vpoint_mode->answer = "3D";
+    params->vpoint_mode->guisection = _("Vector points");
+
     /* position */
     params->vpoint_pos = G_define_option();
     params->vpoint_pos->key = "vpoint_position";

Modified: grass/trunk/misc/m.nviz.image/local_proto.h
===================================================================
--- grass/trunk/misc/m.nviz.image/local_proto.h	2013-05-30 05:59:51 UTC (rev 56501)
+++ grass/trunk/misc/m.nviz.image/local_proto.h	2013-05-30 06:28:03 UTC (rev 56502)
@@ -19,8 +19,9 @@
 	*vlines, *vline_width, *vline_color, *vline_mode, *vline_height, *vline_pos,
 	*vline_layer, *vline_color_column, *vline_width_column,
     /* vector points */
-	*vpoints, *vpoint_size, *vpoint_marker, *vpoint_color, *vpoint_width, *vpoint_pos,
-	*vpoint_layer, *vpoint_size_column, *vpoint_marker_column, *vpoint_color_column, *vpoint_width_column,
+	*vpoints, *vpoint_size, *vpoint_mode, *vpoint_marker, *vpoint_color,
+	*vpoint_width, *vpoint_pos, *vpoint_layer, *vpoint_size_column,
+	*vpoint_marker_column, *vpoint_color_column, *vpoint_width_column,
     /* volumes */
 	*volume, *volume_mode, *volume_shade, *volume_pos, *volume_res, *isosurf_level,
 	*isosurf_color_map, *isosurf_color_const, *isosurf_transp_map, *isosurf_transp_const,

Modified: grass/trunk/misc/m.nviz.image/vector.c
===================================================================
--- grass/trunk/misc/m.nviz.image/vector.c	2013-05-30 05:59:51 UTC (rev 56501)
+++ grass/trunk/misc/m.nviz.image/vector.c	2013-05-30 06:28:03 UTC (rev 56502)
@@ -174,7 +174,8 @@
     int *site_list, nsites;
     int marker, color, width;
     float size;
-    char *marker_str, *color_column, *size_column, *width_column, *marker_column;
+    char *marker_str, *color_column, *size_column, *width_column,
+	 *marker_column, *placement;
 
     struct Colors colors;
     
@@ -182,6 +183,7 @@
 
     for (i = 0; i < nsites; i++) {
         check_map(params, i, FALSE, &layer, &with_z);
+
 	color = Nviz_color_from_str(params->vpoint_color->answers[i]);
 	color_column = params->vpoint_color_column->answers ?
 	    params->vpoint_color_column->answers[i] : NULL;
@@ -195,9 +197,15 @@
 	marker_column = params->vpoint_marker_column->answers ?
 	    params->vpoint_marker_column->answers[i] : NULL;
 	marker = GP_str_to_marker(marker_str);
+	placement = params->vpoint_mode->answers ?
+	    params->vpoint_mode->answers[i] : NULL;
 
-        if (with_z)
-            GP_set_zmode(site_list[i], TRUE);
+        if (with_z) {
+	    if (strcmp(params->vpoint_mode->answers[i], "surface") == 0)
+		GP_set_zmode(site_list[i], FALSE);
+	    else
+		GP_set_zmode(site_list[i], TRUE);
+	}
 
 	if (GP_set_style(site_list[i], color, width, size, marker) < 0)
 	    return 0;



More information about the grass-commit mailing list