本文整理汇总了C++中G_add_keyword函数的典型用法代码示例。如果您正苦于以下问题:C++ G_add_keyword函数的具体用法?C++ G_add_keyword怎么用?C++ G_add_keyword使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_add_keyword函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int i;
int print_flag = 0;
int flat_flag;
int set_flag;
double x;
int ival;
int row_flag = 0, col_flag = 0;
struct Cell_head window, temp_window;
const char *value;
const char *name;
const char *mapset;
char **rast_ptr, **vect_ptr;
struct GModule *module;
struct
{
struct Flag
*update, *print, *gprint, *flprint, *lprint, *eprint, *nangle,
*center, *res_set, *dist_res, *dflt, *z, *savedefault,
*bbox, *gmt_style, *wms_style;
} flag;
struct
{
struct Option
*north, *south, *east, *west, *top, *bottom,
*res, *nsres, *ewres, *res3, *tbres, *rows, *cols,
*save, *region, *raster, *raster3d, *align,
*zoom, *vect;
} parm;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("general"));
G_add_keyword(_("settings"));
module->description =
_("Manages the boundary definitions for the " "geographic region.");
/* flags */
flag.dflt = G_define_flag();
flag.dflt->key = 'd';
flag.dflt->description = _("Set from default region");
flag.dflt->guisection = _("Existing");
flag.savedefault = G_define_flag();
flag.savedefault->key = 's';
flag.savedefault->label = _("Save as default region");
flag.savedefault->description = _("Only possible from the PERMANENT mapset");
flag.savedefault->guisection = _("Existing");
flag.print = G_define_flag();
flag.print->key = 'p';
flag.print->description = _("Print the current region");
flag.print->guisection = _("Print");
flag.lprint = G_define_flag();
flag.lprint->key = 'l';
flag.lprint->description = _("Print the current region in lat/long "
"using the current ellipsoid/datum");
flag.lprint->guisection = _("Print");
flag.eprint = G_define_flag();
flag.eprint->key = 'e';
flag.eprint->description = _("Print the current region extent");
flag.eprint->guisection = _("Print");
flag.center = G_define_flag();
flag.center->key = 'c';
flag.center->description =
_("Print the current region map center coordinates");
flag.center->guisection = _("Print");
flag.gmt_style = G_define_flag();
flag.gmt_style->key = 't';
flag.gmt_style->description =
_("Print the current region in GMT style");
flag.gmt_style->guisection = _("Print");
flag.wms_style = G_define_flag();
flag.wms_style->key = 'w';
flag.wms_style->description =
_("Print the current region in WMS style");
flag.wms_style->guisection = _("Print");
flag.dist_res = G_define_flag();
flag.dist_res->key = 'm';
flag.dist_res->description =
_("Print region resolution in meters (geodesic)");
flag.dist_res->guisection = _("Print");
flag.nangle = G_define_flag();
flag.nangle->key = 'n';
flag.nangle->label = _("Print the convergence angle (degrees CCW)");
flag.nangle->description =
_("The difference between the projection's grid north and true north, "
"measured at the center coordinates of the current region.");
flag.nangle->guisection = _("Print");
//.........这里部分代码省略.........
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:101,代码来源:main.c
示例2: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct Option *coord, *out_file, *min, *max, *mult;
struct Flag *flag;
int *int_buf;
struct Cell_head w;
struct History history;
int cellfile;
double east, north, pt[2], cur[2], row, col, fmult;
double fmin, fmax;
int binary;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("buffer"));
G_add_keyword(_("geometry"));
G_add_keyword(_("circle"));
module->description =
_("Creates a raster map containing concentric "
"rings around a given point.");
out_file = G_define_standard_option(G_OPT_R_OUTPUT);
coord = G_define_standard_option(G_OPT_M_COORDS);
coord->required = YES;
coord->description = _("The coordinate of the center (east,north)");
min = G_define_option();
min->key = "min";
min->type = TYPE_DOUBLE;
min->required = NO;
min->description = _("Minimum radius for ring/circle map (in meters)");
max = G_define_option();
max->key = "max";
max->type = TYPE_DOUBLE;
max->required = NO;
max->description = _("Maximum radius for ring/circle map (in meters)");
mult = G_define_option();
mult->key = "multiplier";
mult->type = TYPE_DOUBLE;
mult->required = NO;
mult->description = _("Data value multiplier");
flag = G_define_flag();
flag->key = 'b';
flag->description = _("Generate binary raster map");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
G_scan_easting(coord->answers[0], &east, G_projection());
G_scan_northing(coord->answers[1], &north, G_projection());
pt[0] = east;
pt[1] = north;
fmult = 1.0;
if (min->answer)
sscanf(min->answer, "%lf", &fmin);
else
fmin = 0;
if (max->answer)
sscanf(max->answer, "%lf", &fmax);
else
fmax = HUGE_VAL;
if (fmin > fmax)
G_fatal_error(_("Please specify a radius in which min < max"));
if (mult->answer)
if (1 != sscanf(mult->answer, "%lf", &fmult))
fmult = 1.0;
/* nonsense test */
if (flag->answer && (!min->answer && !max->answer))
G_fatal_error(_("Please specify min and/or max radius when "
"using the binary flag"));
if (flag->answer)
binary = 1; /* generate binary pattern only, useful for MASK */
else
binary = 0;
G_get_set_window(&w);
cellfile = Rast_open_c_new(out_file->answer);
int_buf = (int *)G_malloc(w.cols * sizeof(int));
{
int c;
for (row = 0; row < w.rows; row++) {
G_percent(row, w.rows, 2);
//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:101,代码来源:main.c
示例3: main
int main(int argc, char **argv)
{
struct GModule *module;
struct Option *map_opt, *field_opt, *fs_opt, *vs_opt, *nv_opt, *col_opt,
*where_opt, *file_opt;
struct Flag *c_flag, *v_flag, *r_flag;
dbDriver *driver;
dbString sql, value_string;
dbCursor cursor;
dbTable *table;
dbColumn *column;
dbValue *value;
struct field_info *Fi;
int ncols, col, more;
struct Map_info Map;
char query[1024];
struct ilist *list_lines;
struct bound_box *min_box, *line_box;
int i, line, area, init_box, cat;
module = G_define_module();
G_add_keyword(_("vector"));
G_add_keyword(_("database"));
G_add_keyword(_("attribute table"));
module->description = _("Prints vector map attributes.");
map_opt = G_define_standard_option(G_OPT_V_MAP);
field_opt = G_define_standard_option(G_OPT_V_FIELD);
col_opt = G_define_standard_option(G_OPT_DB_COLUMNS);
where_opt = G_define_standard_option(G_OPT_DB_WHERE);
fs_opt = G_define_standard_option(G_OPT_F_SEP);
fs_opt->description = _("Output field separator");
fs_opt->guisection = _("Format");
vs_opt = G_define_standard_option(G_OPT_F_SEP);
vs_opt->key = "vs";
vs_opt->description = _("Output vertical record separator");
vs_opt->answer = NULL;
vs_opt->guisection = _("Format");
nv_opt = G_define_option();
nv_opt->key = "nv";
nv_opt->type = TYPE_STRING;
nv_opt->required = NO;
nv_opt->description = _("Null value indicator");
nv_opt->guisection = _("Format");
file_opt = G_define_standard_option(G_OPT_F_OUTPUT);
file_opt->key = "file";
file_opt->required = NO;
file_opt->description =
_("Name for output file (if omitted or \"-\" output to stdout)");
r_flag = G_define_flag();
r_flag->key = 'r';
r_flag->description =
_("Print minimal region extent of selected vector features instead of attributes");
c_flag = G_define_flag();
c_flag->key = 'c';
c_flag->description = _("Do not include column names in output");
c_flag->guisection = _("Format");
v_flag = G_define_flag();
v_flag->key = 'v';
v_flag->description = _("Vertical output (instead of horizontal)");
v_flag->guisection = _("Format");
G_gisinit(argv[0]);
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
/* set input vector map name and mapset */
if (file_opt->answer && strcmp(file_opt->answer, "-") != 0) {
if (NULL == freopen(file_opt->answer, "w", stdout)) {
G_fatal_error(_("Unable to open file <%s> for writing"), file_opt->answer);
}
}
if (r_flag->answer) {
min_box = (struct bound_box *) G_malloc(sizeof(struct bound_box));
G_zero((void *)min_box, sizeof(struct bound_box));
line_box = (struct bound_box *) G_malloc(sizeof(struct bound_box));
list_lines = Vect_new_list();
}
else {
min_box = line_box = NULL;
list_lines = NULL;
}
db_init_string(&sql);
db_init_string(&value_string);
/* open input vector */
//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,代码来源:main.c
示例4: main
int main(int argc, char *argv[])
{
struct GModule *module;
int Out_proj;
int out_stat;
int old_zone, old_proj;
int i;
int stat;
char cmnd2[500];
char proj_out[20], proj_name[50], set_name[20];
char path[1024], buffa[1024], buffb[1024], answer[200], answer1[200];
char answer2[200], buff[1024];
char tmp_buff[20], *buf;
struct Key_Value *old_proj_keys, *out_proj_keys, *in_unit_keys;
double aa, e2;
double f;
FILE *FPROJ;
int exist = 0;
char spheroid[100];
int j, k, sph_check;
struct Cell_head cellhd;
char datum[100], dat_ellps[100], dat_params[100];
struct proj_parm *proj_parms;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("general"));
G_add_keyword(_("projection"));
module->description =
_("Interactively reset the location's projection settings.");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
if (strcmp(G_mapset(), "PERMANENT") != 0)
G_fatal_error(_("You must be in the PERMANENT mapset to run g.setproj"));
/***
* no longer necessary, table is a static struct
* init_unit_table();
***/
sprintf(set_name, "PERMANENT");
G_file_name(path, "", PROJECTION_FILE, set_name);
/* get the output projection parameters, if existing */
/* Check for ownership here */
stat = G__mapset_permissions(set_name);
if (stat == 0) {
G_fatal_error(_("PERMANENT: permission denied"));
}
G_get_default_window(&cellhd);
if (-1 == G_set_window(&cellhd))
G_fatal_error(_("Current region cannot be set"));
if (G_get_set_window(&cellhd) == -1)
G_fatal_error(_("Retrieving and setting region failed"));
Out_proj = cellhd.proj;
old_zone = cellhd.zone;
old_proj = cellhd.proj;
if (access(path, 0) == 0) {
exist = 1;
FPROJ = fopen(path, "r");
old_proj_keys = G_fread_key_value(FPROJ);
fclose(FPROJ);
buf = G_find_key_value("name", old_proj_keys);
fprintf(stderr,
"\nWARNING: A projection file already exists for this location\n(Filename '%s')\n",
path);
fprintf(stderr,
"\nThis file contains all the parameters for the location's projection:\n %s\n",
buf);
fprintf(stderr,
"\n Overriding this information implies that the old projection parameters\n"
" were incorrect. If you change the parameters, all existing data will\n"
" be interpreted differently by the projection software.\n%c%c%c",
7, 7, 7);
fprintf(stderr,
" GRASS will not re-project your data automatically.\n\n");
if (!G_yes
(_("Would you still like to change some of the parameters?"),
0)) {
G_message(_("The projection information will not be updated"));
leave(SP_NOCHANGE);
}
}
out_proj_keys = G_create_key_value();
if (exist) {
buf = G_find_key_value("zone", old_proj_keys);
if (buf != NULL)
sscanf(buf, "%d", &zone);
if (zone != old_zone) {
G_warning(_("Zone in default geographic region definition: %d\n"
" is different from zone in PROJ_INFO file: %d"),
//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,代码来源:main.c
示例5: main
int main(int argc, char **argv)
{
struct Cell_head window;
struct Categories cats;
struct GModule *module;
struct Option *opt1, *opt2, *opt3;
struct Flag *fancy_mode, *simple_mode, *draw;
char *tmpfile;
FILE *fp;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("display"));
G_add_keyword(_("cartography"));
module->description =
_("Create a TITLE for a raster map in a form suitable "
"for display with d.text.");
opt1 = G_define_standard_option(G_OPT_R_MAP);
opt2 = G_define_option();
opt2->key = "color";
opt2->type = TYPE_STRING;
opt2->answer = DEFAULT_FG_COLOR;
opt2->required = NO;
opt2->gisprompt = "old_color,color,color";
opt2->description = _("Sets the text color");
opt3 = G_define_option();
opt3->key = "size";
opt3->type = TYPE_DOUBLE;
opt3->answer = "4.0";
opt3->options = "0-100";
opt3->description =
_("Sets the text size as percentage of the frame's height");
draw = G_define_flag();
draw->key = 'd';
draw->description = _("Draw title on current display");
fancy_mode = G_define_flag();
fancy_mode->key = 'f';
fancy_mode->description = _("Do a fancier title");
/* currently just title, but it doesn't have to be /that/ simple */
simple_mode = G_define_flag();
simple_mode->key = 's';
simple_mode->description = _("Do a simple title");
/* Check command line */
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
map_name = opt1->answer;
color = opt2->answer;
if (opt3->answer != NULL)
sscanf(opt3->answer, "%f", &size);
type = fancy_mode->answer ? FANCY : NORMAL;
if (fancy_mode->answer && simple_mode->answer)
G_fatal_error(_("Title can be fancy or simple, not both"));
if (!strlen(map_name))
G_fatal_error(_("No map name given"));
Rast_get_cellhd(map_name, "", &window);
if (Rast_read_cats(map_name, "", &cats) == -1)
G_fatal_error(_("Unable to read category file of raster map <%s>"),
map_name);
if (draw->answer) {
tmpfile = G_convert_dirseps_to_host(G_tempfile());
if (!(fp = fopen(tmpfile, "w")))
G_fatal_error(_("Unable to open temporary file <%s>"), tmpfile);
}
else
fp = stdout;
if (type == NORMAL)
normal(&window, &cats, simple_mode->answer, fp);
else
fancy(&window, &cats, fp);
if (draw->answer) {
char inarg[GPATH_MAX];
fclose(fp);
sprintf(inarg, "input=%s", tmpfile);
G_spawn("d.text", "d.text", inarg, NULL);
unlink(tmpfile);
//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,代码来源:main.c
示例6: main
int main(int argc, char *argv[])
{
struct Map_info In, Out;
static struct line_pnts *Points;
struct line_cats *Cats;
struct GModule *module; /* GRASS module for parsing arguments */
struct Option *map_in, *map_out;
struct Option *method_opt, *afield_opt, *nfield_opt, *abcol,
*afcol, *ncol;
struct Flag *add_f;
int with_z;
int afield, nfield, mask_type;
dglGraph_s *graph;
int *component, nnodes, type, i, nlines, components, max_cat;
char buf[2000], *covered;
char *desc;
/* Attribute table */
dbString sql;
dbDriver *driver;
struct field_info *Fi;
/* initialize GIS environment */
G_gisinit(argv[0]); /* reads grass env, stores program name to G_program_name() */
/* initialize module */
module = G_define_module();
G_add_keyword(_("vector"));
G_add_keyword(_("network"));
G_add_keyword(_("components"));
module->description =
_("Computes strongly and weakly connected components in the network.");
/* Define the different options as defined in gis.h */
map_in = G_define_standard_option(G_OPT_V_INPUT);
afield_opt = G_define_standard_option(G_OPT_V_FIELD);
afield_opt->key = "arc_layer";
afield_opt->answer = "1";
afield_opt->label = _("Arc layer");
afield_opt->guisection = _("Cost");
nfield_opt = G_define_standard_option(G_OPT_V_FIELD);
nfield_opt->key = "node_layer";
nfield_opt->answer = "2";
nfield_opt->label = _("Node layer");
nfield_opt->guisection = _("Cost");
afcol = G_define_standard_option(G_OPT_DB_COLUMN);
afcol->key = "arc_column";
afcol->required = NO;
afcol->description =
_("Arc forward/both direction(s) cost column (number)");
afcol->guisection = _("Cost");
abcol = G_define_standard_option(G_OPT_DB_COLUMN);
abcol->key = "arc_backward_column";
abcol->required = NO;
abcol->description = _("Arc backward direction cost column (number)");
abcol->guisection = _("Cost");
ncol = G_define_option();
ncol->key = "node_column";
ncol->type = TYPE_STRING;
ncol->required = NO;
ncol->description = _("Node cost column (number)");
ncol->guisection = _("Cost");
map_out = G_define_standard_option(G_OPT_V_OUTPUT);
method_opt = G_define_option();
method_opt->key = "method";
method_opt->type = TYPE_STRING;
method_opt->required = YES;
method_opt->multiple = NO;
method_opt->options = "weak,strong";
desc = NULL;
G_asprintf(&desc,
"weak;%s;strong;%s",
_("Weakly connected components"),
_("Strongly connected components"));
method_opt->descriptions = desc;
method_opt->description = _("Type of components");
add_f = G_define_flag();
add_f->key = 'a';
add_f->description = _("Add points on nodes");
/* options and flags parser */
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
/* TODO: make an option for this */
mask_type = GV_LINE | GV_BOUNDARY;
Points = Vect_new_line_struct();
Cats = Vect_new_cats_struct();
Vect_check_input_output_name(map_in->answer, map_out->answer,
G_FATAL_EXIT);
//.........这里部分代码省略.........
开发者ID:rkrug,项目名称:grass-ci,代码行数:101,代码来源:main.c
示例7: main
int main(int argc, char **argv)
{
struct band B[3];
int row;
int next_row;
int overlay;
struct Cell_head window;
struct GModule *module;
struct Flag *flag_n;
int i;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("display"));
G_add_keyword(_("graphics"));
G_add_keyword(_("raster"));
G_add_keyword("RGB");
module->description =
_("Displays three user-specified raster maps "
"as red, green, and blue overlays in the active graphics frame.");
flag_n = G_define_flag();
flag_n->key = 'n';
flag_n->description = _("Make null cells opaque");
flag_n->guisection = _("Null cells");
for (i = 0; i < 3; i++) {
char buff[80];
sprintf(buff, _("Name of raster map to be used for <%s>"),
color_names[i]);
B[i].opt = G_define_standard_option(G_OPT_R_MAP);
B[i].opt->key = G_store(color_names[i]);
B[i].opt->description = G_store(buff);
}
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
/* Do screen initializing stuff */
D_open_driver();
overlay = !flag_n->answer;
D_setup(0);
D_set_overlay_mode(overlay);
for (i = 0; i < 3; i++) {
/* Get name of layer to be used */
char *name = B[i].opt->answer;
/* Make sure map is available */
B[i].file = Rast_open_old(name, "");
B[i].type = Rast_get_map_type(B[i].file);
/* Reading color lookup table */
if (Rast_read_colors(name, "", &B[i].colors) == -1)
G_fatal_error(_("Color file for <%s> not available"), name);
B[i].array = Rast_allocate_buf(B[i].type);
}
/* read in current window */
G_get_window(&window);
D_raster_draw_begin();
next_row = 0;
for (row = 0; row < window.rows;) {
G_percent(row, window.rows, 5);
for (i = 0; i < 3; i++)
Rast_get_row(B[i].file, B[i].array, row, B[i].type);
if (row == next_row)
next_row = D_draw_raster_RGB(next_row,
B[0].array, B[1].array, B[2].array,
&B[0].colors, &B[1].colors,
&B[2].colors, B[0].type, B[1].type,
B[2].type);
else if (next_row > 0)
row = next_row;
else
break;
}
G_percent(window.rows, window.rows, 5);
D_raster_draw_end();
D_save_command(G_recreate_command());
D_close_driver();
/* Close the raster maps */
for (i = 0; i < 3; i++)
Rast_close(B[i].file);
exit(EXIT_SUCCESS);
}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:100,代码来源:main.c
示例8: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct GParams *params;
int i, ret;
int red, grn, blu;
float size;
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;
/* initialize GRASS */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("visualization"));
G_add_keyword(_("graphics"));
G_add_keyword(_("raster"));
G_add_keyword(_("vector"));
G_add_keyword(_("raster3d"));
module->label = _("Creates a 3D rendering of GIS data.");
module->description = _("Renders surfaces (raster data), "
"2D/3D vector data, and "
"volumes (3D raster data) in 3D.");
params = (struct GParams *)G_malloc(sizeof(struct GParams));
/* define options, call G_parser() */
parse_command(argc, argv, params);
/* check parameters consistency */
check_parameters(params);
width = atoi(params->size->answers[0]);
height = atoi(params->size->answers[1]);
G_asprintf(&output_name, "%s.%s", params->output->answer,
params->format->answer);
GS_libinit();
GVL_libinit();
GS_set_swap_func(swap_gl);
/* define render window */
offscreen = Nviz_new_render_window();
Nviz_init_render_window(offscreen);
if (Nviz_create_render_window(offscreen, NULL, width, height) == -1)
G_fatal_error(_("Unable to render data"));
Nviz_make_current_render_window(offscreen);
/* initialize nviz data */
Nviz_init_data(&data);
/* define default attributes for map objects */
Nviz_set_surface_attr_default();
/* set background color */
Nviz_set_bgcolor(&data, Nviz_color_from_str(params->bgcolor->answer));
/* init view, lights */
Nviz_init_view(&data);
/* load raster maps (surface topography) & set attributes (map/constant) */
load_rasters(params, &data);
/* set draw mode of loaded surfaces */
surface_set_draw_mode(params);
/* load line vector maps */
if (params->vlines->answer) {
load_vlines(params, &data);
/* set attributes of 2d lines */
vlines_set_attrb(params);
}
/* load point vector maps */
if (params->vpoints->answer) {
load_vpoints(params, &data);
/* set attributes for points */
vpoints_set_attrb(params);
}
/* load volumes */
if (params->volume->answer) {
load_rasters3d(params, &data);
}
/* define isosurfaces for displaying volumes */
if (params->isosurf_level->answer) {
add_isosurfs(params, &data);
}
/* define slices for displaying volumes */
if (params->slice->answer) {
add_slices(params, &data);
}
//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:101,代码来源:main.c
示例9: main
int main(int argc, char *argv[])
{
/* variables */
DCELL *data_buf;
CELL *clump_buf;
CELL i, max;
int row, col, rows, cols;
int out_mode, use_MASK, *n, *e;
long int *count;
int fd_data, fd_clump;
const char *datamap, *clumpmap, *centroidsmap;
double avg, vol, total_vol, east, north, *sum;
struct Cell_head window;
struct Map_info *fd_centroids;
struct line_pnts *Points;
struct line_cats *Cats;
struct field_info *Fi;
char buf[DB_SQL_MAX];
dbString sql;
dbDriver *driver;
struct GModule *module;
struct {
struct Option *input, *clump, *centroids, *output;
} opt;
struct {
struct Flag *report;
} flag;
/* define parameters and flags */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("volume"));
G_add_keyword(_("clumps"));
module->label =
_("Calculates the volume of data \"clumps\".");
module->description = _("Optionally produces a GRASS vector points map "
"containing the calculated centroids of these clumps.");
opt.input = G_define_standard_option(G_OPT_R_INPUT);
opt.input->description =
_("Name of input raster map representing data that will be summed within clumps");
opt.clump = G_define_standard_option(G_OPT_R_INPUT);
opt.clump->key = "clump";
opt.clump->required = NO;
opt.clump->label =
_("Name of input clump raster map");
opt.clump->description = _("Preferably the output of r.clump. "
"If no clump map is given than MASK is used.");
opt.centroids = G_define_standard_option(G_OPT_V_OUTPUT);
opt.centroids->key = "centroids";
opt.centroids->required = NO;
opt.centroids->description = _("Name for output vector points map to contain clump centroids");
opt.output = G_define_standard_option(G_OPT_F_OUTPUT);
opt.output->required = NO;
opt.output->label =
_("Name for output file to hold the report");
opt.output->description =
_("If no output file given report is printed to standard output");
flag.report = G_define_flag();
flag.report->key = 'f';
flag.report->description = _("Generate unformatted report (items separated by colon)");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
/* get arguments */
datamap = opt.input->answer;
clumpmap = NULL;
if (opt.clump->answer)
clumpmap = opt.clump->answer;
centroidsmap = NULL;
fd_centroids = NULL;
Points = NULL;
Cats = NULL;
driver = NULL;
if (opt.centroids->answer) {
centroidsmap = opt.centroids->answer;
fd_centroids = G_malloc(sizeof(struct Map_info));
}
out_mode = (!flag.report->answer);
/*
* see if MASK or a separate "clumpmap" raster map is to be used
* -- it must(!) be one of those two choices.
//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:101,代码来源:main.c
示例10: main
/* ************************************************************************* */
int main(int argc, char *argv[])
{
struct GModule *module = NULL;
N_solute_transport_data2d *data = NULL;
N_geom_data *geom = NULL;
N_les *les = NULL;
N_les_callback_2d *call = NULL;
struct Cell_head region;
double error, sor;
char *solver;
int x, y, stat, i, maxit = 1;
double loops = 1;
N_array_2d *xcomp = NULL;
N_array_2d *ycomp = NULL;
N_array_2d *hc_x = NULL;
N_array_2d *hc_y = NULL;
N_array_2d *phead = NULL;
double time_step, cfl, length, time_loops, time_sum;
/* Initialize GRASS */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("hydrology"));
G_add_keyword(_("solute transport"));
module->description =
_("Numerical calculation program for transient, confined and unconfined "
"solute transport in two dimensions");
/* Get parameters from user */
set_params();
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
/* Make sure that the current projection is not lat/long */
if ((G_projection() == PROJECTION_LL))
G_fatal_error(_("Lat/Long location is not supported by %s. Please reproject map first."),
G_program_name());
/*Set the maximum iterations */
sscanf(param.maxit->answer, "%i", &(maxit));
/*Set the calculation error break criteria */
sscanf(param.error->answer, "%lf", &(error));
sscanf(param.sor->answer, "%lf", &(sor));
/*number of loops*/
sscanf(param.loops->answer, "%lf", &(loops));
/*Set the solver */
solver = param.solver->answer;
if (strcmp(solver, G_MATH_SOLVER_DIRECT_LU) == 0 && !param.full_les->answer)
G_fatal_error(_("The direct LU solver do not work with sparse matrices"));
if (strcmp(solver, G_MATH_SOLVER_DIRECT_GAUSS) == 0 && !param.full_les->answer)
G_fatal_error(_("The direct Gauss solver do not work with sparse matrices"));
/*get the current region */
G_get_set_window(®ion);
/*allocate the geometry structure for geometry and area calculation */
geom = N_init_geom_data_2d(®ion, geom);
/*Set the function callback to the groundwater flow function */
call = N_alloc_les_callback_2d();
N_set_les_callback_2d_func(call, (*N_callback_solute_transport_2d)); /*solute_transport 2d */
/*Allocate the groundwater flow data structure */
data = N_alloc_solute_transport_data2d(geom->cols, geom->rows);
/*Set the stabilizing scheme*/
if (strncmp("full", param.stab->answer, 4) == 0) {
data->stab = N_UPWIND_FULL;
}
if (strncmp("exp", param.stab->answer, 3) == 0) {
data->stab = N_UPWIND_EXP;
}
/*the dispersivity lengths*/
sscanf(param.al->answer, "%lf", &(data->al));
sscanf(param.at->answer, "%lf", &(data->at));
/*Set the calculation time */
sscanf(param.dt->answer, "%lf", &(data->dt));
/*read all input maps into the memory and take care of the
* null values.*/
N_read_rast_to_array_2d(param.c->answer, data->c);
N_convert_array_2d_null_to_zero(data->c);
N_read_rast_to_array_2d(param.c->answer, data->c_start);
N_convert_array_2d_null_to_zero(data->c_start);
N_read_rast_to_array_2d(param.status->answer, data->status);
N_convert_array_2d_null_to_zero(data->status);
N_read_rast_to_array_2d(param.diff_x->answer, data->diff_x);
N_convert_array_2d_null_to_zero(data->diff_x);
N_read_rast_to_array_2d(param.diff_y->answer, data->diff_y);
N_convert_array_2d_null_to_zero(data->diff_y);
N_read_rast_to_array_2d(param.q->answer, data->q);
//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,代码来源:main.c
示例11: main
/*----------------------------------------------------------------------------------------------------------*/
int main(int argc, char *argv[])
{
/* Declarations */
int dim_vect, nparameters, BW, npoints;
int nsply, nsplx, nsplx_adj, nsply_adj;
int nsubregion_col, nsubregion_row;
int subregion = 0, nsubregions = 0;
const char *dvr, *db, *mapset;
char table_name[GNAME_MAX];
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
double lambda, mean, stepN, stepE, HighThresh,
LowThresh;
double N_extension, E_extension, edgeE, edgeN;
int i, nterrain, count_terrain;
int last_row, last_column, flag_auxiliar = FALSE;
int *lineVect;
double *TN, *Q, *parVect; /* Interpolating and least-square vectors */
double **N, **obsVect, **obsVect_all; /* Interpolation and least-square matrix */
struct Map_info In, Out, Terrain;
struct Option *in_opt, *out_opt, *out_terrain_opt, *stepE_opt,
*stepN_opt, *lambda_f_opt, *Thresh_A_opt, *Thresh_B_opt;
struct Flag *spline_step_flag;
struct GModule *module;
struct Cell_head elaboration_reg, original_reg;
struct Reg_dimens dims;
struct bound_box general_box, overlap_box;
struct Point *observ;
struct lidar_cat *lcat;
dbDriver *driver;
/*----------------------------------------------------------------------------------------------------------*/
/* Options' declaration */
module = G_define_module();
G_add_keyword(_("vector"));
G_add_keyword(_("LIDAR"));
module->description =
_("Corrects the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.");
spline_step_flag = G_define_flag();
spline_step_flag->key = 'e';
spline_step_flag->label = _("Estimate point density and distance");
spline_step_flag->description =
_("Estimate point density and distance for the input vector points within the current region extends and quit");
in_opt = G_define_standard_option(G_OPT_V_INPUT);
in_opt->description =
_("Input observation vector map name (v.lidar.growing output)");
out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
out_opt->description = _("Output classified vector map name");
out_terrain_opt = G_define_option();
out_terrain_opt->key = "terrain";
out_terrain_opt->type = TYPE_STRING;
out_terrain_opt->key_desc = "name";
out_terrain_opt->required = YES;
out_terrain_opt->gisprompt = "new,vector,vector";
out_terrain_opt->description =
_("Only 'terrain' points output vector map");
stepE_opt = G_define_option();
stepE_opt->key = "ew_step";
stepE_opt->type = TYPE_DOUBLE;
stepE_opt->required = NO;
stepE_opt->answer = "25";
stepE_opt->description =
_("Length of each spline step in the east-west direction");
stepE_opt->guisection = _("Settings");
stepN_opt = G_define_option();
stepN_opt->key = "ns_step";
stepN_opt->type = TYPE_DOUBLE;
stepN_opt->required = NO;
stepN_opt->answer = "25";
stepN_opt->description =
_("Length of each spline step in the north-south direction");
stepN_opt->guisection = _("Settings");
lambda_f_opt = G_define_option();
lambda_f_opt->key = "lambda_c";
lambda_f_opt->type = TYPE_DOUBLE;
lambda_f_opt->required = NO;
lambda_f_opt->description =
_("Regularization weight in reclassification evaluation");
lambda_f_opt->answer = "1";
Thresh_A_opt = G_define_option();
Thresh_A_opt->key = "tch";
Thresh_A_opt->type = TYPE_DOUBLE;
Thresh_A_opt->required = NO;
Thresh_A_opt->description =
_("High threshold for object to terrain reclassification");
//.........这里部分代码省略.........
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:101,代码来源:main.c
示例12: main
int main(int argc, char *argv[])
{
int i, j, precision, field, type, nlines;
int do_attr = 0, attr_cols[8], attr_size = 0, db_open = 0, cnt = 0;
double width, radius;
struct Option *in_opt, *out_opt, *prec_opt, *type_opt, *attr_opt,
*field_opt;
struct GModule *module;
struct Map_info In;
struct bound_box box;
/* vector */
struct line_pnts *Points;
struct line_cats *Cats;
/* attribs */
dbDriver *Driver = NULL;
dbHandle handle;
dbTable *Table;
dbString dbstring;
struct field_info *Fi;
/* init */
G_gisinit(argv[0]);
/* parse command-line */
module = G_define_module();
module->description = _("Exports a vector map to SVG file.");
G_add_keyword(_("vector"));
G_add_keyword(_("export"));
in_opt = G_define_standard_option(G_OPT_V_INPUT);
field_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
out_opt = G_define_standard_option(G_OPT_F_OUTPUT);
out_opt->description = _("Name for SVG output file");
type_opt = G_define_option();
type_opt->key = "type";
type_opt->type = TYPE_STRING;
type_opt->required = YES;
type_opt->multiple = NO;
type_opt->answer = "poly";
type_opt->options = "poly,line,point";
type_opt->label = _("Output type");
type_opt->description = _("Defines which feature-type will be extracted");
prec_opt = G_define_option();
prec_opt->key = "precision";
prec_opt->type = TYPE_INTEGER;
prec_opt->required = NO;
prec_opt->answer = "6";
prec_opt->multiple = NO;
prec_opt->description = _("Coordinate precision");
attr_opt = G_define_standard_option(G_OPT_DB_COLUMNS);
attr_opt->key = "attribute";
attr_opt->required = NO;
attr_opt->multiple = YES;
attr_opt->description = _("Attribute(s) to include in output SVG");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
Points = Vect_new_line_struct();
Cats = Vect_new_cats_struct();
if (type_opt->answer[0] == 'l') {
type = TYPE_LINE;
}
else {
if (type_opt->answer[2] == 'l')
type = TYPE_POLY;
else
type = TYPE_POINT;
}
/* override coordinate precision if any */
precision = atof(prec_opt->answer);
if (precision < 0) {
G_fatal_error(_("Precision must not be negative"));
}
if (precision > 15) {
G_fatal_error(_("Precision must not be higher than 15"));
}
/* open input vector */
Vect_set_open_level(2);
if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
/* parse field number */
field = Vect_get_field_number(&In, field_opt->answer);
/* open db-driver to attribs */
db_init_string(&dbstring);
/* check for requested field */
//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:101,代码来源:main.c
示例13: main
int main(int argc, char **argv)
{
struct GModule *module;
struct Option *bg_color_opt, *fg_color_opt, *coords, *n_arrow, *fsize,
*width_opt, *rotation_opt, *lbl_opt, *text_color_opt;
struct Flag *no_text, *rotate_text, *rads;
double east, north;
double rotation;
double fontsize, line_width;
int rot_with_text;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("display"));
G_add_keyword(_("cartography"));
module->description =
_("Displays a north arrow on the graphics monitor.");
n_arrow = G_define_option();
n_arrow->key = "style";
n_arrow->description = _("North arrow style");
n_arrow->options =
"1a,1b,2,3,4,5,6,7a,7b,8a,8b,9,fancy_compass,basic_compass,arrow1,arrow2,arrow3,star";
G_asprintf((char **)&(n_arrow->descriptions),
"1a;%s;" "1b;%s;" "2;%s;" "3;%s;" "4;%s;" "5;%s;" "6;%s;"
"7a;%s;" "7b;%s;" "8a;%s;" "8b;%s;" "9;%s;" "fancy_compass;%s;"
"basic_compass;%s;" "arrow1;%s;" "arrow2;%s;" "arrow3;%s;"
"star;%s;",
_("Two color arrowhead"),
_("Two color arrowhead with circle"),
_("Narrow with blending N"), _("Long with small arrowhead"),
_("Inverted narrow inside a circle"),
_("Triangle and N inside a circle"),
_("Arrowhead and N inside a circle"),
_("Tall half convex arrowhead"),
_("Tall half concave arrowhead"), _("Thin arrow in a circle"),
_("Fat arrow in a circle"), _("One color arrowhead"),
_("Fancy compass"), _("Basic compass"), _("Simple arrow"),
_("Thin arrow"), _("Fat arrow"), _("4-point star"));
n_arrow->answer = "1a";
n_arrow->guisection = _("Style");
n_arrow->gisprompt = "old,northarrow,northarrow";
coords = G_define_option();
coords->key = "at";
coords->key_desc = "x,y";
coords->type = TYPE_DOUBLE;
coords->answer = "85.0,15.0";
coords->options = "0-100";
coords->label =
_("Screen coordinates of the rectangle's top-left corner");
coords->description = _("(0,0) is lower-left of the display frame");
rotation_opt = G_define_option();
rotation_opt->key = "rotation";
rotation_opt->type = TYPE_DOUBLE;
rotation_opt->required = NO;
rotation_opt->answer = "0";
rotation_opt->description =
_("Rotation angle in degrees (counter-clockwise)");
lbl_opt = G_define_option();
lbl_opt->key = "label";
lbl_opt->required = NO;
lbl_opt->answer = "N";
lbl_opt->description =
_("Displayed letter on the top of arrow");
lbl_opt->guisection = _("Text");
fg_color_opt = G_define_standard_option(G_OPT_CN);
fg_color_opt->label = _("Line color");
fg_color_opt->guisection = _("Colors");
bg_color_opt = G_define_standard_option(G_OPT_CN);
bg_color_opt->key = "fill_color";
bg_color_opt->label = _("Fill color");
bg_color_opt->guisection = _("Colors");
text_color_opt = G_define_standard_option(G_OPT_C);
text_color_opt->key = "text_color";
text_color_opt->label = _("Text color");
text_color_opt->answer = NULL;
text_color_opt->guisection = _("Colors");
width_opt = G_define_option();
width_opt->key = "width";
width_opt->type = TYPE_DOUBLE;
width_opt->answer = "0";
width_opt->description = _("Line width");
fsize = G_define_option();
fsize->key = "fontsize";
fsize->type = TYPE_DOUBLE;
fsize->required = NO;
fsize->answer = "14";
fsize->options = "1-360";
fsize->description = _("Font size");
fsize->guisection = _("Text");
//.........这里部分代码省略.........
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:101,代码来源:main.c
示例14: main
int main(int argc, char *argv[])
{
char *me;
char *output, *input;
char *fs;
int dims, i, has_cat;
struct GModule *module;
FILE *in_fd, *out_fd;
Site *site;
Site_head shead;
struct TimeStamp ts;
struct
{
struct Option *input, *output, *dims, *fs, *date;
} parm;
G_gisinit(me = argv[0]);
module = G_define_module();
G_add_keyword(_("sites"));
module->description =
"Convert an ASCII listing of site locations "
"into a GRASS site list file.";
parm.output = G_define_
|
请发表评论