这篇教程C++ G_define_option函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中G_define_option函数的典型用法代码示例。如果您正苦于以下问题:C++ G_define_option函数的具体用法?C++ G_define_option怎么用?C++ G_define_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了G_define_option函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: set_params/* ************************************************************************* */void set_params(void){ param.phead = G_define_standard_option(G_OPT_R_INPUT); param.phead->key = "phead"; param.phead->description = _("The initial piezometric head in [m]"); param.status = G_define_standard_option(G_OPT_R_INPUT); param.status->key = "status"; param.status->description = _("Boundary condition status, 0-inactive, 1-active, 2-dirichlet"); param.hc_x = G_define_standard_option(G_OPT_R_INPUT); param.hc_x->key = "hc_x"; param.hc_x->description = _("X-part of the hydraulic conductivity tensor in [m/s]"); param.hc_y = G_define_standard_option(G_OPT_R_INPUT); param.hc_y->key = "hc_y"; param.hc_y->description = _("Y-part of the hydraulic conductivity tensor in [m/s]"); param.q = G_define_standard_option(G_OPT_R_INPUT); param.q->key = "q"; param.q->required = NO; param.q->description = _("Water sources and sinks in [m^3/s]"); param.s = G_define_standard_option(G_OPT_R_INPUT); param.s->key = "s"; param.s->description = _("Specific yield in [1/m]"); param.r = G_define_standard_option(G_OPT_R_INPUT); param.r->key = "r"; param.r->required = NO; param.r->guisection = _("Recharge"); param.r->description = _("Recharge map e.g: 6*10^-9 per cell in [m^3/s*m^2]"); param.top = G_define_standard_option(G_OPT_R_INPUT); param.top->key = "top"; param.top->description = _("Top surface of the aquifer in [m]"); param.bottom = G_define_standard_option(G_OPT_R_INPUT); param.bottom->key = "bottom"; param.bottom->description = _("Bottom surface of the aquifer in [m]"); param.output = G_define_standard_option(G_OPT_R_OUTPUT); param.output->key = "output"; param.output->description = _("The map storing the numerical result [m]"); param.vector = G_define_standard_option(G_OPT_R_OUTPUT); param.vector->key = "velocity"; param.vector->required = NO; param.vector->description = _("Calculate the groundwater filter velocity vector field [m/s]/n" "and write the x, and y components to maps named name_[xy]"); param.type = G_define_option(); param.type->key = "type"; param.type->type = TYPE_STRING; param.type->required = NO; param.type->answer = "confined"; param.type->options = "confined,unconfined"; param.type->description = _("The type of groundwater flow"); /*Variants of the cauchy boundary condition */ param.river_bed = G_define_standard_option(G_OPT_R_INPUT); param.river_bed->key = "river_bed"; param.river_bed->guisection = "River"; param.river_bed->required = NO; param.river_bed->description = _("The height of the river bed in [m]"); param.river_head = G_define_standard_option(G_OPT_R_INPUT); param.river_head->key = "river_head"; param.river_head->guisection = "River"; param.river_head->required = NO; param.river_head->description = _("Water level (head) of the river with leakage connection in [m]"); param.river_leak = G_define_standard_option(G_OPT_R_INPUT); param.river_leak->key = "river_leak"; param.river_leak->guisection = "River"; param.river_leak->required = NO; param.river_leak->description = _("The leakage coefficient of the river bed in [1/s]."); param.drain_bed = G_define_standard_option(G_OPT_R_INPUT); param.drain_bed->key = "drain_bed";; param.drain_bed->guisection = "Drainage"; param.drain_bed->required = NO; param.drain_bed->description = _("The height of the drainage bed in [m]"); param.drain_leak = G_define_standard_option(G_OPT_R_INPUT); param.drain_leak->key = "drain_leak"; param.drain_leak->guisection = "Drainage"; param.drain_leak->required = NO; param.drain_leak->description = _("The leakage coefficient of the drainage bed in [1/s]"); param.dt = N_define_standard_option(N_OPT_CALC_TIME);//.........这里部分代码省略.........
开发者ID:imincik,项目名称:pkg-grass,代码行数:101,
示例2: mainint main(int argc, char *argv[]){ void *raster, *ptr; /* char *null_row; */ RASTER_MAP_TYPE out_type, map_type; char *outfile; char null_str[80]; char cell_buf[300]; int fd; int row, col; int nrows, ncols, dp; int do_stdout; FILE *fp; double cellsize; struct GModule *module; struct { struct Option *map; struct Option *output; struct Option *dp; struct Option *null; } parm; struct { struct Flag *noheader; struct Flag *singleline; struct Flag *ccenter; } flag; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("export")); module->description = _("Converts a raster map layer into an ESRI ARCGRID file."); /* Define the different options */ parm.map = G_define_standard_option(G_OPT_R_INPUT); parm.output = G_define_standard_option(G_OPT_R_OUTPUT); parm.output->gisprompt = "new_file,file,output"; parm.output->description = _("Name of an output ARC-GRID map (use out=- for stdout)"); parm.dp = G_define_option(); parm.dp->key = "dp"; parm.dp->type = TYPE_INTEGER; parm.dp->required = NO; parm.dp->answer = "8"; parm.dp->description = _("Number of decimal places"); flag.noheader = G_define_flag(); flag.noheader->key = 'h'; flag.noheader->description = _("Suppress printing of header information"); /* Added to optionally produce a single line output. -- emes -- 12.10.92 */ flag.singleline = G_define_flag(); flag.singleline->key = '1'; flag.singleline->description = _("List one entry per line instead of full row"); /* use cell center in header instead of cell corner */ flag.ccenter = G_define_flag(); flag.ccenter->key = 'c'; flag.ccenter->description = _("Use cell center reference in header instead of cell corner"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); sscanf(parm.dp->answer, "%d", &dp); if (dp > 20 || dp < 0) G_fatal_error("dp has to be from 0 to 20"); outfile = parm.output->answer; if ((strcmp("-", outfile)) == 0) do_stdout = 1; else do_stdout = 0; sprintf(null_str, "-9999"); fd = Rast_open_old(parm.map->answer, ""); map_type = Rast_get_map_type(fd); out_type = map_type; /* null_row = Rast_allocate_null_buf(); */ raster = Rast_allocate_buf(out_type); nrows = Rast_window_rows(); ncols = Rast_window_cols();//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,
示例3: mainint main(int argc, char *argv[]){ int out_fd, base_raster; char *infile, *outmap; int percent; double zrange_min, zrange_max, d_tmp; double irange_min, irange_max; unsigned long estimated_lines; RASTER_MAP_TYPE rtype, base_raster_data_type; struct History history; char title[64]; SEGMENT base_segment; struct PointBinning point_binning; void *base_array; void *raster_row; struct Cell_head region; struct Cell_head input_region; int rows, last_rows, row0, cols; /* scan box size */ int row; /* counters */ int pass, npasses; unsigned long line, line_total; unsigned int counter; unsigned long n_invalid; char buff[BUFFSIZE]; double x, y, z; double intensity; int arr_row, arr_col; unsigned long count, count_total; int point_class; double zscale = 1.0; double iscale = 1.0; double res = 0.0; struct BinIndex bin_index_nodes; bin_index_nodes.num_nodes = 0; bin_index_nodes.max_nodes = 0; bin_index_nodes.nodes = 0; struct GModule *module; struct Option *input_opt, *output_opt, *percent_opt, *type_opt, *filter_opt, *class_opt; struct Option *method_opt, *base_raster_opt; struct Option *zrange_opt, *zscale_opt; struct Option *irange_opt, *iscale_opt; struct Option *trim_opt, *pth_opt, *res_opt; struct Option *file_list_opt; struct Flag *print_flag, *scan_flag, *shell_style, *over_flag, *extents_flag; struct Flag *intens_flag, *intens_import_flag; struct Flag *set_region_flag; struct Flag *base_rast_res_flag; struct Flag *only_valid_flag; /* LAS */ LASReaderH LAS_reader; LASHeaderH LAS_header; LASSRSH LAS_srs; LASPointH LAS_point; int return_filter; const char *projstr; struct Cell_head cellhd, loc_wind; unsigned int n_filtered; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("import")); G_add_keyword(_("LIDAR")); G_add_keyword(_("statistics")); G_add_keyword(_("conversion")); G_add_keyword(_("aggregation")); G_add_keyword(_("binning")); module->description = _("Creates a raster map from LAS LiDAR points using univariate statistics."); input_opt = G_define_standard_option(G_OPT_F_BIN_INPUT); input_opt->required = NO; input_opt->label = _("LAS input file"); input_opt->description = _("LiDAR input files in LAS format (*.las or *.laz)"); input_opt->guisection = _("Input"); output_opt = G_define_standard_option(G_OPT_R_OUTPUT); output_opt->required = NO; output_opt->guisection = _("Output"); file_list_opt = G_define_standard_option(G_OPT_F_INPUT); file_list_opt->key = "file"; file_list_opt->label = _("File containing names of LAS input files"); file_list_opt->description = _("LiDAR input files in LAS format (*.las or *.laz)"); file_list_opt->required = NO; file_list_opt->guisection = _("Input"); method_opt = G_define_option(); method_opt->key = "method"; method_opt->type = TYPE_STRING; method_opt->required = NO;//.........这里部分代码省略.........
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:101,
示例4: mainint main(int argc, char *argv[]){ struct GModule *module; struct Option *group_opt, *xc_opt, *yc_opt, *zc_opt, *xcsd_opt, *ycsd_opt, *zcsd_opt, *omega_opt, *phi_opt, *kappa_opt, *omegasd_opt, *phisd_opt, *kappasd_opt; struct Flag *use_flag, *print_flag; struct Ortho_Image_Group group; struct Ortho_Camera_Exp_Init *init_info; double deg2rad, rad2deg; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("imagery")); G_add_keyword(_("orthorectify")); module->description = _("Interactively creates or modifies entries in a camera " "initial exposure station file for imagery group referenced " "by a sub-block."); group_opt = G_define_standard_option(G_OPT_I_GROUP); group_opt->required = YES; group_opt->description = _("Name of imagery group for ortho-rectification"); xc_opt = G_define_option(); xc_opt->key = "xc"; xc_opt->type = TYPE_DOUBLE; xc_opt->description = _("Initial Camera Exposure X-coordinate"); yc_opt = G_define_option(); yc_opt->key = "yc"; yc_opt->type = TYPE_DOUBLE; yc_opt->description = _("Initial Camera Exposure Y-coordinate"); zc_opt = G_define_option(); zc_opt->key = "zc"; zc_opt->type = TYPE_DOUBLE; zc_opt->description = _("Initial Camera Exposure Z-coordinate"); xcsd_opt = G_define_option(); xcsd_opt->key = "xc_sd"; xcsd_opt->type = TYPE_DOUBLE; xcsd_opt->description = _("X-coordinate standard deviation"); ycsd_opt = G_define_option(); ycsd_opt->key = "yc_sd"; ycsd_opt->type = TYPE_DOUBLE; ycsd_opt->description = _("Y-coordinate standard deviation"); zcsd_opt = G_define_option(); zcsd_opt->key = "zc_sd"; zcsd_opt->type = TYPE_DOUBLE; zcsd_opt->description = _("Z-coordinate standard deviation"); omega_opt = G_define_option(); omega_opt->key = "omega"; omega_opt->type = TYPE_DOUBLE; omega_opt->description = _("Initial Camera Omega (roll) degrees"); phi_opt = G_define_option(); phi_opt->key = "omega"; phi_opt->type = TYPE_DOUBLE; phi_opt->description = _("Initial Camera Phi (pitch) degrees"); kappa_opt = G_define_option(); kappa_opt->key = "omega"; kappa_opt->type = TYPE_DOUBLE; kappa_opt->description = _("Initial Camera Kappa (yaw) degrees"); omegasd_opt = G_define_option(); omegasd_opt->key = "omega"; omegasd_opt->type = TYPE_DOUBLE; omegasd_opt->description = _("Omega (roll) standard deviation"); phisd_opt = G_define_option(); phisd_opt->key = "omega"; phisd_opt->type = TYPE_DOUBLE; phisd_opt->description = _("Phi (pitch) standard deviation"); kappasd_opt = G_define_option(); kappasd_opt->key = "omega"; kappasd_opt->type = TYPE_DOUBLE; kappasd_opt->description = _("Kappa (yaw) standard deviation"); use_flag = G_define_flag(); use_flag->key = 'r'; use_flag->description = _("Use initial values at run time"); print_flag = G_define_flag(); print_flag->key = 'p'; print_flag->description = _("Print initial values"); if (G_parser(argc, argv)) exit(EXIT_FAILURE);//.........这里部分代码省略.........
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:101,
示例5: user_inputvoid user_input(int argc, char **argv){ int i; /* setup the GRASS parsing routine structures to be used to read in the user's parameter choices */ struct Flag *units; struct Flag *zscore; struct Flag *edgemap; struct Option *name; struct Option *sampling_method; struct Option *region; struct Option *att; struct Option *diversity; struct Option *measure_code; struct Option *method_code; struct Option *juxtaposition; struct Option *edge; /* use the GRASS parsing routines to read in the user's parameter choices */ edgemap = G_define_flag(); edgemap->key = 'e'; edgemap->description = "Output map 'edge' of edges given a '1' in r.le.para/edge file"; units = G_define_flag(); units->key = 'u'; units->description = "Output maps 'units_x' with sampling units for each scale x "; zscore = G_define_flag(); zscore->key = 'z'; zscore->description = "Output map 'zscores' with standardized scores"; name = G_define_option(); name->key = "map"; name->description = "Raster map to be analyzed"; name->type = TYPE_STRING; name->gisprompt = "old,cell,raster"; name->required = YES; sampling_method = G_define_option(); sampling_method->answer = "w"; sampling_method->key = "sam"; sampling_method->description = "Sampling method (choose only 1 method):/n" "/tw = whole map u = units m = moving window r = regions"; sampling_method->type = TYPE_STRING; sampling_method->multiple = NO; sampling_method->required = NO; region = G_define_option(); region->key = "reg"; region->description = "Name of regions map, only when sam = r; omit otherwise"; region->type = TYPE_STRING; region->gisprompt = "old,cell,raster"; region->required = NO; att = G_define_option(); att->key = "att"; att->description = "b1 = mn. pixel att. b2 = s.d. pixel att./n" "/tb3 = min. pixel att. b4 = max. pixel att."; att->options = "b1,b2,b3,b4"; att->type = TYPE_STRING; att->multiple = YES; att->required = NO; diversity = G_define_option(); diversity->key = "div"; diversity->description = "d1 = richness d2 = Shannon d3 = dominance d4 = inv. Simpson"; diversity->options = "d1,d2,d3,d4"; diversity->type = TYPE_STRING; diversity->multiple = YES; diversity->required = NO; method_code = G_define_option(); method_code->key = "te1"; method_code->description = "Texture method (choose only 1 method):/n" "/tm1 = 2N-H m2 = 2N-45 m3 = 2N-V m4 = 2N-135/n" "/tm5 = 4N-HV m6 = 4N-DIAG m7 = 8N"; method_code->options = "m1,m2,m3,m4,m5,m6,m7"; method_code->type = TYPE_STRING; method_code->multiple = NO; method_code->required = NO; measure_code = G_define_option(); measure_code->key = "te2"; measure_code->description = "Texture measures (required if te1 was specified):/n" "/tt1 = contagion t2 = ang. sec. mom. t3 = inv. diff. mom./n" "/tt4 = entropy t5 = contrast"; measure_code->options = "t1,t2,t3,t4,t5"; measure_code->type = TYPE_STRING; measure_code->multiple = YES; measure_code->required = NO;//.........这里部分代码省略.........
开发者ID:imincik,项目名称:pkg-grass,代码行数:101,
示例6: parse_args/* ---------------------------------------------------------------------- */void parse_args(int argc, char *argv[]) { /* input elevation grid */ struct Option *input_elev; input_elev = G_define_standard_option(G_OPT_R_ELEV); /* output filled elevation grid */ struct Option *output_elev; output_elev = G_define_standard_option(G_OPT_R_OUTPUT); output_elev->key = "filled"; output_elev->description= _("Name for output filled (flooded) elevation raster map"); /* output direction grid */ struct Option *output_dir; output_dir = G_define_standard_option(G_OPT_R_OUTPUT); output_dir->key = "direction"; output_dir->description= _("Name for output flow direction raster map"); /* output sinkwatershed grid */ struct Option *output_watershed; output_watershed = G_define_standard_option(G_OPT_R_OUTPUT); output_watershed->key = "swatershed"; output_watershed->description= _("Name for output sink-watershed raster map"); /* output flow accumulation grid */ struct Option *output_accu; output_accu = G_define_standard_option(G_OPT_R_OUTPUT); output_accu->key = "accumulation"; output_accu->description= _("Name for output flow accumulation raster map");#ifdef OUTPUT_TCI struct Option *output_tci; output_tci = G_define_standard_option(G_OPT_R_OUTPUT); output_tci->key = "tci"; output_tci->description= _("Name for output topographic convergence index (tci) raster map");#endif /* MFD/SFD flag */ struct Flag *sfd_flag; sfd_flag = G_define_flag() ; sfd_flag->key = 's'; sfd_flag->description= _("SFD (D8) flow (default is MFD)"); /* D8CUT value*/ struct Option *d8cut; d8cut = G_define_option(); d8cut->key = "d8cut"; d8cut->type = TYPE_DOUBLE; d8cut->required = NO; d8cut->answer = G_store("infinity"); /* default value */ d8cut->label = _("Routing using SFD (D8) direction"); d8cut->description = _("If flow accumulation is larger than this value it is routed using " "SFD (D8) direction (meaningfull only for MFD flow)"); /* main memory */ struct Option *mem; mem = G_define_option() ; mem->key = "memory"; mem->type = TYPE_INTEGER; mem->required = NO; mem->answer = G_store("300"); /* 300MB default value */ mem->description = _("Maximum runtime memory size (in MB)"); /* temporary STREAM path */ struct Option *streamdir; streamdir = G_define_option() ; streamdir->key = "stream_dir"; streamdir->type = TYPE_STRING; streamdir->required = NO;#ifdef __MINGW32__ streamdir->answer = G_convert_dirseps_from_host(G_store(getenv("TEMP")));#else streamdir->answer = G_store("/var/tmp/");#endif streamdir->description= _("Directory to hold temporary files (they can be large)"); /* stats file */ struct Option *stats_opt; stats_opt = G_define_option() ; stats_opt->key = "stats"; stats_opt->type = TYPE_STRING; stats_opt->required = NO; stats_opt->description= _("Name of file containing runtime statistics"); stats_opt->answer = G_store("stats.out"); if (G_parser(argc, argv)) { exit (EXIT_FAILURE); } /* ************************* */ assert(opt); opt->elev_grid = input_elev->answer; opt->filled_grid = output_elev->answer; opt->dir_grid = output_dir->answer; //.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,
示例7: define_options/* Define the options and flags */static struct Options define_options(void){ struct Options opts; opts.iimg = G_define_standard_option(G_OPT_R_INPUT); opts.iscl = G_define_option(); opts.iscl->key = "range"; opts.iscl->type = TYPE_INTEGER; opts.iscl->key_desc = "min,max"; opts.iscl->required = NO; opts.iscl->answer = "0,255"; opts.iscl->description = _("Input range"); opts.iscl->guisection = _("Input"); opts.ialt = G_define_standard_option(G_OPT_R_ELEV); opts.ialt->required = NO; opts.ialt->description = _("Name of input elevation raster map (in m)"); opts.ialt->guisection = _("Input"); opts.ivis = G_define_standard_option(G_OPT_R_INPUT); opts.ivis->key = "visibility"; opts.ivis->required = NO; opts.ivis->description = _("Name of input visibility raster map (in km)"); opts.ivis->guisection = _("Input"); opts.icnd = G_define_standard_option(G_OPT_F_INPUT); opts.icnd->key = "parameters"; opts.icnd->required = YES; opts.icnd->description = _("Name of input text file with 6S parameters"); opts.oimg = G_define_standard_option(G_OPT_R_OUTPUT); opts.oscl = G_define_option(); opts.oscl->key = "rescale"; opts.oscl->type = TYPE_INTEGER; opts.oscl->key_desc = "min,max"; opts.oscl->answer = "0,255"; opts.oscl->required = NO; opts.oscl->description = _("Rescale output raster map"); opts.oscl->guisection = _("Output"); opts.oint = G_define_flag(); opts.oint->key = 'i'; opts.oint->description = _("Output raster map as integer"); opts.oint->guisection = _("Output"); opts.irad = G_define_flag(); opts.irad->key = 'r'; opts.irad->description = _("Input raster map converted to reflectance (default is radiance)"); opts.irad->guisection = _("Input"); opts.etmafter = G_define_flag(); opts.etmafter->key = 'a'; opts.etmafter->description = _("Input from ETM+ image taken after July 1, 2000"); opts.etmafter->guisection = _("Input"); opts.etmbefore = G_define_flag(); opts.etmbefore->key = 'b'; opts.etmbefore->description = _("Input from ETM+ image taken before July 1, 2000"); opts.etmbefore->guisection = _("Input"); return opts;}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:68,
示例8: mainint main(int argc, char **argv){ struct Cell_head window; RASTER_MAP_TYPE raster_type, mag_raster_type = -1; int layer_fd; void *raster_row, *ptr; int nrows, ncols; int aspect_c = -1; float aspect_f = -1.0; double scale; int skip, no_arrow; char *mag_map = NULL; void *mag_raster_row = NULL, *mag_ptr = NULL; double length = -1; int mag_fd = -1; struct FPRange range; double mag_min, mag_max; struct GModule *module; struct Option *opt1, *opt2, *opt3, *opt4, *opt5, *opt6, *opt7, *opt8, *opt9; struct Flag *align; double t, b, l, r; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("display")); G_add_keyword(_("map annotations")); G_add_keyword(_("raster")); module->description = _("Draws arrows representing cell aspect direction " "for a raster map containing aspect data."); opt1 = G_define_standard_option(G_OPT_R_MAP); opt1->description = _("Name of raster aspect map to be displayed"); opt2 = G_define_option(); opt2->key = "type"; opt2->type = TYPE_STRING; opt2->required = NO; opt2->answer = "grass"; opt2->options = "grass,compass,agnps,answers"; opt2->description = _("Type of existing raster aspect map"); opt3 = G_define_standard_option(G_OPT_C); opt3->key = "color"; opt3->answer = "green"; opt3->label = _("Color for drawing arrows"); opt3->guisection = _("Colors"); opt4 = G_define_standard_option(G_OPT_CN); opt4->key = "grid_color"; opt4->answer = "gray"; opt4->label = _("Color for drawing drawing grid"); opt4->guisection = _("Colors"); opt5 = G_define_standard_option(G_OPT_CN); opt5->key = "null_color"; opt5->answer = DEFAULT_FG_COLOR; opt5->label = _("Color for drawing null values (X symbol)"); opt5->guisection = _("Colors"); opt6 = G_define_standard_option(G_OPT_CN); opt6->key = "unknown_color"; opt6->answer = "red"; opt6->label = _("Color for showing unknown information (? symbol)"); opt6->guisection = _("Colors"); opt9 = G_define_option(); opt9->key = "skip"; opt9->type = TYPE_INTEGER; opt9->required = NO; opt9->answer = "1"; opt9->description = _("Draw arrow every Nth grid cell"); opt7 = G_define_option(); opt7->key = "magnitude_map"; opt7->type = TYPE_STRING; opt7->required = NO; opt7->multiple = NO; opt7->gisprompt = "old,cell,raster"; opt7->description = _("Raster map containing values used for arrow length"); opt8 = G_define_option(); opt8->key = "scale"; opt8->type = TYPE_DOUBLE; opt8->required = NO; opt8->answer = "1.0"; opt8->description = _("Scale factor for arrows (magnitude map)"); align = G_define_flag(); align->key = 'a'; align->description = _("Align grids with raster cells"); /* Check command line *///.........这里部分代码省略.........
开发者ID:imincik,项目名称:pkg-grass7,代码行数:101,
示例9: mainint main(int argc, char *argv[]){ struct GModule *module; struct { struct Option *input, *output, *zshift, *height, *elevation, *hcolumn, *type, *field, *cats, *where, *interp, *scale, *null; } opt; struct { struct Flag *trace; } flag; struct Map_info In, Out; struct line_pnts *Points; struct line_cats *Cats; struct bound_box map_box; struct cat_list *cat_list; struct Cell_head window; int field; int only_type, cat; int fdrast, interp_method, trace; double objheight, objheight_default, voffset; double scale, null_val; struct field_info *Fi; dbDriver *driver = NULL; char *comment; module = G_define_module(); G_add_keyword(_("vector")); G_add_keyword(_("geometry")); G_add_keyword(_("sampling")); G_add_keyword(_("3D")); module->label = _("Extrudes flat vector features to 3D vector features with defined height."); module->description = _("Optionally the height can be derived from sampling of elevation raster map."); flag.trace = G_define_flag(); flag.trace->key = 't'; flag.trace->description = _("Trace elevation"); flag.trace->guisection = _("Elevation"); opt.input = G_define_standard_option(G_OPT_V_INPUT); opt.field = G_define_standard_option(G_OPT_V_FIELD_ALL); opt.field->guisection = _("Selection"); opt.cats = G_define_standard_option(G_OPT_V_CATS); opt.cats->guisection = _("Selection"); opt.where = G_define_standard_option(G_OPT_DB_WHERE); opt.where->guisection = _("Selection"); opt.type = G_define_standard_option(G_OPT_V_TYPE); opt.type->answer = "point,line,area"; opt.type->options = "point,line,area"; opt.type->guisection = _("Selection"); opt.output = G_define_standard_option(G_OPT_V_OUTPUT); opt.zshift = G_define_option(); opt.zshift->key = "zshift"; opt.zshift->description = _("Shifting value for z coordinates"); opt.zshift->type = TYPE_DOUBLE; opt.zshift->required = NO; opt.zshift->answer = "0"; opt.zshift->guisection = _("Height"); opt.height = G_define_option(); opt.height->key = "height"; opt.height->type = TYPE_DOUBLE; opt.height->required = NO; opt.height->multiple = NO; opt.height->description = _("Fixed height for 3D vector features"); opt.height->guisection = _("Height"); opt.hcolumn = G_define_standard_option(G_OPT_DB_COLUMN); opt.hcolumn->key = "height_column"; opt.hcolumn->multiple = NO; opt.hcolumn->description = _("Name of attribute column with feature height"); opt.hcolumn->guisection = _("Height"); /* raster sampling */ opt.elevation = G_define_standard_option(G_OPT_R_ELEV); opt.elevation->required = NO; opt.elevation->description = _("Elevation raster map for height extraction"); opt.elevation->guisection = _("Elevation"); opt.interp = G_define_standard_option(G_OPT_R_INTERP_TYPE); opt.interp->answer = "nearest"; opt.interp->guisection = _("Elevation"); opt.scale = G_define_option(); opt.scale->key = "scale"; opt.scale->type = TYPE_DOUBLE; opt.scale->description = _("Scale factor sampled raster values");//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:101,
示例10: mainint main(int argc, char *argv[]){ short percent; double percentage; long targets; long count; struct rr_state myState; struct GModule *module; struct { struct Option *input, *cover, *raster, *sites, *npoints; } parm; struct { struct Flag *zero, *info, *z_geometry, *notopol_flag; } flag; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("sampling")); G_add_keyword(_("vector")); G_add_keyword(_("random")); module->description = _("Creates a raster map layer and vector point map " "containing randomly located points."); parm.input = G_define_standard_option(G_OPT_R_INPUT); parm.input->description = _("Name of input raster map"); parm.cover = G_define_standard_option(G_OPT_R_INPUT); parm.cover->key = "cover"; parm.cover->required = NO; parm.cover->description = _("Name of cover raster map"); parm.npoints = G_define_option(); parm.npoints->key = "npoints"; parm.npoints->key_desc = "number[%]"; parm.npoints->type = TYPE_STRING; parm.npoints->required = YES; parm.npoints->description = _("The number of points to allocate"); parm.raster = G_define_standard_option(G_OPT_R_OUTPUT); parm.raster->required = NO; parm.raster->key = "raster"; parm.sites = G_define_standard_option(G_OPT_V_OUTPUT); parm.sites->required = NO; parm.sites->key = "vector"; flag.zero = G_define_flag(); flag.zero->key = 'z'; flag.zero->description = _("Generate points also for NULL category"); flag.info = G_define_flag(); flag.info->key = 'i'; flag.info->description = _("Report information about input raster and exit"); flag.z_geometry = G_define_flag(); flag.z_geometry->key = 'd'; flag.z_geometry->description = _("Generate vector points as 3D points"); flag.notopol_flag = G_define_standard_flag(G_FLG_V_TOPO); flag.notopol_flag->description = _("Do not build topology in points mode"); flag.notopol_flag->guisection = _("Points"); if (G_parser(argc, argv) != 0) exit(EXIT_FAILURE); /* Set some state variables */ myState.use_nulls = flag.zero->answer; myState.inraster = parm.input->answer; if (parm.cover->answer) { myState.docover = TRUE; myState.inrcover = parm.cover->answer; } else { myState.docover = FALSE; myState.inrcover = NULL; } myState.outraster = parm.raster->answer; myState.outvector = parm.sites->answer; myState.z_geometry = flag.z_geometry->answer; myState.notopol = flag.notopol_flag->answer; /* If they only want info we ignore the rest */ get_stats(&myState); if (flag.info->answer) { G_message("Raster: %s/n" "Cover: %s/n" "Cell Count: %d/n" "Null Cells: %d/n/n", myState.inraster, myState.inrcover, (int)myState.nCells, (int)myState.nNulls); exit(EXIT_SUCCESS);//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:101,
示例11: mainint main(int argc, char *argv[]){ struct Cell_head cellhd; /*region+header info */ char *mapset; /*mapset name */ int nrows, ncols; int row, col; struct GModule *module; struct Option *input, *input1, *input2, *input3, *input4, *input5, *output; struct History history; /*metadata */ struct Colors colors; /*Color rules */ /************************************/ char *name, *name1, *name2; /*input raster name */ char *result; /*output raster name */ /*File Descriptors */ int nfiles, nfiles1, nfiles2; int infd[MAXFILES], infd1[MAXFILES], infd2[MAXFILES]; int outfd; /****************************************/ /* Pointers for file names */ char **names; char **ptr; char **names1; char **ptr1; char **names2; char **ptr2; /****************************************/ int DOYbeforeETa[MAXFILES], DOYafterETa[MAXFILES]; int bfr, aft; /****************************************/ int ok; int i = 0, j = 0; double etodoy; /*minimum ETo DOY */ double startperiod, endperiod; /*first and last days (DOYs) of the period studied */ void *inrast[MAXFILES], *inrast1[MAXFILES], *inrast2[MAXFILES]; DCELL *outrast; CELL val1, val2; RASTER_MAP_TYPE in_data_type[MAXFILES]; /* ETa */ RASTER_MAP_TYPE in_data_type1[MAXFILES]; /* DOY of ETa */ RASTER_MAP_TYPE in_data_type2[MAXFILES]; /* ETo */ RASTER_MAP_TYPE out_data_type = DCELL_TYPE; /************************************/ G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("imagery")); G_add_keyword(_("evapotranspiration")); module->description =_("Computes temporal integration of satellite " "ET actual (ETa) following the daily ET reference " "(ETo) from meteorological station(s)."); /* Define the different options */ input = G_define_standard_option(G_OPT_R_INPUTS); input->key = "eta"; input->description = _("Names of satellite ETa raster maps [mm/d or cm/d]"); input1 = G_define_standard_option(G_OPT_R_INPUTS); input1->key = "eta_doy"; input1->description = _("Names of satellite ETa Day of Year (DOY) raster maps [0-400] [-]"); input2 = G_define_standard_option(G_OPT_R_INPUTS); input2->key = "eto"; input2->description = _("Names of meteorological station ETo raster maps [0-400] [mm/d or cm/d]"); input3 = G_define_option(); input3->key = "eto_doy_min"; input3->type = TYPE_DOUBLE; input3->required = YES; input3->description = _("Value of DOY for ETo first day"); input4 = G_define_option(); input4->key = "start_period"; input4->type = TYPE_DOUBLE; input4->required = YES; input4->description = _("Value of DOY for the first day of the period studied"); input5 = G_define_option(); input5->key = "end_period"; input5->type = TYPE_DOUBLE; input5->required = YES; input5->description = _("Value of DOY for the last day of the period studied"); output = G_define_standard_option(G_OPT_R_OUTPUT); /* init nfiles */ nfiles = 1; nfiles1 = 1; nfiles2 = 1; /********************/ if (G_parser(argc, argv))//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,
示例12: mainint main(int argc, char **argv){ char name[128] = ""; struct Option *map; struct GModule *module; char *mapset; char buff[500]; /* must run in a term window */ G_putenv("GRASS_UI_TERM", "1"); /* Initialize the GIS calls */ G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("display")); G_add_keyword(_("raster")); module->description = "Allows the user to interactively change the color table " "of a raster map layer displayed on the graphics monitor."; map = G_define_option(); map->key = "map"; map->type = TYPE_STRING; if (*name) map->answer = name; if (*name) map->required = NO; else map->required = YES; map->gisprompt = "old,cell,raster"; map->description = "Name of raster map"; if (G_parser(argc, argv)) exit(1); /* Make sure map is available */ if (map->answer == NULL) exit(0); mapset = G_find_raster2(map->answer, ""); if (mapset == NULL) { char msg[256]; sprintf(msg, "Raster file [%s] not available", map->answer); G_fatal_error(msg); } if (Rast_map_is_fp(map->answer, mapset)) { sprintf(buff, "Raster file [%s] is floating point! /nd.colors only works with integer maps", map->answer); G_fatal_error(buff); } /* connect to the driver */ if (R_open_driver() != 0) G_fatal_error("No graphics device selected"); /* Read in the map region associated with graphics window */ D_setup(0); get_map_info(map->answer, mapset); R_close_driver(); exit(0);}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:66,
示例13: mainint main(int argc, char *argv[]){ int fd, maskfd; CELL *mask; DCELL *dcell; struct GModule *module; struct History history; int row, col; int searchrow, searchcolumn, pointsfound; int *shortlistrows = NULL, *shortlistcolumns = NULL; long ncells = 0; double north, east; double dist; double sum1, sum2, interp_value; int n; double p; struct { struct Option *input, *npoints, *power, *output, *dfield, *col; } parm; struct { struct Flag *noindex; } flag; struct cell_list { int row, column; struct cell_list *next; }; struct cell_list **search_list = NULL, **search_list_start = NULL; int max_radius, radius; int searchallpoints = 0; char *tmpstr1, *tmpstr2; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("vector")); G_add_keyword(_("surface")); G_add_keyword(_("interpolation")); G_add_keyword(_("IDW")); module->description = _("Provides surface interpolation from vector point data by Inverse " "Distance Squared Weighting."); parm.input = G_define_standard_option(G_OPT_V_INPUT); parm.dfield = G_define_standard_option(G_OPT_V_FIELD); parm.col = G_define_standard_option(G_OPT_DB_COLUMN); parm.col->required = NO; parm.col->label = _("Name of attribute column with values to interpolate"); parm.col->description = _("If not given and input is 2D vector map then category values are used. " "If input is 3D vector map then z-coordinates are used."); parm.col->guisection = _("Values"); parm.output = G_define_standard_option(G_OPT_R_OUTPUT); parm.npoints = G_define_option(); parm.npoints->key = "npoints"; parm.npoints->key_desc = "count"; parm.npoints->type = TYPE_INTEGER; parm.npoints->required = NO; parm.npoints->description = _("Number of interpolation points"); parm.npoints->answer = "12"; parm.npoints->guisection = _("Settings"); parm.power = G_define_option(); parm.power->key = "power"; parm.power->type = TYPE_DOUBLE; parm.power->answer = "2.0"; parm.power->label = _("Power parameter"); parm.power->description = _("Greater values assign greater influence to closer points"); parm.power->guisection = _("Settings"); flag.noindex = G_define_flag(); flag.noindex->key = 'n'; flag.noindex->label = _("Don't index points by raster cell"); flag.noindex->description = _("Slower but uses" " less memory and includes points from outside region" " in the interpolation"); flag.noindex->guisection = _("Settings"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); if (sscanf(parm.npoints->answer, "%d", &search_points) != 1 || search_points < 1) G_fatal_error(_("Illegal number (%s) of interpolation points"), parm.npoints->answer); list = (struct list_Point *) G_calloc((size_t) search_points, sizeof(struct list_Point)); p = atof(parm.power->answer); /* get the window, dimension arrays */ G_get_window(&window);//.........这里部分代码省略.........
开发者ID:rkrug,项目名称:grass-ci,代码行数:101,
示例14: mainint main(int argc, char *argv[]){ struct Flag *tostdout, *overwrite; struct Option *extradirs; struct GModule *module; FILE *outstream; char *fontcapfile; struct stat status; int i; G_set_program_name(argv[0]); G_no_gisinit(); G_set_gisrc_mode(G_GISRC_MODE_MEMORY); module = G_define_module(); module->keywords = "general"; module->description = "Generates the font configuration file by scanning various directories " "for fonts"; overwrite = G_define_flag(); overwrite->key = 'o'; overwrite->description = "Overwrite font configuration file if already existing"; tostdout = G_define_flag(); tostdout->key = 's'; tostdout->description = "Write font configuration file to standard output instead of " "$GISBASE/etc"; extradirs = G_define_option(); extradirs->key = "extradirs"; extradirs->type = TYPE_STRING; extradirs->required = NO; extradirs->description = "Comma-separated list of extra directories to scan for " "Freetype-compatible fonts as well as the defaults (see documentation)"; if (argc > 1 && G_parser(argc, argv)) exit(EXIT_FAILURE); if (!tostdout->answer) { const char *gisbase = G_gisbase(); const char *alt_file = getenv("GRASS_FONT_CAP"); if (alt_file) fontcapfile = G_store(alt_file); else G_asprintf(&fontcapfile, "%s/etc/fontcap", gisbase); if (!stat(fontcapfile, &status)) { /* File exists? */ if (!overwrite->answer) G_fatal_error ("Fontcap file %s already exists; use -%c flag if you " "wish to overwrite it", fontcapfile, overwrite->key); } } searchdirs = NULL; numsearchdirs = 0; /* Prepare list of directories to search */ if (extradirs->answer) {#ifndef HAVE_FT2BUILD_H G_warning("This GRASS installation was compiled without Freetype support, extradirs parameter ignored");#endif char *str = G_store(extradirs->answer); while ((str = strtok(str, ","))) { add_search_dir(str); str = NULL; } } i = -1; while (standarddirs[++i]) add_search_dir(standarddirs[i]); totalfonts = maxfonts = 0; fontcap = NULL; find_stroke_fonts(); find_freetype_fonts(); qsort(fontcap, totalfonts, sizeof(struct GFONT_CAP), compare_fonts); if (tostdout->answer) outstream = stdout; else { outstream = fopen(fontcapfile, "w"); if (outstream == NULL) G_fatal_error("Cannot open %s for writing: %s", fontcapfile, strerror(errno)); } for (i = 0; i < totalfonts; i++) fprintf(outstream, "%s|%s|%d|%s|%d|%s|/n", fontcap[i].name, fontcap[i].longname, fontcap[i].type, fontcap[i].path, fontcap[i].index, fontcap[i].encoding);//.........这里部分代码省略.........
开发者ID:imincik,项目名称:pkg-grass,代码行数:101,
示例15: mainint main(int argc, char **argv){ int field, type, vertex_type; double dmax; char buf[DB_SQL_MAX]; struct { struct Option *input, *output, *type, *dmax, *lfield, *use; } opt; struct { struct Flag *table, *inter; } flag; struct GModule *module; struct Map_info In, Out; struct line_cats *LCats; struct line_pnts *LPoints; dbDriver *driver; struct field_info *Fi; dbString stmt; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("vector")); G_add_keyword(_("geometry")); G_add_keyword("3D"); G_add_keyword(_("node")); G_add_keyword(_("vertex")); module->description = _("Creates points along input lines in new vector map with 2 layers."); opt.input = G_define_standard_option(G_OPT_V_INPUT); opt.lfield = G_define_standard_option(G_OPT_V_FIELD); opt.lfield->key = "llayer"; opt.lfield->answer = "1"; opt.lfield->label = "Line layer number or name"; opt.lfield->guisection = _("Selection"); opt.type = G_define_standard_option(G_OPT_V3_TYPE); opt.type->answer = "point,line,boundary,centroid,face"; opt.type->guisection = _("Selection"); opt.output = G_define_standard_option(G_OPT_V_OUTPUT); opt.use = G_define_option(); opt.use->key = "use"; opt.use->type = TYPE_STRING; opt.use->required = NO; opt.use->description = _("Use line nodes or vertices only"); opt.use->options = "node,vertex"; opt.dmax = G_define_option(); opt.dmax->key = "dmax"; opt.dmax->type = TYPE_DOUBLE; opt.dmax->required = NO; opt.dmax->answer = "100"; opt.dmax->description = _("Maximum distance between points in map units"); flag.inter = G_define_flag(); flag.inter->key = 'i'; flag.inter->description = _("Interpolate points between line vertices (only for use=vertex)"); flag.table = G_define_standard_flag(G_FLG_V_TABLE); if (G_parser(argc, argv)) exit(EXIT_FAILURE); LCats = Vect_new_cats_struct(); LPoints = Vect_new_line_struct(); db_init_string(&stmt); type = Vect_option_to_types(opt.type); dmax = atof(opt.dmax->answer); vertex_type = 0; if (opt.use->answer) { if (opt.use->answer[0] == 'n') vertex_type = GV_NODE; else vertex_type = GV_VERTEX; } Vect_check_input_output_name(opt.input->answer, opt.output->answer, G_FATAL_EXIT); /* Open input lines */ Vect_set_open_level(2); if (Vect_open_old2(&In, opt.input->answer, "", opt.lfield->answer) < 0) G_fatal_error(_("Unable to open vector map <%s>"), opt.input->answer); Vect_set_error_handler_io(&In, &Out); field = Vect_get_field_number(&In, opt.lfield->answer); /* Open output segments *///.........这里部分代码省略.........
开发者ID:caomw,项目名称:grass,代码行数:101,
示例16: mainint main( int argc, char **argv ){ char *mapset; char *name; struct GModule *module; struct Option *map; struct Option *win; struct Option *format; struct Cell_head window; RASTER_MAP_TYPE raster_type; /* Initialize the GIS calls */ G_gisinit( argv[0] ); module = G_define_module(); module->keywords = ( "display, raster" ); module->description = ( "Output raster map layers in a format suitable for display in QGIS" ); map = G_define_standard_option( G_OPT_R_MAP ); map->description = ( "Raster map to be displayed" ); format = G_define_option(); format->key = "format"; format->type = TYPE_STRING; format->description = "format"; format->options = "color,value"; win = G_define_option(); win->key = "window"; win->type = TYPE_DOUBLE; win->multiple = YES; win->description = "xmin,ymin,xmax,ymax,ncols,nrows"; if ( G_parser( argc, argv ) ) exit( EXIT_FAILURE ); name = map->answer; /* Make sure map is available */#if GRASS_VERSION_MAJOR < 7 mapset = G_find_cell2( name, "" ); if ( mapset == NULL ) G_fatal_error(( "Raster map <%s> not found" ), name );#else mapset = "";#endif /* It can happen that GRASS data set is 'corrupted' and zone differs in WIND and * cellhd, and G_open_cell_old fails, so it is better to read window from map */ /* G_get_window( &window ); */ G_get_cellhd( name, mapset, &window ); window.west = atof( win->answers[0] ); window.south = atof( win->answers[1] ); window.east = atof( win->answers[2] ); window.north = atof( win->answers[3] ); window.cols = atoi( win->answers[4] ); window.rows = atoi( win->answers[5] ); G_adjust_Cell_head( &window, 1, 1 ); G_set_window( &window ); raster_type = G_raster_map_type( name, "" ); display( name, mapset, raster_type, format->answer ); exit( EXIT_SUCCESS );}
开发者ID:sourcepole,项目名称:kadas-albireo,代码行数:66,
示例17: parse_argsvoid parse_args(int argc, char **argv, struct _options *options, struct _flags *flags){ options->dsn = G_define_option(); options->dsn->key = "output"; options->dsn->type = TYPE_STRING; options->dsn->label = _("Name of output directory or OGR or PostGIS data source"); options->dsn->description = _("Examples:/n" "/t/tESRI Shapefile: directory containing a shapefile/n" "/t/tMapInfo File: directory containing a mapinfo file/n" "/t/tPostGIS database: connection string, eg. 'PG:dbname=db user=grass'"); options->dsn->required = NO; options->dsn->guisection = _("Settings"); options->format = G_define_option(); options->format->key = "format"; options->format->description = _("Format for output vector data"); options->format->required = NO; options->format->type = TYPE_STRING; options->format->options = format_options();#ifdef HAVE_OGR options->format->answer = "ESRI_Shapefile";#else#ifdef HAVE_POSTGRES options->format->answer = "PostgreSQL";#endif /* HAVE_POSTGRES */#endif /* HAVE_OGR */ options->format->guisection = _("Settings"); options->opts = G_define_option(); options->opts->key = "options"; options->opts->label = _("Creation options"); options->opts->description = _("Examples:/n" "/t/t'SHPT=POINTZ': create 3D point Shapefile data/n" "/t/t'GEOM_TYPE=geography': use geography PostGIS data/n" "/t/t'SCHEMA=grass': create new PostGIS tables in 'grass' schema"); options->opts->required = NO; options->opts->multiple = YES; options->opts->type = TYPE_STRING; options->opts->guisection = _("Settings"); options->input = G_define_standard_option(G_OPT_F_INPUT); options->input->key = "loadsettings"; options->input->required = NO; options->input->description = _("Name of input file to read settings from"); options->input->guisection = _("Settings"); options->output = G_define_standard_option(G_OPT_F_OUTPUT); options->output->key = "savesettings"; options->output->required = NO; options->output->description = _("Name for output file where to save current settings"); flags->f = G_define_flag(); flags->f->key = 'f'; flags->f->description = _("List supported formats and exit"); flags->f->guisection = _("Print"); flags->f->suppress_required = YES; flags->r = G_define_flag(); flags->r->key = 'r'; flags->r->description = _("Cease using OGR/PostGIS, revert to native output and exit"); flags->r->suppress_required = YES; flags->r->guisection = _("Native"); flags->p = G_define_flag(); flags->p->key = 'p'; flags->p->description = _("Print current status"); flags->p->guisection = _("Print"); flags->p->suppress_required = YES; flags->g = G_define_flag(); flags->g->key = 'g'; flags->g->description = _("Print current status in shell script style"); flags->g->guisection = _("Print"); flags->g->suppress_required = YES; if (G_parser(argc, argv)) exit(EXIT_FAILURE); /* check options */ if (options->dsn->answer && options->format->answer && options->input->answer) G_fatal_error(_("%s= and %s=/%s= are mutually exclusive"), options->input->key, options->dsn->key, options->format->key); if (flags->f->answer || flags->p->answer || flags->r->answer || flags->g->answer || options->output->answer) return; if (!options->dsn->answer && !options->input->answer) G_fatal_error(_("%s= or %s= must be specified"), options->dsn->key, options->input->key); if (options->dsn->answer && !options->format->answer) G_fatal_error(_("%s= must be specified"), options->format->key);}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:96,
示例18: mainint main(int argc, char **argv){ int field, type, vertex_type; double dmax; struct Option *in_opt, *out_opt, *type_opt, *dmax_opt, *lfield_opt; struct Flag *inter_flag, *vertex_flag, *table_flag, *node_flag; struct GModule *module; char *mapset; struct Map_info In, Out; struct line_cats *LCats; struct line_pnts *LPoints; char buf[2000]; G_gisinit(argv[0]); module = G_define_module(); module->keywords = _("vector, geometry"); module->description = _("Create points along input lines in new vector with 2 layers."); in_opt = G_define_standard_option(G_OPT_V_INPUT); in_opt->description = _("Input vector map containing lines"); out_opt = G_define_standard_option(G_OPT_V_OUTPUT); out_opt->description = _("Output vector map where points will be written"); type_opt = G_define_standard_option(G_OPT_V_TYPE); type_opt->answer = "point,line,boundary,centroid"; lfield_opt = G_define_standard_option(G_OPT_V_FIELD); lfield_opt->key = "llayer"; lfield_opt->answer = "1"; lfield_opt->description = "Line layer"; node_flag = G_define_flag(); node_flag->key = 'n'; node_flag->description = _("Write line nodes"); vertex_flag = G_define_flag(); vertex_flag->key = 'v'; vertex_flag->description = _("Write line vertices"); inter_flag = G_define_flag(); inter_flag->key = 'i'; inter_flag->description = _("Interpolate points between line vertices"); dmax_opt = G_define_option(); dmax_opt->key = "dmax"; dmax_opt->type = TYPE_DOUBLE; dmax_opt->required = NO; dmax_opt->answer = "100"; dmax_opt->description = _("Maximum distance between points in map units"); table_flag = G_define_flag(); table_flag->key = 't'; table_flag->description = _("Do not create attribute table"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); LCats = Vect_new_cats_struct(); PCats = Vect_new_cats_struct(); LPoints = Vect_new_line_struct(); PPoints = Vect_new_line_struct(); db_init_string(&stmt); field = atoi(lfield_opt->answer); type = Vect_option_to_types(type_opt); dmax = atof(dmax_opt->answer); if (node_flag->answer && vertex_flag->answer) G_fatal_error(_("Use either -n or -v flag, not both")); if (node_flag->answer) vertex_type = GV_NODE; else if (vertex_flag->answer) vertex_type = GV_VERTEX; else vertex_type = 0; Vect_check_input_output_name(in_opt->answer, out_opt->answer, GV_FATAL_EXIT); /* Open input lines */ mapset = G_find_vector2(in_opt->answer, NULL); if (mapset == NULL) G_fatal_error(_("Vector map <%s> not found"), in_opt->answer); Vect_set_open_level(2); Vect_open_old(&In, in_opt->answer, mapset); /* Open output segments */ Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In)); Vect_copy_head_data(&In, &Out); Vect_hist_copy(&In, &Out); Vect_hist_command(&Out); /* Table */ if (!table_flag->answer) {//.........这里部分代码省略.........
开发者ID:imincik,项目名称:pkg-grass,代码行数:101,
示例19: mainint main( int argc, char **argv ){ struct GModule *module; struct Option *info_opt, *rast_opt, *vect_opt, *coor_opt, *north_opt, *south_opt, *east_opt, *west_opt, *rows_opt, *cols_opt; struct Cell_head window; /* Initialize the GIS calls */ G_gisinit( argv[0] ); module = G_define_module(); module->description = ( "Get info about locations,mapsets,maps" ); info_opt = G_define_option(); info_opt->key = "info"; info_opt->type = TYPE_STRING; info_opt->description = "info key"; info_opt->options = "proj,window,size,query,info,colors,stats"; rast_opt = G_define_standard_option( G_OPT_R_INPUT ); rast_opt->key = "rast"; rast_opt->required = NO; vect_opt = G_define_standard_option( G_OPT_V_INPUT ); vect_opt->key = "vect"; vect_opt->required = NO; coor_opt = G_define_option(); coor_opt->key = "coor"; coor_opt->type = TYPE_DOUBLE; coor_opt->multiple = YES; north_opt = G_define_option(); north_opt->key = "north"; north_opt->type = TYPE_STRING; south_opt = G_define_option(); south_opt->key = "south"; south_opt->type = TYPE_STRING; east_opt = G_define_option(); east_opt->key = "east"; east_opt->type = TYPE_STRING; west_opt = G_define_option(); west_opt->key = "west"; west_opt->type = TYPE_STRING; rows_opt = G_define_option(); rows_opt->key = "rows"; rows_opt->type = TYPE_INTEGER; cols_opt = G_define_option(); cols_opt->key = "cols"; cols_opt->type = TYPE_INTEGER; if ( G_parser( argc, argv ) ) exit( EXIT_FAILURE ); if ( strcmp( "proj", info_opt->answer ) == 0 ) { G_get_window( &window ); /* code from g.proj */ if ( window.proj != PROJECTION_XY ) { struct Key_Value *projinfo, *projunits; char *wkt; projinfo = G_get_projinfo(); projunits = G_get_projunits(); wkt = GPJ_grass_to_wkt( projinfo, projunits, 0, 0 ); fprintf( stdout, "%s", wkt ); } } else if ( strcmp( "window", info_opt->answer ) == 0 ) { if ( rast_opt->answer ) { G_get_cellhd( rast_opt->answer, "", &window ); fprintf( stdout, "%f,%f,%f,%f", window.west, window.south, window.east, window.north ); } else if ( vect_opt->answer ) { G_fatal_error( "Not yet supported" ); } } // raster width and height else if ( strcmp( "size", info_opt->answer ) == 0 ) { if ( rast_opt->answer ) { G_get_cellhd( rast_opt->answer, "", &window ); fprintf( stdout, "%d,%d", window.cols, window.rows ); } else if ( vect_opt->answer ) { G_fatal_error( "Not yet supported" ); } } // raster information else if ( strcmp( "info", info_opt->answer ) == 0 ) {//.........这里部分代码省略.........
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:101,
示例20: mainint main(int argc, char *argv[]){ char *title; FILE *srcfp; struct GModule *module; struct { struct Option *input, *output, *title, *rules; struct Flag *a, *d; } parm; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("recode categories")); G_add_keyword(_("reclassification")); module->description = _("Recodes categorical raster maps."); parm.input = G_define_standard_option(G_OPT_R_INPUT); parm.input->description = _("Name of raster map to be recoded"); parm.output = G_define_standard_option(G_OPT_R_OUTPUT); parm.rules = G_define_standard_option(G_OPT_F_INPUT); parm.rules->key = "rules"; parm.rules->label = _("File containing recode rules"); parm.rules->description = _("'-' for standard input"); parm.title = G_define_option(); parm.title->key = "title"; parm.title->required = NO; parm.title->type = TYPE_STRING; parm.title->description = _("Title for output raster map"); parm.a = G_define_flag(); parm.a->key = 'a'; parm.a->description = _("Align the current region to the input raster map"); parm.d = G_define_flag(); parm.d->key = 'd'; parm.d->description = _("Force output to 'double' raster map type (DCELL)"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); name = parm.input->answer; result = parm.output->answer; title = parm.title->answer; align_wind = parm.a->answer; make_dcell = parm.d->answer; srcfp = stdin; if (strcmp(parm.rules->answer, "-") != 0) { srcfp = fopen(parm.rules->answer, "r"); if (!srcfp) G_fatal_error(_("Unable to open file <%s>"), parm.rules->answer); } if (!read_rules(srcfp)) { if (isatty(fileno(srcfp))) G_fatal_error(_("No rules specified. Raster map <%s> not created."), result); else G_fatal_error(_("No rules specified")); } no_mask = 0; do_recode(); if(title) Rast_put_cell_title(result, title); exit(EXIT_SUCCESS);}
开发者ID:rkrug,项目名称:grass-ci,代码行数:77,
示例21: mainint main(int argc, char *argv[]){ struct GModule *module; struct Option *in_dir_opt, *in_stm_opt, *in_elev_opt, *in_method_opt, *opt_swapsize, *out_dist_opt, *out_diff_opt; struct Flag *flag_outs, *flag_sub, *flag_near, *flag_segmentation; char *method_name[] = { "UPSTREAM", "DOWNSTREAM" }; int method; int number_of_segs; int outlets_num; int number_of_streams; int outs, subs, near, segmentation; /*flags */ int j; G_gisinit(argv[0]); module = G_define_module(); module->label = _("Calculates distance to and elevation above streams and outlet."); module->description = _("The module can work in stream mode where target are streams and " "outlets mode where targets are outlets."); G_add_keyword(_("raster")); G_add_keyword(_("hydrology")); G_add_keyword(_("stream network")); G_add_keyword(_("watercourse distance")); in_stm_opt = G_define_standard_option(G_OPT_R_INPUT); in_stm_opt->key = "stream_rast"; in_stm_opt->description = _("Name of input raster map with stream network " "(in outlet mode is the name for outlet raster map)"); in_dir_opt = G_define_standard_option(G_OPT_R_INPUT); in_dir_opt->key = "direction"; in_dir_opt->description = _("Name of input raster map with flow direction"); in_elev_opt = G_define_standard_option(G_OPT_R_ELEV); in_elev_opt->required = NO; in_elev_opt->guisection = _("Input maps"); in_method_opt = G_define_option(); in_method_opt->key = "method"; in_method_opt->description = _("Calculation method"); in_method_opt->type = TYPE_STRING; in_method_opt->required = YES; in_method_opt->options = "upstream,downstream"; in_method_opt->answer = "downstream"; out_dist_opt = G_define_standard_option(G_OPT_R_OUTPUT); out_dist_opt->key = "distance"; out_dist_opt->required = NO; out_dist_opt->description = _("Name for output distance raster map"); out_dist_opt->guisection = _("Output maps"); out_diff_opt = G_define_standard_option(G_OPT_R_OUTPUT); out_diff_opt->key = "difference"; out_diff_opt->required = NO; out_diff_opt->description = _("Name for output elevation difference raster map"); out_diff_opt->guisection = _("Output maps"); opt_swapsize = G_define_option(); opt_swapsize->key = "memory"; opt_swapsize->type = TYPE_INTEGER; opt_swapsize->answer = "300"; opt_swapsize->description = _("Max memory used in memory swap mode (MB)"); opt_swapsize->guisection = _("Memory settings"); flag_outs = G_define_flag(); flag_outs->key = 'o'; flag_outs->description = _("Calculate parameters for outlets (outlet mode) instead of (default) streams"); flag_sub = G_define_flag(); flag_sub->key = 's'; flag_sub->description = _("Calculate parameters for subbasins (ignored in stream mode)"); flag_near = G_define_flag(); flag_near->key = 'n'; flag_near->description = _("Calculate nearest local maximum (ignored in downstream calculation)"); flag_segmentation = G_define_flag(); flag_segmentation->key = 'm'; flag_segmentation->description = _("Use memory swap (operation is slow)"); flag_segmentation->guisection = _("Memory settings"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); if (!out_diff_opt->answer && !out_dist_opt->answer) G_fatal_error(_("You must select at least one output raster map")); if (out_diff_opt->answer && !in_elev_opt->answer) G_fatal_error(_("Output elevation difference raster map requires " "input elevation raster map to be specified")); if (!strcmp(in_method_opt->answer, "upstream")) method = UPSTREAM;//.........这里部分代码省略.........
开发者ID:caomw,项目名称:grass,代码行数:101,
示例22: parse_argsvoid parse_args(int argc, char **argv, char **input, char**output, int *format, int *dp, char **delim, char **field, char ***columns, char **where, int *region, int *old_format, int *header, struct cat_list **clist){ struct Option *input_opt, *output_opt, *format_opt, *dp_opt, *delim_opt, *field_opt, *column_opt, *where_opt, *cats_opt; struct Flag *old_flag, *header_flag, *region_flag; input_opt = G_define_standard_option(G_OPT_V_INPUT); field_opt = G_define_standard_option(G_OPT_V_FIELD); field_opt->guisection = _("Selection"); output_opt = G_define_standard_option(G_OPT_F_OUTPUT); output_opt->label = _("Name for output ASCII file " "or ASCII vector name if '-o' is defined"); output_opt->description = _("'-' for standard output"); output_opt->required = NO; output_opt->answer = "-"; column_opt = G_define_standard_option(G_OPT_DB_COLUMNS); column_opt->description = _("Name of attribute column(s) to be exported (point mode)"); column_opt->guisection = _("Points"); cats_opt = G_define_standard_option(G_OPT_V_CATS); cats_opt->guisection = _("Selection"); where_opt = G_define_standard_option(G_OPT_DB_WHERE); where_opt->guisection = _("Selection"); format_opt = G_define_option(); format_opt->key = "format"; format_opt->type = TYPE_STRING; format_opt->required = YES; format_opt->multiple = NO; format_opt->options = "point,standard,wkt"; format_opt->answer = "point"; format_opt->description = _("Output format"); format_opt->descriptions = _("point;Simple point format (point per row);" "standard;GRASS ASCII vector format;" "wkt;OGC well-known text;"); delim_opt = G_define_standard_option(G_OPT_F_SEP); delim_opt->description = _("Field separator (points mode)"); delim_opt->guisection = _("Points"); dp_opt = G_define_option(); dp_opt->key = "dp"; dp_opt->type = TYPE_INTEGER; dp_opt->required = NO; dp_opt->options = "0-32"; dp_opt->answer = "8"; /* This value is taken from the lib settings in G_format_easting() */ dp_opt->description = _("Number of significant digits (floating point only)"); dp_opt->guisection = _("Points"); old_flag = G_define_flag(); old_flag->key = 'o'; old_flag->description = _("Create old (version 4) ASCII file"); header_flag = G_define_flag(); header_flag->key = 'c'; header_flag->description = _("Include column names in output (points mode)"); header_flag->guisection = _("Points"); region_flag = G_define_flag(); region_flag->key = 'r'; region_flag->description = _("Only export points falling within current 3D region (points mode)"); region_flag->guisection = _("Points"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); *input = G_store(input_opt->answer); *output = G_store(output_opt->answer); if (format_opt->answer[0] == 'p') *format = GV_ASCII_FORMAT_POINT; else if (format_opt->answer[0] == 's') *format = GV_ASCII_FORMAT_STD; else *format = GV_ASCII_FORMAT_WKT; if (sscanf(dp_opt->answer, "%d", dp) != 1) G_fatal_error(_("Failed to interpret 'dp' parameter as an integer")); /* the field separator */ if (strcmp(delim_opt->answer, "//t") == 0) *delim = G_store("/t"); else if (strcmp(delim_opt->answer, "tab") == 0) *delim = G_store("/t"); else if (strcmp(delim_opt->answer, "space") == 0) *delim = G_store(" "); else if (strcmp(delim_opt->answer, "comma") == 0) *delim = G_store(","); else *delim = G_store(delim_opt->answer); *field = G_store(field_opt->answer); *columns = NULL; if (column_opt->answer) {//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,
注:本文中的G_define_option函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ G_fatal_error函数代码示例 C++ G_define_module函数代码示例 |