这篇教程C++ G_define_module函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中G_define_module函数的典型用法代码示例。如果您正苦于以下问题:C++ G_define_module函数的具体用法?C++ G_define_module怎么用?C++ G_define_module使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了G_define_module函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main(int argc, char *argv[]){ struct Option *raster, *conf, *output; struct GModule *module; G_gisinit(argv[0]); module = G_define_module(); module->description = _("Calculates coefficient of variation of patch area on a raster map"); module->keywords = _("raster, landscape structure analysis, patch index"); /* define options */ raster = G_define_standard_option(G_OPT_R_MAP); conf = G_define_option(); conf->key = "conf"; conf->description = _("Configuration file"); conf->gisprompt = "old_file,file,input"; conf->type = TYPE_STRING; conf->required = YES; output = G_define_standard_option(G_OPT_R_OUTPUT); if (G_parser(argc, argv)) exit(EXIT_FAILURE); return calculateIndex(conf->answer, patchAreaDistributionCV, NULL, raster->answer, output->answer);}
开发者ID:imincik,项目名称:pkg-grass,代码行数:25,
示例2: parse_command_linestatic void parse_command_line(int argc, char **argv){ struct Option *driver, *database; struct GModule *module; /* Initialize the GIS calls */ G_gisinit(argv[0]); driver = G_define_standard_option(G_OPT_DB_DRIVER); driver->options = db_list_drivers(); driver->required = YES; driver->answer = (char *) db_get_default_driver_name(); database = G_define_standard_option(G_OPT_DB_DATABASE); database->required = YES; /* Set description */ module = G_define_module(); G_add_keyword(_("database")); G_add_keyword(_("attribute table")); G_add_keyword(_("SQL")); module->description = _("Removes an existing database."); if (G_parser(argc, argv)) exit(EXIT_FAILURE); parms.driver = driver->answer; parms.database = database->answer;}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:29,
示例3: mainint main(int argc, char *argv[]){ char name[200]; char *fpath; struct GModule *module; struct Option *opt1; module = G_define_module(); G_add_keyword(_("general")); G_add_keyword(_("map management")); G_add_keyword(_("scripts")); module->description = "Searches for GRASS support files."; G_gisinit(argv[0]); /* Define the different options */ opt1 = G_define_option(); opt1->key = "file"; opt1->type = TYPE_STRING; opt1->required = YES; opt1->description = "Name of an file or directory"; if (G_parser(argc, argv)) exit(EXIT_FAILURE); strcpy(name, opt1->answer); fpath = G_find_etc(name); if (fpath) fprintf(stdout, "%s/n", fpath); exit(fpath ? EXIT_SUCCESS : EXIT_FAILURE);}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:34,
示例4: mainint main(int argc, char *argv[]){ struct Option *raster, *conf, *output; struct GModule *module; G_gisinit(argv[0]); module = G_define_module(); module->description = _("Calculates range of patch area size on a raster map"); G_add_keyword(_("raster")); G_add_keyword(_("landscape structure analysis")); G_add_keyword(_("patch index")); /* define options */ raster = G_define_standard_option(G_OPT_R_INPUT); conf = G_define_standard_option(G_OPT_F_INPUT); conf->key = "config"; conf->description = _("Configuration file"); conf->required = YES; output = G_define_standard_option(G_OPT_R_OUTPUT); if (G_parser(argc, argv)) exit(EXIT_FAILURE); return calculateIndex(conf->answer, patchAreaDistributionRANGE, NULL, raster->answer, output->answer);}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:28,
示例5: define_module/* Define our module so that Grass can print it if the user wants to know more. */static void define_module(void){ struct GModule *module; module = G_define_module(); module->label = _("Performs atmospheric correction using the 6S algorithm."); module->description = _("6S - Second Simulation of Satellite Signal in the Solar Spectrum."); G_add_keyword(_("imagery")); G_add_keyword(_("atmospheric correction")); G_add_keyword(_("radiometric conversion")); G_add_keyword(_("radiance")); G_add_keyword(_("reflectance")); G_add_keyword(_("satellite")); /* " Incorporated into Grass by Christo A. Zietsman, January 2003./n" " Converted from Fortran to C by Christo A. Zietsman, November 2002./n/n" " Adapted by Mauro A. Homem Antunes for atmopheric corrections of/n" " remotely sensed images in raw format (.RAW) of 8 bits./n" " April 4, 2001./n/n" " Please refer to the following paper and acknowledge the authors of/n" " the model:/n" " Vermote, E.F., Tanre, D., Deuze, J.L., Herman, M., and Morcrette,/n" " J.J., (1997), Second simulation of the satellite signal in/n" " the solar spectrum, 6S: An overview., IEEE Trans. Geosc./n" " and Remote Sens. 35(3):675-686./n" " The code is provided as is and is not to be sold. See notes on/n" " http://loasys.univ-lille1.fr/informatique/sixs_gb.html/n" " http://www.ltid.inpe.br/dsr/mauro/6s/index.html/n" " and on http://www.cs.sun.ac.za/~caz/index.html/n"; */}
开发者ID:rkrug,项目名称:grass-ci,代码行数:34,
示例6: mainint main(int argc, char *argv[]){ struct parms parms; /* command line parms */ struct files files; /* file descriptors, io, buffers */ struct Signature S; struct GModule *module; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("imagery")); G_add_keyword(_("classification")); G_add_keyword(_("supervised")); G_add_keyword(_("MLC")); module->description = _("Generates statistics for i.maxlik from raster map."); parse(argc, argv, &parms); openfiles(&parms, &files); read_training_labels(&parms, &files); get_training_classes(&files, &S); compute_means(&files, &S); compute_covariances(&files, &S); check_signatures(&S); write_sigfile(&parms, &S); G_done_msg(" "); exit(EXIT_SUCCESS);}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:31,
示例7: parse_command_linestatic void parse_command_line(int argc, char **argv){ struct Option *driver, *database; struct GModule *module; /* Initialize the GIS calls */ G_gisinit(argv[0]); driver = G_define_standard_option(G_OPT_DRIVER); driver->options = db_list_drivers(); driver->required = YES; database = G_define_standard_option(G_OPT_DATABASE); database->required = YES; /* Set description */ module = G_define_module(); module->keywords = _("database, SQL"); module->description = _("Creates an empty database."); if (G_parser(argc, argv)) exit(EXIT_FAILURE); parms.driver = driver->answer; parms.database = database->answer;}
开发者ID:imincik,项目名称:pkg-grass,代码行数:26,
示例8: mainint main(int argc, char *argv[]){ struct Option *raster, *conf, *output; struct GModule *module; G_gisinit(argv[0]); module = G_define_module(); module->description = _("Calculates shape index on a raster map"); G_add_keyword(_("raster")); G_add_keyword(_("landscape structure analysis")); G_add_keyword(_("patch index")); /* define options */ raster = G_define_standard_option(G_OPT_R_INPUT); conf = G_define_option(); conf->key = "config"; conf->description = _("Configuration file"); conf->gisprompt = "old_file,file,input"; conf->type = TYPE_STRING; conf->required = YES; output = G_define_standard_option(G_OPT_R_OUTPUT); /** add other options for index parameters here */ if (G_parser(argc, argv)) exit(EXIT_FAILURE); return calculateIndex(conf->answer, shape_index, NULL, raster->answer, output->answer);}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:34,
示例9: mainint main( int argc, char **argv ){ char *mapset; char *name; int fp; struct GModule *module; struct Option *map; struct Option *win; struct Cell_head window; /* 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" ); 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 */ mapset = G_find_cell2( name, "" ); if ( mapset == NULL ) G_fatal_error(( "Raster map <%s> not found" ), name ); /* 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 ); fp = G_raster_map_is_fp( name, mapset ); /* use DCELL even if the map is FCELL */ if ( fp ) display( name, mapset, DCELL_TYPE ); else display( name, mapset, CELL_TYPE ); exit( EXIT_SUCCESS );}
开发者ID:mmubangizi,项目名称:qgis,代码行数:59,
示例10: mainint main(int argc, char *argv[]){ struct GModule *module; struct Option *map, *date; struct TimeStamp ts; char *name; int modify; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("metadata")); G_add_keyword(_("timestamp")); module->label = _("Modifies a timestamp for a raster map."); module->description = _("Print/add/remove a timestamp for a raster map."); map = G_define_standard_option(G_OPT_R_MAP); date = G_define_option(); date->key = "date"; date->key_desc = "timestamp"; date->required = NO; date->type = TYPE_STRING; date->label = _("Datetime, datetime1/datetime2, or 'none' to remove"); date->description = _("Format: '15 jan 1994' (absolute) or '2 years' (relative)"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); name = map->answer; modify = date->answer != NULL; if (!modify) { if (G_read_raster_timestamp(name, "", &ts) == 1) { G__write_timestamp(stdout, &ts); exit(EXIT_SUCCESS); } else exit(EXIT_FAILURE); } if (strcmp(date->answer, "none") == 0) { G_remove_raster_timestamp(name); exit(EXIT_SUCCESS); } if (1 == G_scan_timestamp(&ts, date->answer)) { G_write_raster_timestamp(name, &ts); exit(EXIT_SUCCESS); } else G_fatal_error(_("Invalid timestamp")); exit(EXIT_SUCCESS);}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:56,
示例11: mainint main(int argc, char *argv[]){ int nlines; double textsize; char *dxf_file; struct Map_info In; struct GModule *module; struct Option *input, *output, *field; G_gisinit(argv[0]); /* Set description */ module = G_define_module(); G_add_keyword(_("vector")); G_add_keyword(_("export")); G_add_keyword(_("DXF")); module->description = _("Exports vector map to DXF file format."); input = G_define_standard_option(G_OPT_V_INPUT); field = G_define_standard_option(G_OPT_V_FIELD_ALL); output = G_define_standard_option(G_OPT_F_OUTPUT); output->required = YES; output->description = _("Name for DXF output file"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); overwrite = module->overwrite; /* open input vector */ dxf_file = G_store(output->answer); Vect_set_open_level(2); if (Vect_open_old2(&In, input->answer, "", field->answer) < 0) G_fatal_error(_("Unable to open vector map <%s>"), input->answer); dxf_open(dxf_file); /* open output */ textsize = do_limits(&In); /* does header in dxf_fp */ make_layername(); dxf_entities(); nlines = add_plines(&In, Vect_get_field_number(&In, field->answer), textsize); /* puts plines in dxf_fp */ dxf_endsec(); dxf_eof(); /* puts final stuff in dxf_fp, closes file */ G_done_msg(_("%d features written to '%s'."), nlines, dxf_file); G_free(dxf_file); exit(EXIT_SUCCESS);}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:56,
示例12: mainint main(int argc, char *argv[]){ struct Option *raster, *conf, *output, *alpha; struct GModule *module; char **par = NULL; G_gisinit(argv[0]); module = G_define_module(); module->description = _("Calculates Renyi's diversity index on a raster map"); G_add_keyword(_("raster")); G_add_keyword(_("landscape structure analysis")); G_add_keyword(_("diversity index")); /* define options */ raster = G_define_standard_option(G_OPT_R_INPUT); conf = G_define_option(); conf->key = "config"; conf->description = _("Configuration file"); conf->gisprompt = "old_file,file,input"; conf->type = TYPE_STRING; conf->required = YES; alpha = G_define_option(); alpha->key = "alpha"; alpha->description = _("Alpha value is the order of the generalized entropy"); alpha->type = TYPE_STRING; alpha->required = YES; output = G_define_standard_option(G_OPT_R_OUTPUT); if (G_parser(argc, argv)) exit(EXIT_FAILURE); if (atoi(alpha->answer) == 1) { G_fatal_error ("If alpha = 1 Renyi index is not defined. (Ricotta et al., 2003, Environ. Model. Softw.)"); exit(RLI_ERRORE); } else if (atof(alpha->answer) < 0.) { G_fatal_error ("Alpha must be > 0 otherwise Renyi index is not defined. (Ricotta et al., 2003, Environ. Model. Softw.)"); exit(RLI_ERRORE); } else { par = &alpha->answer; } return calculateIndex(conf->answer, renyi, par, raster->answer, output->answer);}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:54,
示例13: parse_command_linestatic void parse_command_line(int argc, char **argv){ struct Option *driver, *database, *schema, *input; struct Flag *i; struct GModule *module; const char *drv, *db, *schema_name; /* Initialize the GIS calls */ G_gisinit(argv[0]); /* Set description */ module = G_define_module(); G_add_keyword(_("database")); G_add_keyword(_("attribute table")); G_add_keyword(_("SQL")); module->label = _("Executes any SQL statement."); module->description = _("For SELECT statements use 'db.select'."); input = G_define_standard_option(G_OPT_F_INPUT); input->label = _("Name of file containing SQL statements"); input->description = _("'-' to read from standard input"); driver = G_define_standard_option(G_OPT_DB_DRIVER); driver->options = db_list_drivers(); driver->guisection = _("Connection"); if ((drv = db_get_default_driver_name())) driver->answer = (char *) drv; database = G_define_standard_option(G_OPT_DB_DATABASE); database->guisection = _("Connection"); if ((db = db_get_default_database_name())) database->answer = (char *) db; schema = G_define_standard_option(G_OPT_DB_SCHEMA); schema->guisection = _("Connection"); if ((schema_name = db_get_default_schema_name())) schema->answer = (char *) schema_name; i = G_define_flag(); i->key = 'i'; i->description = _("Ignore SQL errors and continue"); i->guisection = _("Errors"); if (G_parser(argc, argv)) exit(EXIT_SUCCESS); parms.driver = driver->answer; parms.database = database->answer; parms.schema = schema->answer; parms.input = input->answer; parms.i = i->answer;}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:52,
示例14: mainint main(int argc, char *argv[]){ struct Option *driver, *database, *user, *password; struct GModule *module; /* Initialize the GIS calls */ G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("database")); G_add_keyword(_("connection settings")); module->description = _("Sets user/password for driver/database."); driver = G_define_standard_option(G_OPT_DB_DRIVER); driver->options = db_list_drivers(); driver->required = YES; driver->answer = (char *) db_get_default_driver_name(); database = G_define_standard_option(G_OPT_DB_DATABASE); database->required = YES; database->answer = (char *) db_get_default_database_name(); user = G_define_option(); user->key = "user"; user->type = TYPE_STRING; user->required = NO; user->multiple = NO; user->description = _("Username"); password = G_define_option(); password->key = "password"; password->type = TYPE_STRING; password->required = NO; password->multiple = NO; password->description = _("Password"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); if (db_set_login(driver->answer, database->answer, user->answer, password->answer) == DB_FAILED) { G_fatal_error(_("Unable to set user/password")); } if (password->answer) G_important_message(_("The password was stored in file (%s/dblogin)"), CONFIG_DIR); exit(EXIT_SUCCESS);}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:49,
示例15: mainint main(int argc, char *argv[]){ struct GModule *module; struct { struct Option *map; struct Option *line; struct Option *null_str; } parms; struct Flag *coord; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("transect")); module->description = _("Outputs raster map layer values lying along " "user defined transect line(s)."); parms.map = G_define_standard_option(G_OPT_R_MAP); parms.map->description = _("Raster map to be queried"); parms.line = G_define_option(); parms.line->key = "line"; parms.line->key_desc = "east,north,azimuth,distance"; parms.line->type = TYPE_STRING; parms.line->description = _("Transect definition"); parms.line->required = YES; parms.line->multiple = YES; parms.null_str = G_define_standard_option(G_OPT_M_NULL_VALUE); parms.null_str->answer = "*"; coord = G_define_flag(); coord->key = 'g'; coord->description = _("Output easting and northing in first two columns of four column output"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); return profile(coord->answer, parms.map->answer, parms.null_str->answer, parms.line->answers) != 0;}
开发者ID:rkrug,项目名称:grass-ci,代码行数:47,
示例16: mainint main(int argc, char *argv[]){ /****** INITIALISE ******/ double gauss_mean, gauss_sigma; struct GModule *module; struct Option *out; struct Option *mean; struct Option *sigma; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("surface")); G_add_keyword(_("random")); module->label = _("Generates a raster map using gaussian " "random number generator."); module->description = _("Mean and standard deviation of gaussian deviates " "can be expressed by the user."); out = G_define_standard_option(G_OPT_R_OUTPUT); mean = G_define_option(); mean->key = "mean"; mean->description = _("Distribution mean"); mean->type = TYPE_DOUBLE; mean->answer = "0.0"; sigma = G_define_option(); sigma->key = "sigma"; sigma->description = _("Standard deviation"); sigma->type = TYPE_DOUBLE; sigma->answer = "1.0"; if (G_parser(argc, argv)) exit(EXIT_FAILURE); sscanf(mean->answer, "%lf", &gauss_mean); sscanf(sigma->answer, "%lf", &gauss_sigma); gaussurf(out->answer, gauss_mean, gauss_sigma); exit(EXIT_SUCCESS);}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:47,
示例17: parse_toplevelvoid parse_toplevel(struct context *ctx, const char *cmd){ char **tokens; if (G_strcasecmp(cmd, "module") == 0) { ctx->state = S_MODULE; ctx->module = G_define_module(); return; } if (G_strcasecmp(cmd, "flag") == 0) { ctx->state = S_FLAG; ctx->flag = G_define_flag(); if (!ctx->first_flag) ctx->first_flag = ctx->flag; return; } if (G_strncasecmp(cmd, "option", strlen("option")) == 0) { ctx->state = S_OPTION; tokens = G_tokenize(cmd, " "); if (G_number_of_tokens(tokens) > 1) { /* standard option */ ctx->option = define_standard_option(tokens[1]); } else { ctx->option = G_define_option(); } if (!ctx->first_option) ctx->first_option = ctx->option; G_free_tokens(tokens); return; } if (G_strcasecmp(cmd, "rules") == 0) { ctx->state = S_RULES; return; } fprintf(stderr, _("Unknown command /"%s/" at line %d/n"), cmd, ctx->line);}
开发者ID:caomw,项目名称:grass,代码行数:44,
示例18: mainint main(int argc, char *argv[]){ struct GModule *module; struct _options options; struct _flags flags; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("vector")); G_add_keyword(_("export")); G_add_keyword(_("output")); G_add_keyword(_("external")); module->description = _("Defines vector output format utilizing OGR library."); OGRRegisterAll(); parse_args(argc, argv, &options, &flags); if (flags.f->answer) { list_formats(); exit(EXIT_SUCCESS); } if (flags.r->answer) { G_remove("", "OGR"); exit(EXIT_SUCCESS); } if (options.format->answer) check_format(options.format->answer); if (options.dsn->answer) make_link(options.dsn->answer, options.format->answer, options.opts->answers); if (flags.p->answer || flags.g->answer) { print_status(flags.g->answer ? 1 : 0); } exit(EXIT_SUCCESS);}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:43,
示例19: mainint main(int argc, char **argv){ struct GModule *module; struct { struct Option *input; struct Option *output; } params; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster")); G_add_keyword(_("hydrology")); module->description = _("Creates a topographic index raster map from an elevation raster map."); params.input = G_define_standard_option(G_OPT_R_ELEV); params.input->key = "input"; params.output = G_define_standard_option(G_OPT_R_OUTPUT); params.output->description = _("Name for output topographic index raster map"); 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()); input = params.input->answer; output = params.output->answer; G_get_window(&window); read_cells(); initialize(); calculate_atanb(); write_cells(); exit(EXIT_SUCCESS);}
开发者ID:caomw,项目名称:grass,代码行数:43,
示例20: mainint main(int argc, char *argv[]){ char *name; d_Mask *maskRules; struct GModule *module; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("raster3d")); G_add_keyword(_("mask")); G_add_keyword(_("voxel")); module->description = _("Establishes the current working 3D raster mask."); params.map = G_define_option(); params.map->key = "map"; params.map->type = TYPE_STRING; params.map->required = YES; params.map->multiple = NO; params.map->gisprompt = "old,grid3,3d-raster"; params.map->description = _("3D raster map with reference values"); params.maskVals = G_define_option(); params.maskVals->key = "maskvalues"; params.maskVals->key_desc = "val[-val]"; params.maskVals->type = TYPE_STRING; params.maskVals->required = NO; params.maskVals->multiple = YES; params.maskVals->description = _("List of cell values to be masked out"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); if (Rast3d_mask_file_exists()) G_fatal_error(_("Cannot create mask file: RASTER3D_MASK already exists")); getParams(&name, &maskRules); makeMask(name, maskRules); exit(EXIT_SUCCESS);}
开发者ID:caomw,项目名称:grass,代码行数:43,
示例21: mainint main(int argc, char *argv[]){ struct parms parms; /* command line parms */ struct files files; /* file descriptors, io, buffers */ struct SigSet S; int i; int junk; struct GModule *module; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("imagery")); G_add_keyword(_("classification")); G_add_keyword(_("supervised classification")); G_add_keyword(_("SMAP")); G_add_keyword(_("signatures")); module->description = _("Generates statistics for i.smap from raster map."); parse(argc, argv, &parms); openfiles(&parms, &files); read_training_labels(&parms, &files); get_training_classes(&parms, &files, &S); read_data(&files, &S); for (i = 0; i < S.nclasses; i++) { G_message(_("Clustering class %d (%d pixels)..."), i + 1, S.ClassSig[i].ClassData.npixels); subcluster(&S, i, &junk, parms.maxsubclasses); G_message(_("Number of subclasses is %d"), S.ClassSig[i].nsubclasses); } write_sigfile(&parms, &S); G_done_msg(" "); exit(EXIT_SUCCESS);}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:40,
示例22: mainint main(int argc, char **argv){ char *name; d_Mask *maskRules; int changeNull; double newNullVal; struct GModule *module; G_gisinit(argv[0]); module = G_define_module(); module->keywords = _("raster3d, voxel"); module->description = _("Explicitly create the 3D NULL-value bitmap file."); setParams(); if (G_parser(argc, argv)) exit(EXIT_FAILURE); getParams(&name, &maskRules, &changeNull, &newNullVal); modifyNull(name, maskRules, changeNull, newNullVal); exit(EXIT_SUCCESS);}
开发者ID:imincik,项目名称:pkg-grass,代码行数:23,
示例23: mainint main(int argc, char *argv[]){ struct GModule *module; struct Option *pid; char *tempfile, *G__tempfile(); int p; G_gisinit(argv[0]); module = G_define_module(); module->keywords = _("general, map management"); module->description = "Creates a temporary file and prints the file name."; pid = G_define_option(); pid->key = "pid"; pid->type = TYPE_INTEGER; pid->required = YES; pid->description = "Process id to use when naming the tempfile"; G_disable_interactive(); if (G_parser(argc, argv)) exit(1); if (sscanf(pid->answer, "%d", &p) != 1) { G_usage(); exit(EXIT_FAILURE); } tempfile = G__tempfile(p); /* create tempfile so next run of this program will create a unique name */ close(creat(tempfile, 0666)); fprintf(stdout, "%s/n", tempfile); exit(EXIT_SUCCESS);}
开发者ID:imincik,项目名称:pkg-grass,代码行数:36,
示例24: mainint main(int argc, char **argv){ struct GModule *module; struct { struct Option *text; struct Option *size; struct Option *fgcolor; struct Option *bgcolor; struct Option *line; struct Option *at; struct Option *rotation; struct Option *align; struct Option *linespacing; struct Option *font; struct Option *path; struct Option *charset; struct Option *input; } opt; struct { struct Flag *p; struct Flag *g; struct Flag *b; struct Flag *r; struct Flag *s; } flag; /* options and flags */ char *text; double size; double x, y; int line; double rotation; char align[3]; double linespacing; char bold; /* window info */ struct rectinfo win; /* command file */ FILE *cmd_fp; char buf[512]; int first_text; int linefeed; int set_l; double orig_x, orig_y; double prev_x, prev_y; double set_x, set_y; double east, north; int do_background, fg_color, bg_color; /* initialize the GIS calls */ G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("display")); G_add_keyword(_("cartography")); module->description = _("Draws text in the active display frame on the graphics monitor using the current font."); opt.text = G_define_option(); opt.text->key = "text"; opt.text->type = TYPE_STRING; opt.text->required = NO; opt.text->description = _("Text to display"); opt.text->guisection = _("Input"); opt.input = G_define_standard_option(G_OPT_F_INPUT); opt.input->required = NO; opt.input->description = _("Input file"); opt.input->guisection = _("Input"); opt.fgcolor = G_define_option(); opt.fgcolor->key = "color"; opt.fgcolor->type = TYPE_STRING; opt.fgcolor->answer = DEFAULT_COLOR; opt.fgcolor->required = NO; opt.fgcolor->description = _("Text color, either a standard GRASS color or R:G:B triplet"); opt.fgcolor->gisprompt = "old_color,color,color"; opt.fgcolor->guisection = _("Text"); opt.bgcolor = G_define_option(); opt.bgcolor->key = "bgcolor"; opt.bgcolor->type = TYPE_STRING; opt.bgcolor->required = NO; opt.bgcolor->description = _("Text background color, either a standard GRASS color or R:G:B triplet"); opt.bgcolor->gisprompt = "old_color,color,color"; opt.bgcolor->guisection = _("Text"); opt.rotation = G_define_option(); opt.rotation->key = "rotation"; opt.rotation->type = TYPE_DOUBLE; opt.rotation->required = NO;//.........这里部分代码省略.........
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:101,
示例25: mainint main(int argc, char *argv[]){ int i, cat, with_z, more, ctype, nrows; char buf[DB_SQL_MAX]; int count; double coor[3]; int ncoor; struct Option *driver_opt, *database_opt, *table_opt; struct Option *xcol_opt, *ycol_opt, *zcol_opt, *keycol_opt, *where_opt, *outvect; struct Flag *same_table_flag; struct GModule *module; struct Map_info Map; struct line_pnts *Points; struct line_cats *Cats; dbString sql; dbDriver *driver; dbCursor cursor; dbTable *table; dbColumn *column; dbValue *value; struct field_info *fi; G_gisinit(argv[0]); module = G_define_module(); G_add_keyword(_("vector")); G_add_keyword(_("import")); G_add_keyword(_("database")); G_add_keyword(_("points")); module->description = _("Creates new vector (points) map from database table containing coordinates."); table_opt = G_define_standard_option(G_OPT_DB_TABLE); table_opt->required = YES; table_opt->description = _("Input table name"); driver_opt = G_define_standard_option(G_OPT_DB_DRIVER); driver_opt->options = db_list_drivers(); driver_opt->answer = (char *)db_get_default_driver_name(); driver_opt->guisection = _("Input DB"); database_opt = G_define_standard_option(G_OPT_DB_DATABASE); database_opt->answer = (char *)db_get_default_database_name(); database_opt->guisection = _("Input DB"); xcol_opt = G_define_standard_option(G_OPT_DB_COLUMN); xcol_opt->key = "x"; xcol_opt->required = YES; xcol_opt->description = _("Name of column containing x coordinate"); ycol_opt = G_define_standard_option(G_OPT_DB_COLUMN); ycol_opt->key = "y"; ycol_opt->required = YES; ycol_opt->description = _("Name of column containing y coordinate"); zcol_opt = G_define_standard_option(G_OPT_DB_COLUMN); zcol_opt->key = "z"; zcol_opt->description = _("Name of column containing z coordinate"); zcol_opt->guisection = _("3D output"); keycol_opt = G_define_standard_option(G_OPT_DB_COLUMN); keycol_opt->key = "key"; keycol_opt->required = NO; keycol_opt->label = _("Name of column containing category number"); keycol_opt->description = _("Must refer to an integer column"); where_opt = G_define_standard_option(G_OPT_DB_WHERE); where_opt->guisection = _("Selection"); outvect = G_define_standard_option(G_OPT_V_OUTPUT); same_table_flag = G_define_flag(); same_table_flag->key = 't'; same_table_flag->description = _("Use imported table as attribute table for new map"); if (G_parser(argc, argv)) exit(EXIT_FAILURE); if (zcol_opt->answer) { with_z = WITH_Z; ncoor = 3; } else { with_z = WITHOUT_Z; ncoor = 2; } Points = Vect_new_line_struct(); Cats = Vect_new_cats_struct(); db_init_string(&sql); if (G_get_overwrite()) { /* We don't want to delete the input table when overwriting the output * vector. */ char name[GNAME_MAX], mapset[GMAPSET_MAX]; if (!G_name_is_fully_qualified(outvect->answer, name, mapset)) { strcpy(name, outvect->answer);//.........这里部分代码省略.........
开发者ID:caomw,项目名称:grass,代码行数:101,
示例26: mainint main( int argc, char **argv ){ struct GModule *module; struct Option *info_opt, *rast_opt, *vect_opt, *coor_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,query"; 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; 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" ); } } else if ( strcmp( "query", info_opt->answer ) == 0 ) { double x, y; int row, col; x = atof( coor_opt->answers[0] ); y = atof( coor_opt->answers[1] ); if ( rast_opt->answer ) { int fd; RASTER_MAP_TYPE rast_type; DCELL *dcell; CELL *cell; G_get_cellhd( rast_opt->answer, "", &window ); G_set_window( &window ); fd = G_open_cell_old( rast_opt->answer, "" ); col = ( int ) G_easting_to_col( x, &window ); row = ( int ) G_northing_to_row( y, &window ); if ( col == window.cols ) col--; if ( row == window.rows ) row--; if ( col < 0 || col > window.cols || row < 0 || row > window.rows ) { fprintf( stdout, "value:null/n" ); } else { void *ptr; double val;#if defined(GRASS_VERSION_MAJOR) && defined(GRASS_VERSION_MINOR) && / ( ( GRASS_VERSION_MAJOR == 6 && GRASS_VERSION_MINOR > 2 ) || GRASS_VERSION_MAJOR > 6 ) rast_type = G_get_raster_map_type( fd );#else rast_type = G_raster_map_type( rast_opt->answer, "" );#endif cell = G_allocate_c_raster_buf(); dcell = G_allocate_d_raster_buf(); if ( rast_type == CELL_TYPE )//.........这里部分代码省略.........
开发者ID:mmubangizi,项目名称:qgis,代码行数:101,
注:本文中的G_define_module函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ G_define_option函数代码示例 C++ G_define_flag函数代码示例 |