|
@@ -1,18 +1,16 @@
|
|
|
/*!
|
|
|
- \file args.c
|
|
|
-
|
|
|
- \brief Parse command
|
|
|
-
|
|
|
- (C) 2008 by the GRASS Development Team
|
|
|
-
|
|
|
- This program is free software under the GNU General Public
|
|
|
- License (>=v2). Read the file COPYING that comes with GRASS
|
|
|
- for details.
|
|
|
-
|
|
|
- \author Martin Landa <landa.martin gmail.com> (Google SoC 2008)
|
|
|
-
|
|
|
- \date 2008
|
|
|
- */
|
|
|
+ \file args.c
|
|
|
+
|
|
|
+ \brief Parse command
|
|
|
+
|
|
|
+ (C) 2008, 2010 by the GRASS Development Team
|
|
|
+
|
|
|
+ This program is free software under the GNU General Public
|
|
|
+ License (>=v2). Read the file COPYING that comes with GRASS
|
|
|
+ for details.
|
|
|
+
|
|
|
+ \author Martin Landa <landa.martin gmail.com> (Google SoC 2008/2010)
|
|
|
+*/
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
#include <string.h>
|
|
@@ -33,21 +31,22 @@ static void args_viewpoint(struct GParams *);
|
|
|
static void args_volume(struct GParams *);
|
|
|
|
|
|
/*!
|
|
|
- \brief Parse command
|
|
|
-
|
|
|
- \param argc number of arguments
|
|
|
- \param argv arguments array
|
|
|
- \param params GRASS parameters
|
|
|
-
|
|
|
- \return 1
|
|
|
- */
|
|
|
+ \brief Parse command
|
|
|
+
|
|
|
+ \param argc number of arguments
|
|
|
+ \param argv arguments array
|
|
|
+ \param params GRASS parameters
|
|
|
+
|
|
|
+ \return 1
|
|
|
+*/
|
|
|
void parse_command(int argc, char *argv[], struct GParams *params)
|
|
|
{
|
|
|
params->mode_all = G_define_flag();
|
|
|
params->mode_all->key = 'a';
|
|
|
params->mode_all->description =
|
|
|
_("Use draw mode for all loaded surfaces");
|
|
|
-
|
|
|
+ params->mode_all->guisection = _("Surfaces");
|
|
|
+
|
|
|
/*** surface attributes ***/
|
|
|
args_surface(params);
|
|
|
|
|
@@ -71,7 +70,7 @@ void parse_command(int argc, char *argv[], struct GParams *params)
|
|
|
/* output */
|
|
|
params->output = G_define_standard_option(G_OPT_F_OUTPUT);
|
|
|
params->output->description =
|
|
|
- _("Name for output file (do not add extension)");
|
|
|
+ _("Name for output file (without extension)");
|
|
|
params->output->guisection = _("Image");
|
|
|
|
|
|
/* format */
|
|
@@ -112,7 +111,7 @@ void args_surface(struct GParams *params)
|
|
|
params->elev_map->required = NO;
|
|
|
params->elev_map->multiple = YES;
|
|
|
params->elev_map->description = _("Name of raster map(s) for elevation");
|
|
|
- params->elev_map->guisection = _("Surface");
|
|
|
+ params->elev_map->guisection = _("Surfaces");
|
|
|
|
|
|
params->elev_const = G_define_option();
|
|
|
params->elev_const->key = "elevation_value";
|
|
@@ -121,20 +120,20 @@ void args_surface(struct GParams *params)
|
|
|
params->elev_const->required = NO;
|
|
|
params->elev_const->multiple = YES;
|
|
|
params->elev_const->description = _("Elevation value(s)");
|
|
|
- params->elev_const->guisection = _("Surface");
|
|
|
+ params->elev_const->guisection = _("Surfaces");
|
|
|
|
|
|
/* color */
|
|
|
params->color_map = G_define_standard_option(G_OPT_R_MAP);
|
|
|
params->color_map->multiple = YES;
|
|
|
params->color_map->required = NO;
|
|
|
params->color_map->description = _("Name of raster map(s) for color");
|
|
|
- params->color_map->guisection = _("Surface");
|
|
|
+ params->color_map->guisection = _("Surfaces");
|
|
|
params->color_map->key = "color_map";
|
|
|
|
|
|
params->color_const = G_define_standard_option(G_OPT_C_FG);
|
|
|
params->color_const->multiple = YES;
|
|
|
params->color_const->label = _("Color value(s)");
|
|
|
- params->color_const->guisection = _("Surface");
|
|
|
+ params->color_const->guisection = _("Surfaces");
|
|
|
params->color_const->key = "color_value";
|
|
|
params->color_const->answer = NULL;
|
|
|
|
|
@@ -143,7 +142,7 @@ void args_surface(struct GParams *params)
|
|
|
params->mask_map->multiple = YES;
|
|
|
params->mask_map->required = NO;
|
|
|
params->mask_map->description = _("Name of raster map(s) for mask");
|
|
|
- params->mask_map->guisection = _("Surface");
|
|
|
+ params->mask_map->guisection = _("Surfaces");
|
|
|
params->mask_map->key = "mask_map";
|
|
|
|
|
|
/* transparency */
|
|
@@ -152,7 +151,7 @@ void args_surface(struct GParams *params)
|
|
|
params->transp_map->required = NO;
|
|
|
params->transp_map->description =
|
|
|
_("Name of raster map(s) for transparency");
|
|
|
- params->transp_map->guisection = _("Surface");
|
|
|
+ params->transp_map->guisection = _("Surfaces");
|
|
|
params->transp_map->key = "transparency_map";
|
|
|
|
|
|
params->transp_const = G_define_option();
|
|
@@ -162,7 +161,7 @@ void args_surface(struct GParams *params)
|
|
|
params->transp_const->required = NO;
|
|
|
params->transp_const->multiple = YES;
|
|
|
params->transp_const->description = _("Transparency value(s)");
|
|
|
- params->transp_const->guisection = _("Surface");
|
|
|
+ params->transp_const->guisection = _("Surfaces");
|
|
|
params->transp_const->options = "0-255";
|
|
|
|
|
|
/* shininess */
|
|
@@ -170,7 +169,7 @@ void args_surface(struct GParams *params)
|
|
|
params->shine_map->multiple = YES;
|
|
|
params->shine_map->required = NO;
|
|
|
params->shine_map->description = _("Name of raster map(s) for shininess");
|
|
|
- params->shine_map->guisection = _("Surface");
|
|
|
+ params->shine_map->guisection = _("Surfaces");
|
|
|
params->shine_map->key = "shininess_map";
|
|
|
|
|
|
params->shine_const = G_define_option();
|
|
@@ -180,7 +179,7 @@ void args_surface(struct GParams *params)
|
|
|
params->shine_const->required = NO;
|
|
|
params->shine_const->multiple = YES;
|
|
|
params->shine_const->description = _("Shininess value(s)");
|
|
|
- params->shine_const->guisection = _("Surface");
|
|
|
+ params->shine_const->guisection = _("Surfaces");
|
|
|
params->shine_const->options = "0-255";
|
|
|
|
|
|
/* emission */
|
|
@@ -188,7 +187,7 @@ void args_surface(struct GParams *params)
|
|
|
params->emit_map->multiple = YES;
|
|
|
params->emit_map->required = NO;
|
|
|
params->emit_map->description = _("Name of raster map(s) for emission");
|
|
|
- params->emit_map->guisection = _("Surface");
|
|
|
+ params->emit_map->guisection = _("Surfaces");
|
|
|
params->emit_map->key = "emission_map";
|
|
|
|
|
|
params->emit_const = G_define_option();
|
|
@@ -198,7 +197,7 @@ void args_surface(struct GParams *params)
|
|
|
params->emit_const->required = NO;
|
|
|
params->emit_const->multiple = YES;
|
|
|
params->emit_const->description = _("Emission value(s)");
|
|
|
- params->emit_const->guisection = _("Surface");
|
|
|
+ params->emit_const->guisection = _("Surfaces");
|
|
|
params->emit_const->options = "0-255";
|
|
|
|
|
|
/*
|
|
@@ -209,7 +208,7 @@ void args_surface(struct GParams *params)
|
|
|
params->mode->key = "mode";
|
|
|
params->mode->key_desc = "string";
|
|
|
params->mode->type = TYPE_STRING;
|
|
|
- params->mode->required = YES;
|
|
|
+ params->mode->required = NO;
|
|
|
params->mode->multiple = YES;
|
|
|
params->mode->description = _("Draw mode");
|
|
|
params->mode->options = "coarse,fine,both";
|
|
@@ -221,7 +220,7 @@ void args_surface(struct GParams *params)
|
|
|
params->res_fine->key = "resolution_fine";
|
|
|
params->res_fine->key_desc = "value";
|
|
|
params->res_fine->type = TYPE_INTEGER;
|
|
|
- params->res_fine->required = YES;
|
|
|
+ params->res_fine->required = NO;
|
|
|
params->res_fine->multiple = YES;
|
|
|
params->res_fine->description = _("Fine resolution");
|
|
|
params->res_fine->answer = "6";
|
|
@@ -232,7 +231,7 @@ void args_surface(struct GParams *params)
|
|
|
params->res_coarse->key = "resolution_coarse";
|
|
|
params->res_coarse->key_desc = "value";
|
|
|
params->res_coarse->type = TYPE_INTEGER;
|
|
|
- params->res_coarse->required = YES;
|
|
|
+ params->res_coarse->required = NO;
|
|
|
params->res_coarse->multiple = YES;
|
|
|
params->res_coarse->description = _("Coarse resolution");
|
|
|
params->res_coarse->answer = "9";
|
|
@@ -243,7 +242,7 @@ void args_surface(struct GParams *params)
|
|
|
params->style->key = "style";
|
|
|
params->style->key_desc = "string";
|
|
|
params->style->type = TYPE_STRING;
|
|
|
- params->style->required = YES;
|
|
|
+ params->style->required = NO;
|
|
|
params->style->multiple = YES;
|
|
|
params->style->description = _("Draw style");
|
|
|
params->style->options = "wire,surface";
|
|
@@ -255,7 +254,7 @@ void args_surface(struct GParams *params)
|
|
|
params->shade->key = "shading";
|
|
|
params->shade->key_desc = "string";
|
|
|
params->shade->type = TYPE_STRING;
|
|
|
- params->shade->required = YES;
|
|
|
+ params->shade->required = NO;
|
|
|
params->shade->multiple = YES;
|
|
|
params->shade->description = _("Shading");
|
|
|
params->shade->options = "flat,gouraud";
|
|
@@ -265,7 +264,7 @@ void args_surface(struct GParams *params)
|
|
|
/* wire color */
|
|
|
params->wire_color = G_define_standard_option(G_OPT_C_FG);
|
|
|
params->wire_color->multiple = YES;
|
|
|
- params->wire_color->required = YES;
|
|
|
+ params->wire_color->required = NO;
|
|
|
params->wire_color->label = _("Wire color");
|
|
|
params->wire_color->key = "wire_color";
|
|
|
params->wire_color->answer = "136:136:136";
|
|
@@ -276,7 +275,7 @@ void args_surface(struct GParams *params)
|
|
|
params->shade->key = "shading";
|
|
|
params->shade->key_desc = "string";
|
|
|
params->shade->type = TYPE_STRING;
|
|
|
- params->shade->required = YES;
|
|
|
+ params->shade->required = NO;
|
|
|
params->shade->multiple = YES;
|
|
|
params->shade->description = _("Shading");
|
|
|
params->shade->options = "flat,gouraud";
|
|
@@ -288,7 +287,7 @@ void args_surface(struct GParams *params)
|
|
|
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->required = NO;
|
|
|
params->surface_pos->multiple = YES;
|
|
|
params->surface_pos->description = _("Position");
|
|
|
params->surface_pos->guisection = _("Draw");
|
|
@@ -332,7 +331,7 @@ void args_vline(struct GParams *params)
|
|
|
params->vline_mode->key = "vline_mode";
|
|
|
params->vline_mode->key_desc = "string";
|
|
|
params->vline_mode->type = TYPE_STRING;
|
|
|
- params->vline_mode->required = YES;
|
|
|
+ params->vline_mode->required = NO;
|
|
|
params->vline_mode->multiple = YES;
|
|
|
params->vline_mode->description = _("Vector line display mode");
|
|
|
params->vline_mode->options = "surface,flat";
|
|
@@ -356,7 +355,7 @@ void args_vline(struct GParams *params)
|
|
|
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->required = NO;
|
|
|
params->vline_pos->multiple = YES;
|
|
|
params->vline_pos->description = _("Position");
|
|
|
params->vline_pos->guisection = _("Vector lines");
|
|
@@ -412,7 +411,7 @@ void args_vpoint(struct GParams *params)
|
|
|
params->vpoint_marker->key = "vpoint_marker";
|
|
|
params->vpoint_marker->key_desc = "string";
|
|
|
params->vpoint_marker->type = TYPE_STRING;
|
|
|
- params->vpoint_marker->required = YES;
|
|
|
+ params->vpoint_marker->required = NO;
|
|
|
params->vpoint_marker->multiple = YES;
|
|
|
params->vpoint_marker->description = _("Icon marker");
|
|
|
params->vpoint_marker->options =
|
|
@@ -425,7 +424,7 @@ void args_vpoint(struct GParams *params)
|
|
|
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->required = NO;
|
|
|
params->vpoint_pos->multiple = YES;
|
|
|
params->vpoint_pos->description = _("Position");
|
|
|
params->vpoint_pos->guisection = _("Vector points");
|
|
@@ -498,7 +497,7 @@ void args_volume(struct GParams *params)
|
|
|
{
|
|
|
params->volume = G_define_standard_option(G_OPT_R3_MAPS);
|
|
|
params->volume->required = NO;
|
|
|
- params->volume->guisection = _("Volume");
|
|
|
+ params->volume->guisection = _("Volumes");
|
|
|
params->volume->key = "volume";
|
|
|
|
|
|
/* mode */
|
|
@@ -506,7 +505,7 @@ void args_volume(struct GParams *params)
|
|
|
params->volume_mode->key = "volume_mode";
|
|
|
params->volume_mode->key_desc = "string";
|
|
|
params->volume_mode->type = TYPE_STRING;
|
|
|
- params->volume_mode->required = YES;
|
|
|
+ params->volume_mode->required = NO;
|
|
|
params->volume_mode->multiple = YES;
|
|
|
params->volume_mode->description = _("Volume draw mode");
|
|
|
params->volume_mode->options = "isosurface,slice";
|
|
@@ -518,7 +517,7 @@ void args_volume(struct GParams *params)
|
|
|
params->volume_shade->key = "volume_shading";
|
|
|
params->volume_shade->key_desc = "string";
|
|
|
params->volume_shade->type = TYPE_STRING;
|
|
|
- params->volume_shade->required = YES;
|
|
|
+ params->volume_shade->required = NO;
|
|
|
params->volume_shade->multiple = YES;
|
|
|
params->volume_shade->description = _("Volume shading");
|
|
|
params->volume_shade->options = "flat,gouraud";
|
|
@@ -530,10 +529,10 @@ void args_volume(struct GParams *params)
|
|
|
params->volume_pos->key = "volume_position";
|
|
|
params->volume_pos->key_desc = "x,y,z";
|
|
|
params->volume_pos->type = TYPE_INTEGER;
|
|
|
- params->volume_pos->required = YES;
|
|
|
+ params->volume_pos->required = NO;
|
|
|
params->volume_pos->multiple = YES;
|
|
|
params->volume_pos->description = _("Volume position");
|
|
|
- params->volume_pos->guisection = _("Volume");
|
|
|
+ params->volume_pos->guisection = _("Volumes");
|
|
|
params->volume_pos->answer = "0,0,0";
|
|
|
|
|
|
/* resolution */
|
|
@@ -541,11 +540,11 @@ void args_volume(struct GParams *params)
|
|
|
params->volume_res->key = "volume_resolution";
|
|
|
params->volume_res->key_desc = "value";
|
|
|
params->volume_res->type = TYPE_INTEGER;
|
|
|
- params->volume_res->required = YES;
|
|
|
+ params->volume_res->required = NO;
|
|
|
params->volume_res->multiple = YES;
|
|
|
params->volume_res->description = _("Volume resolution");
|
|
|
params->volume_res->answer = "3";
|
|
|
- params->volume_res->guisection = _("Volume");
|
|
|
+ params->volume_res->guisection = _("Volumes");
|
|
|
|
|
|
/* isosurface level */
|
|
|
params->isosurf_level = G_define_option();
|
|
@@ -555,7 +554,7 @@ void args_volume(struct GParams *params)
|
|
|
params->isosurf_level->required = NO;
|
|
|
params->isosurf_level->multiple = YES;
|
|
|
params->isosurf_level->description = _("Isosurface level");
|
|
|
- params->isosurf_level->guisection = _("Volume");
|
|
|
+ params->isosurf_level->guisection = _("Volumes");
|
|
|
|
|
|
return;
|
|
|
}
|
|
@@ -583,9 +582,9 @@ int opt_get_num_answers(const struct Option *opt)
|
|
|
}
|
|
|
|
|
|
/*!
|
|
|
- \brief Check parameters consistency
|
|
|
-
|
|
|
- \param params module parameters
|
|
|
+ \brief Check parameters consistency
|
|
|
+
|
|
|
+ \param params module parameters
|
|
|
*/
|
|
|
void check_parameters(const struct GParams *params)
|
|
|
{
|