Browse Source

add option to drape 3D points on DEM surface

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56502 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 12 years ago
parent
commit
bce4b4e0f6
3 changed files with 34 additions and 8 deletions
  1. 19 2
      misc/m.nviz.image/args.c
  2. 3 2
      misc/m.nviz.image/local_proto.h
  3. 12 4
      misc/m.nviz.image/vector.c

+ 19 - 2
misc/m.nviz.image/args.c

@@ -361,6 +361,8 @@ void args_vline(struct GParams *params)
     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 @@ void args_vpoint(struct GParams *params)
     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 @@ void args_vpoint(struct GParams *params)
     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 @@ void args_vpoint(struct GParams *params)
     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";

+ 3 - 2
misc/m.nviz.image/local_proto.h

@@ -19,8 +19,9 @@ struct GParams
 	*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,

+ 12 - 4
misc/m.nviz.image/vector.c

@@ -174,7 +174,8 @@ int vpoints_set_attrb(const struct GParams *params)
     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 @@ int vpoints_set_attrb(const struct GParams *params)
 
     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 @@ int vpoints_set_attrb(const struct GParams *params)
 	marker_column = params->vpoint_marker_column->answers ?
 	    params->vpoint_marker_column->answers[i] : NULL;
 	marker = GP_str_to_marker(marker_str);
-
-        if (with_z)
-            GP_set_zmode(site_list[i], TRUE);
+	placement = params->vpoint_mode->answers ?
+	    params->vpoint_mode->answers[i] : NULL;
+
+        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;