本文整理汇总了C++中G_gisinit函数 的典型用法代码示例。如果您正苦于以下问题:C++ G_gisinit函数的具体用法?C++ G_gisinit怎么用?C++ G_gisinit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_gisinit函数 的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
char *name;
int overlay;
int invert, fp;
struct GModule *module;
struct Option *map;
struct Option *vallist;
struct Option *bg;
struct Flag *flag_n;
struct Flag *flag_i;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("display"));
G_add_keyword(_("raster"));
module->description = _("Displays user-specified raster map in the active "
"graphics frame.");
/* set up command line */
map = G_define_standard_option(G_OPT_R_MAP);
map->description = _("Name of raster map to be displayed");
vallist = G_define_option();
vallist->key = "values";
vallist->key_desc = "value[-value]";
vallist->type = TYPE_STRING;
vallist->required = NO;
vallist->multiple = YES;
vallist->description = _("List of categories or values to be displayed");
vallist->guisection = _("Selection");
bg = G_define_standard_option(G_OPT_C_BG);
bg->key_desc = "color";
bg->gisprompt = "old_color,color,color";
bg->label = _("Background color (for null)");
bg->description = _("Either a standard color name or R:G:B triplet");
bg->guisection = _("Null cells");
flag_n = G_define_flag();
flag_n->key = 'n';
flag_n->description = _("Make null cells opaque");
flag_n->guisection = _("Null cells");
flag_i = G_define_flag();
flag_i->key = 'i';
flag_i->description = _("Invert value list");
flag_i->guisection = _("Selection");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
name = map->answer;
overlay = !flag_n->answer;
invert = flag_i->answer;
if (D_open_driver() != 0)
G_fatal_error(_("No graphics device selected. "
"Use d.mon to select graphics device."));
fp = Rast_map_is_fp(name, "");
if (vallist->answer) {
if (fp)
parse_vallist(vallist->answers, &d_mask);
else
parse_catlist(vallist->answers, &mask);
}
/* use DCELL even if the map is FCELL */
display(name, overlay, bg->answer, fp ? DCELL_TYPE : CELL_TYPE, invert);
D_save_command(G_recreate_command());
D_close_driver();
exit(EXIT_SUCCESS);
}
开发者ID:AsherBond, 项目名称:MondocosmOS, 代码行数:78, 代码来源:main.c
示例2: main
int main(int argc, char *argv[])
{
char *name, *outfile;
const char *unit;
int unit_id;
double factor;
int fd, projection;
FILE *fp, *coor_fp;
double res;
char *null_string;
char ebuf[256], nbuf[256], label[512], formatbuff[256];
char b1[100], b2[100];
int n;
int havefirst = FALSE;
int coords = 0, i, k = -1;
double e1, e2, n1, n2;
RASTER_MAP_TYPE data_type;
struct Cell_head window;
struct
{
struct Option *opt1, *profile, *res, *output, *null_str, *coord_file, *units;
struct Flag *g, *c, *m;
}
parm;
struct GModule *module;
G_gisinit(argv[0]);
/* Set description */
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("profile"));
module->description =
_("Outputs the raster map layer values lying on user-defined line(s).");
parm.opt1 = G_define_standard_option(G_OPT_R_INPUT);
parm.output = G_define_standard_option(G_OPT_F_OUTPUT);
parm.output->required = NO;
parm.output->answer = "-";
parm.output->description =
_("Name of file for output (use output=- for stdout)");
parm.profile = G_define_standard_option(G_OPT_M_COORDS);
parm.profile->required = NO;
parm.profile->multiple = YES;
parm.profile->description = _("Profile coordinate pairs");
parm.coord_file = G_define_standard_option(G_OPT_F_INPUT);
parm.coord_file->key = "file";
parm.coord_file->required = NO;
parm.coord_file->label =
_("Name of input file containing coordinate pairs");
parm.coord_file->description =
_("Use instead of the 'coordinates' option. "
"\"-\" reads from stdin.");
parm.res = G_define_option();
parm.res->key = "resolution";
parm.res->type = TYPE_DOUBLE;
parm.res->required = NO;
parm.res->description =
_("Resolution along profile (default = current region resolution)");
parm.null_str = G_define_option();
parm.null_str->key = "null";
parm.null_str->type = TYPE_STRING;
parm.null_str->required = NO;
parm.null_str->answer = "*";
parm.null_str->description = _("Character to represent no data cell");
parm.g = G_define_flag();
parm.g->key = 'g';
parm.g->description =
_("Output easting and northing in first two columns of four column output");
parm.c = G_define_flag();
parm.c->key = 'c';
parm.c->description =
_("Output RRR:GGG:BBB color values for each profile point");
parm.units = G_define_standard_option(G_OPT_M_UNITS);
parm.units->options = "meters,kilometers,feet,miles";
parm.units->label = parm.units->description;
parm.units->description = _("If units are not specified, current location units are used. "
"Meters are used by default in geographic (latlon) locations.");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
clr = 0;
if (parm.c->answer)
clr = 1; /* color output */
null_string = parm.null_str->answer;
if ((parm.profile->answer && parm.coord_file->answer) ||
(!parm.profile->answer && !parm.coord_file->answer))
G_fatal_error(_("Either use profile option or coordinate_file "
" option, but not both"));
//.........这里部分代码省略.........
开发者ID:caomw, 项目名称:grass, 代码行数:101, 代码来源:main.c
示例3: main
int 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, 代码来源:main.c
示例4: main
int main(int argc, char **argv)
{
FILTER *filter;
int nfilters;
int repeat;
char *in_name;
char *filt_name;
char *out_name;
char title[1024];
char temp[300];
int i;
struct GModule *module;
struct Flag *flag2;
struct Option *opt1;
struct Option *opt2;
struct Option *opt3;
struct Option *opt4;
struct Option *opt5;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("algebra"));
G_add_keyword(_("statistics"));
module->description = _("Performs raster map matrix filter.");
/* Define the different options */
opt1 = G_define_standard_option(G_OPT_R_INPUT);
opt2 = G_define_standard_option(G_OPT_R_OUTPUT);
opt3 = G_define_standard_option(G_OPT_F_INPUT);
opt3->key = "filter";
opt3->required = YES;
opt3->description = _("Path to filter file");
opt4 = G_define_option();
opt4->key = "repeat";
opt4->type = TYPE_INTEGER;
opt4->multiple = NO;
opt4->required = NO;
opt4->answer = "1";
opt4->description = _("Number of times to repeat the filter");
opt4->guisection = _("Filter");
opt5 = G_define_option();
opt5->key = "title";
opt5->type = TYPE_STRING;
opt5->required = NO;
opt5->description = _("Output raster map title");
/* Define the different flags */
/* this isn't implemented at all
flag3 = G_define_flag() ;
flag3->key = 'p' ;
flag3->description = _("Preserved edge") ;
*/
flag2 = G_define_flag();
flag2->key = 'z';
flag2->description = _("Apply filter only to null data values");
flag2->guisection = _("Filter");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
/*
preserve_edges = flag3->answer;
*/
null_only = flag2->answer;
sscanf(opt4->answer, "%d", &repeat);
out_name = opt2->answer;
filt_name = opt3->answer;
in_name = opt1->answer;
nrows = Rast_window_rows();
ncols = Rast_window_cols();
buflen = ncols * sizeof(DCELL);
/* get the filter */
filter = get_filter(filt_name, &nfilters, temp);
/* make sure filter matrix won't extend outside the raster map */
for (i = 0; i < nfilters; i++) {
if (filter[i].size > ncols || filter[i].size > nrows)
G_fatal_error(_("Raster map too small for the size of the filter"));
}
/* make a title for result */
if (opt5->answer)
strcpy(title, opt5->answer);
else {
if (*temp == 0)
strcpy(temp, "unknown filter");
//.........这里部分代码省略.........
开发者ID:AsherBond, 项目名称:MondocosmOS, 代码行数:101, 代码来源:main.c
示例5: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct Option *start_opt, *select_opt, *stop_opt, *output_opt,
*width_opt, *height_opt, *bgcolor_opt, *res_opt;
struct Flag *list_flag, *selected_flag, *select_flag, *release_flag,
*cmd_flag, *truecolor_flag, *update_flag, *x_flag, *sfile_flag;
int nopts, ret;
const char *mon;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("display"));
G_add_keyword(_("graphics"));
G_add_keyword(_("monitors"));
module->description = _("Controls graphics display monitors from the command line.");
start_opt = G_define_option();
start_opt->key = "start";
start_opt->type = TYPE_STRING;
start_opt->description = _("Name of monitor to start");
start_opt->options = "wx0,wx1,wx2,wx3,wx4,wx5,wx6,wx7,png,ps,html,cairo";
start_opt->guisection = _("Manage");
stop_opt = G_define_option();
stop_opt->key = "stop";
stop_opt->type = TYPE_STRING;
stop_opt->description = _("Name of monitor to stop");
stop_opt->options = "wx0,wx1,wx2,wx3,wx4,wx5,wx6,wx7,png,ps,html,cairo";
stop_opt->guisection = _("Manage");
select_opt = G_define_option();
select_opt->key = "select";
select_opt->type = TYPE_STRING;
select_opt->description = _("Name of monitor to select");
select_opt->options = "wx0,wx1,wx2,wx3,wx4,wx5,wx6,wx7,png,ps,html,cairo";
select_opt->guisection = _("Manage");
width_opt = G_define_option();
width_opt->key = "width";
width_opt->label = _("Width for display monitor if not set by GRASS_RENDER_WIDTH");
width_opt->description = _("Default value: 720");
width_opt->type = TYPE_INTEGER;
width_opt->key_desc = "value";
width_opt->guisection = _("Settings");
height_opt = G_define_option();
height_opt->key = "height";
height_opt->label = _("Height for display monitor if not set by GRASS_RENDER_HEIGHT");
height_opt->description = _("Default value: 480");
height_opt->type = TYPE_INTEGER;
height_opt->key_desc = "value";
height_opt->guisection = _("Settings");
res_opt = G_define_option();
res_opt->key = "resolution";
res_opt->label = _("Dimensions of display monitor versus current size");
res_opt->description = _("Example: resolution=2 enlarge display monitor twice to 1280x960");
res_opt->type = TYPE_INTEGER;
res_opt->key_desc = "value";
res_opt->guisection = _("Settings");
bgcolor_opt = G_define_standard_option(G_OPT_CN);
bgcolor_opt->key = "bgcolor";
bgcolor_opt->label = _("Background color");
bgcolor_opt->answer = DEFAULT_BG_COLOR;
bgcolor_opt->guisection = _("Settings");
output_opt = G_define_standard_option(G_OPT_F_OUTPUT);
output_opt->required = NO;
output_opt->label = _("Name for output file (when starting new monitor)");
output_opt->description = _("Ignored for 'wx' monitors");
output_opt->guisection = _("Settings");
list_flag = G_define_flag();
list_flag->key = 'l';
list_flag->description = _("List running monitors and exit");
list_flag->guisection = _("Print");
selected_flag = G_define_flag();
selected_flag->key = 'p';
selected_flag->description = _("Print name of currently selected monitor and exit");
selected_flag->guisection = _("Print");
cmd_flag = G_define_flag();
cmd_flag->key = 'c';
cmd_flag->description = _("Print commands for currently selected monitor and exit");
cmd_flag->guisection = _("Print");
sfile_flag = G_define_flag();
sfile_flag->key = 'g';
sfile_flag->description =
_("Print path to support files of currently selected monitor and exit");
select_flag = G_define_flag();
select_flag->key = 's';
select_flag->description = _("Do not automatically select when starting");
select_flag->guisection = _("Manage");
//.........这里部分代码省略.........
开发者ID:GRASS-GIS, 项目名称:grass-ci, 代码行数:101, 代码来源:main.c
示例6: main
int main(int argc, char *argv[])
{
struct Option *type, *rc_file;
struct Flag *update, *nolaunch;
struct GModule *module;
const char *gui_type_env;
char progname[GPATH_MAX];
char *desc;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("general"));
G_add_keyword(_("gui"));
G_add_keyword(_("user interface"));
module->label =
_("Launches a GRASS graphical user interface (GUI) session.");
module->description = _("And updates default user interface settings.");
type = G_define_option();
type->key = "ui";
type->type = TYPE_STRING;
type->label = _("User interface");
type->description = _("Default value: GRASS_GUI if defined otherwise wxpython");
desc = NULL;
G_asprintf(&desc,
"wxpython;%s;text;%s",
_("wxPython based GUI (wxGUI)"),
_("command line interface only"));
type->descriptions = desc;
type->options = "wxpython,text";
type->guisection = _("Type");
rc_file = G_define_standard_option(G_OPT_F_INPUT);
rc_file->key = "workspace";
rc_file->required = NO;
rc_file->key_desc = "name.gxw";
rc_file->description = _("Name of workspace file to load on start-up (valid only for wxGUI)");
update = G_define_flag();
update->key = 'd';
update->description = _("Update default user interface settings");
update->guisection = _("Default");
nolaunch = G_define_flag();
nolaunch->key = 'n';
nolaunch->description =
_("Do not launch GUI after updating the default user interface settings");
nolaunch->guisection = _("Default");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
if (type->answer && strcmp(type->answer, "text") == 0 &&
!nolaunch->answer)
nolaunch->answer = TRUE;
if (nolaunch->answer && !update->answer)
update->answer = TRUE;
gui_type_env = G__getenv("GUI");
if (!type->answer) {
if (gui_type_env && strcmp(gui_type_env, "text")) {
type->answer = G_store(gui_type_env);
}
else {
type->answer = "wxpython";
}
}
if (((gui_type_env && update->answer) &&
strcmp(gui_type_env, type->answer) != 0) || !gui_type_env) {
G_setenv("GUI", type->answer);
G_message(_("<%s> is now the default GUI"), type->answer);
}
else {
if(update->answer)
if(gui_type_env) {
G_debug(1, "No change: old gui_type_env=[%s], new type->ans=[%s]",
gui_type_env, type->answer);
}
}
if(nolaunch->answer)
exit(EXIT_SUCCESS);
G_message(_("Launching <%s> GUI in the background, please wait..."), type->answer);
if (strcmp(type->answer, "wxpython") == 0) {
sprintf(progname, "%s/gui/wxpython/wxgui.py", G_gisbase());
if (rc_file->answer) {
G_spawn_ex(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), progname,
"--workspace", rc_file->answer, SF_BACKGROUND, NULL);
}
else {
G_spawn_ex(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), progname,
SF_BACKGROUND, NULL);
//.........这里部分代码省略.........
开发者ID:caomw, 项目名称:grass, 代码行数:101, 代码来源:main.c
示例7: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct
{
struct Option *base, *cover, *output;
} parm;
char *basemap, *base_mapset;
char *covermap, *cover_mapset;
char *outmap;
char command[1024];
struct Categories cover_cats;
FILE *stats_fd, *reclass_fd;
int first;
long basecat, covercat, catb, catc;
double area;
struct stats stats;
G_gisinit(argv[0]);
module = G_define_module();
module->keywords = _("raster, statistics");
module->description =
_("Finds the median of values in a cover map within "
"areas assigned the same category value in a "
"user-specified base map.");
parm.base = G_define_standard_option(G_OPT_R_INPUT);
parm.base->key = "base";
parm.base->description = _("Name of base raster map");
parm.cover = G_define_standard_option(G_OPT_R_INPUT);
parm.cover->key = "cover";
parm.cover->description = _("Name of cover raster map");
parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
basemap = parm.base->answer;
covermap = parm.cover->answer;
outmap = parm.output->answer;
base_mapset = G_find_cell2(basemap, "");
if (base_mapset == NULL)
G_fatal_error(_("Base raster map <%s> not found"), basemap);
cover_mapset = G_find_cell2(covermap, "");
if (cover_mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), covermap);
if (G_legal_filename(outmap) < 0)
G_fatal_error(_("<%s> is an illegal file name"), outmap);
if (strcmp(G_mapset(), base_mapset) == 0 && strcmp(basemap, outmap) == 0)
G_fatal_error(_("Base map and output map <%s> must be different"),
outmap);
if (G_read_cats(covermap, cover_mapset, &cover_cats) < 0)
G_fatal_error(_("Unable to read category labels of raster map <%s>"),
covermap);
strcpy(command, "r.stats -an \"");
strcat(command, G_fully_qualified_name(basemap, base_mapset));
strcat(command, ",");
strcat(command, G_fully_qualified_name(covermap, cover_mapset));
strcat(command, "\"");
/* strcpy (command,"cat /tmp/t"); */
G_debug(3, "command: %s", command);
stats_fd = popen(command, "r");
G_debug(3, "r.reclass i=\"%s\" o=\"%s\"",
G_fully_qualified_name(basemap, base_mapset), outmap);
sprintf(command, "r.reclass i=\"%s\" o=\"%s\"",
G_fully_qualified_name(basemap, base_mapset), outmap);
reclass_fd = popen(command, "w");
first = 1;
while (read_stats(stats_fd, &basecat, &covercat, &area)) {
if (first) {
stats.n = 0;
stats.nalloc = 16;
stats.cat = (long *)
G_calloc(stats.nalloc, sizeof(long));
stats.area = (double *)
G_calloc(stats.nalloc, sizeof(double));
first = 0;
catb = basecat;
}
if (basecat != catb) {
catc = median(&stats);
write_reclass(reclass_fd, catb, catc,
G_get_cat(catc, &cover_cats));
catb = basecat;
stats.n = 0;
}
stats.n++;
if (stats.n > stats.nalloc) {
stats.nalloc *= 2;
stats.cat = (long *)
//.........这里部分代码省略.........
开发者ID:imincik, 项目名称:pkg-grass, 代码行数:101, 代码来源:main.c
示例8: main
int main(int argc, char **argv)
{
char title[80];
char buf[80], *p;
struct Ortho_Image_Group group;
struct GModule *module;
struct Option *group_opt;
/* must run in a term window */
G_putenv("GRASS_UI_TERM", "1");
/* initialize grass */
G_gisinit(argv[0]);
module = G_define_module();
module->keywords = _("imagery, orthorectify");
module->description = _("Menu driver for the photo imagery programs.");
group_opt = G_define_standard_option(G_OPT_I_GROUP);
group_opt->description =
_("Name of imagery group for ortho-rectification");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
strncpy(group.name, group_opt->answer, 99);
group.name[99] = '\0';
/* strip off mapset if it's there: I_() fns only work with current mapset */
if ((p = strchr(group.name, '@')))
*p = 0;
/* get and check the group reference files */
if (!I_get_group_ref(group.name, &group.group_ref)) {
G_warning(_("Pre-selected group <%s> not found"), group.name);
/* clean the wrong name in GROUPFILE */
I_put_group("");
/* ask for new group name */
if (!I_ask_group_old(
_("Enter imagery group for ortho-rectification"), group.name))
exit(EXIT_SUCCESS);
I_get_group_ref(group.name, &group.group_ref);
}
if (group.group_ref.nfiles <= 0)
G_fatal_error(_("Group [%s] contains no files"), group.name);
I_put_group(group.name);
while (1) {
if (!I_get_group(group.name)) {
exit(EXIT_SUCCESS);
}
/* print the screen full of options */
sprintf(title, "i.ortho.photo -- \tImagery Group = %s ", group.name);
G_clear_screen();
fprintf(stderr, "%s\n\n", title);
fprintf(stderr, "Initialization Options:\n");
fprintf(stderr, "\n");
fprintf(stderr, " 1. Select/Modify imagery group\n");
fprintf(stderr, " 2. Select/Modify imagery group target\n");
fprintf(stderr, " 3. Select/Modify target elevation model\n");
fprintf(stderr, " 4. Select/Modify imagery group camera\n");
fprintf(stderr, "\n");
fprintf(stderr, "Transformation Parameter Computations:\n");
fprintf(stderr, "\n");
fprintf(stderr, " 5. Compute image-to-photo transformation\n");
fprintf(stderr, " 6. Initialize exposure station parameters\n");
fprintf(stderr, " 7. Compute ortho-rectification parameters\n");
fprintf(stderr, "\n");
fprintf(stderr, "Ortho-rectification Option:\n");
fprintf(stderr, "\n");
fprintf(stderr, " 8. Ortho-rectify imagery files\n");
fprintf(stderr, "\n");
fprintf(stderr, "RETURN exit\n");
fprintf(stderr, "\n> ");
/* Get the option */
if (!G_gets(buf))
continue;
if (*buf == 0) /* exit */
exit(EXIT_SUCCESS);
/* run the program chosen */
G_strip(buf);
fprintf(stderr, "<%s>\n", buf);
if (strcmp(buf, "1") == 0)
run_system("i.group");
if (strcmp(buf, "2") == 0)
run_etc_imagery("i.photo.target", group.name);
if (strcmp(buf, "3") == 0)
run_etc_imagery("i.photo.elev", group.name);
if (strcmp(buf, "4") == 0)
run_etc_imagery("i.photo.camera", group.name);
if (strcmp(buf, "5") == 0)
run_etc_imagery("i.photo.2image", group.name);
if (strcmp(buf, "6") == 0)
//.........这里部分代码省略.........
开发者ID:imincik, 项目名称:pkg-grass, 代码行数:101, 代码来源:menu.c
示例9: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct
{
struct Option *quant, *perc, *slots, *basemap, *covermap, *output;
} opt;
struct {
struct Flag *r, *p;
} flag;
const char *basemap, *covermap;
char **outputs;
int reclass, print;
int cover_fd, base_fd;
struct Range range;
struct FPRange fprange;
int i;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("statistics"));
module->description = _("Compute category quantiles using two passes.");
opt.basemap = G_define_standard_option(G_OPT_R_BASE);
opt.covermap = G_define_standard_option(G_OPT_R_COVER);
opt.quant = G_define_option();
opt.quant->key = "quantiles";
opt.quant->type = TYPE_INTEGER;
opt.quant->required = NO;
opt.quant->description = _("Number of quantiles");
opt.perc = G_define_option();
opt.perc->key = "percentiles";
opt.perc->type = TYPE_DOUBLE;
opt.perc->multiple = YES;
opt.perc->description = _("List of percentiles");
opt.perc->answer = "50";
opt.slots = G_define_option();
opt.slots->key = "bins";
opt.slots->type = TYPE_INTEGER;
opt.slots->required = NO;
opt.slots->description = _("Number of bins to use");
opt.slots->answer = "1000";
opt.output = G_define_standard_option(G_OPT_R_OUTPUT);
opt.output->description = _("Resultant raster map(s)");
opt.output->required = NO;
opt.output->multiple = YES;
flag.r = G_define_flag();
flag.r->key = 'r';
flag.r->description =
_("Create reclass map with statistics as category labels");
flag.p = G_define_flag();
flag.p->key = 'p';
flag.p->description =
_("Do not create output maps; just print statistics");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
basemap = opt.basemap->answer;
covermap = opt.covermap->answer;
outputs = opt.output->answers;
reclass = flag.r->answer;
print = flag.p->answer;
if (!print && !opt.output->answers)
G_fatal_error(_("Either -%c or %s= must be given"),
flag.p->key, opt.output->key);
if (print && opt.output->answers)
G_fatal_error(_("-%c and %s= are mutually exclusive"),
flag.p->key, opt.output->key);
num_slots = atoi(opt.slots->answer);
if (opt.quant->answer) {
num_quants = atoi(opt.quant->answer) - 1;
quants = G_calloc(num_quants, sizeof(DCELL));
for (i = 0; i < num_quants; i++)
quants[i] = 1.0 * (i + 1) / (num_quants + 1);
}
else {
for (i = 0; opt.perc->answers[i]; i++)
;
num_quants = i;
quants = G_calloc(num_quants, sizeof(DCELL));
for (i = 0; i < num_quants; i++)
quants[i] = atof(opt.perc->answers[i]) / 100;
qsort(quants, num_quants, sizeof(DCELL), compare_dcell);
}
if (opt.output->answer) {
//.........这里部分代码省略.........
开发者ID:rashadkm, 项目名称:grass_cmake, 代码行数:101, 代码来源:main.c
示例10: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct {
struct Flag *r, *w, *l, *g, *a, *n, *c;
} flag;
struct {
struct Option *map, *field, *colr, *rast, *volume, *rules,
*attrcol, *rgbcol, *range, *use;
} opt;
int layer;
int overwrite, remove, is_from_stdin, stat, have_colors, convert, use;
const char *mapset, *cmapset;
const char *style, *rules, *cmap, *attrcolumn, *rgbcolumn;
char *name;
struct Map_info Map;
struct FPRange range;
struct Colors colors, colors_tmp;
/* struct Cell_stats statf; */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("vector"));
G_add_keyword(_("color table"));
module->description =
_("Creates/modifies the color table associated with a vector map.");
opt.map = G_define_standard_option(G_OPT_V_MAP);
opt.field = G_define_standard_option(G_OPT_V_FIELD);
opt.use = G_define_option();
opt.use->key = "use";
opt.use->type = TYPE_STRING;
opt.use->required = YES;
opt.use->multiple = NO;
opt.use->options = "attr,cat,z";
opt.use->description = _("Source values");
G_asprintf((char **) &(opt.use->descriptions),
"attr;%s;cat;%s;z;%s",
_("read values from attribute table (requires <column> option)"),
_("use category values"),
_("use z coordinate (3D points or centroids only)"));
opt.use->answer = "cat";
opt.attrcol = G_define_standard_option(G_OPT_DB_COLUMN);
opt.attrcol->label = _("Name of column containing numeric data");
opt.attrcol->description = _("Required for use=attr");
opt.attrcol->guisection = _("Define");
opt.range = G_define_option();
opt.range->key = "range";
opt.range->type = TYPE_DOUBLE;
opt.range->required = NO;
opt.range->label = _("Manually set range (refers to 'column' option)");
opt.range->description = _("Ignored when 'rules' given");
opt.range->key_desc = "min,max";
opt.colr = G_define_standard_option(G_OPT_M_COLR);
opt.colr->guisection = _("Define");
opt.rast = G_define_standard_option(G_OPT_R_INPUT);
opt.rast->key = "raster";
opt.rast->required = NO;
opt.rast->description =
_("Raster map from which to copy color table");
opt.rast->guisection = _("Define");
opt.volume = G_define_standard_option(G_OPT_R3_INPUT);
opt.volume->key = "raster_3d";
opt.volume->required = NO;
opt.volume->description =
_("3D raster map from which to copy color table");
opt.volume->guisection = _("Define");
opt.rules = G_define_standard_option(G_OPT_F_INPUT);
opt.rules->key = "rules";
opt.rules->required = NO;
opt.rules->description = _("Path to rules file");
opt.rules->guisection = _("Define");
opt.rgbcol = G_define_standard_option(G_OPT_DB_COLUMN);
opt.rgbcol->key = "rgb_column";
opt.rgbcol->label = _("Name of color column to populate RGB values");
opt.rgbcol->description = _("If not given writes color table");
flag.r = G_define_flag();
flag.r->key = 'r';
flag.r->description = _("Remove existing color table");
flag.r->guisection = _("Remove");
flag.w = G_define_flag();
flag.w->key = 'w';
flag.w->description =
_("Only write new color table if it does not already exist");
//.........这里部分代码省略.........
开发者ID:GRASS-GIS, 项目名称:grass-ci, 代码行数:101, 代码来源:main.c
示例11: main
/* ************************************************************************* */
int main(int argc, char *argv[])
{
RASTER3D_Region region, inputmap_bounds;
struct Cell_head region2d;
struct GModule *module;
struct History history;
void *map = NULL; /*The 3D Rastermap */
int i = 0, changemask = 0;
int *fd = NULL, output_type, cols, rows;
char *RasterFileName;
int overwrite = 0;
/* Initialize GRASS */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster3d"));
G_add_keyword(_("conversion"));
G_add_keyword(_("raster"));
G_add_keyword(_("voxel"));
module->description = _("Converts 3D raster maps to 2D raster maps");
/* Get parameters from user */
set_params();
/* Have GRASS get inputs */
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
G_debug(3, "Open 3D raster map <%s>", param.input->answer);
if (NULL == G_find_raster3d(param.input->answer, ""))
Rast3d_fatal_error(_("3D raster map <%s> not found"),
param.input->answer);
/*Set the defaults */
Rast3d_init_defaults();
/*Set the resolution of the output maps */
if (param.res->answer) {
/*Open the map with current region */
map = Rast3d_open_cell_old(param.input->answer,
G_find_raster3d(param.input->answer, ""),
RASTER3D_DEFAULT_WINDOW, RASTER3D_TILE_SAME_AS_FILE,
RASTER3D_USE_CACHE_DEFAULT);
if (map == NULL)
Rast3d_fatal_error(_("Unable to open 3D raster map <%s>"),
param.input->answer);
/*Get the region of the map */
Rast3d_get_region_struct_map(map, ®ion);
/*set this region as current 3D window for map */
Rast3d_set_window_map(map, ®ion);
/*Set the 2d region appropriate */
Rast3d_extract2d_region(®ion, ®ion2d);
/*Make the new 2d region the default */
Rast_set_window(®ion2d);
} else {
/* Figure out the region from the map */
Rast3d_get_window(®ion);
/*Open the 3d raster map */
map = Rast3d_open_cell_old(param.input->answer,
G_find_raster3d(param.input->answer, ""),
®ion, RASTER3D_TILE_SAME_AS_FILE,
RASTER3D_USE_CACHE_DEFAULT);
if (map == NULL)
Rast3d_fatal_error(_("Unable to open 3D raster map <%s>"),
param.input->answer);
}
/*Check if the g3d-region is equal to the 2D rows and cols */
rows = Rast_window_rows();
cols = Rast_window_cols();
/*If not equal, set the 3D window correct */
if (rows != region.rows || cols != region.cols) {
G_message(_("The 2D and 3D region settings are different. "
"Using the 2D window settings to adjust the 2D part of the 3D region."));
G_get_set_window(®ion2d);
region.ns_res = region2d.ns_res;
region.ew_res = region2d.ew_res;
region.rows = region2d.rows;
region.cols = region2d.cols;
Rast3d_adjust_region(®ion);
Rast3d_set_window_map(map, ®ion);
}
/* save the input map region for later use (history meta-data) */
Rast3d_get_region_struct_map(map, &inputmap_bounds);
/*Get the output type */
output_type = Rast3d_file_type_map(map);
//.........这里部分代码省略.........
开发者ID:rashadkm, 项目名称:grass_cmake, 代码行数:101, 代码来源:main.c
示例12: main
int main(int argc, char **argv)
{
struct Flag *printattributes, *topo_flag, *shell_flag;
struct Option *map_opt, *field_opt, *coords_opt, *maxdistance;
struct Cell_head window;
struct GModule *module;
char buf[2000];
int i, level, ret;
int *field;
double xval, yval, xres, yres, maxd, x;
double EW_DIST1, EW_DIST2, NS_DIST1, NS_DIST2;
char nsres[30], ewres[30];
char ch;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("vector"));
G_add_keyword(_("position"));
G_add_keyword(_("querying"));
module->description = _("Queries a vector map at given locations.");
map_opt = G_define_standard_option(G_OPT_V_MAPS);
field_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
coords_opt = G_define_standard_option(G_OPT_M_EN);
coords_opt->label = _("Coordinates for query");
coords_opt->description = _("If not given read from standard input");
maxdistance = G_define_option();
maxdistance->type = TYPE_DOUBLE;
maxdistance->key = "distance";
maxdistance->answer = "0";
maxdistance->multiple = NO;
maxdistance->description = _("Query threshold distance");
topo_flag = G_define_flag();
topo_flag->key = 'd';
topo_flag->description = _("Print topological information (debugging)");
topo_flag->guisection = _("Print");
printattributes = G_define_flag();
printattributes->key = 'a';
printattributes->description = _("Print attribute information");
printattributes->guisection = _("Print");
shell_flag = G_define_flag();
shell_flag->key = 'g';
shell_flag->description = _("Print the stats in shell script style");
shell_flag->guisection = _("Print");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
if (map_opt->answers && map_opt->answers[0])
vect = map_opt->answers;
maxd = atof(maxdistance->answer);
/*
* fprintf(stdout, maxdistance->answer);
* fprintf(stdout, "Maxd is %f", maxd);
* fprintf(stdout, xcoord->answer);
* fprintf(stdout, "xval is %f", xval);
* fprintf(stdout, ycoord->answer);
* fprintf(stdout, "yval is %f", yval);
*/
if (maxd == 0.0) {
G_get_window(&window);
x = window.proj;
G_format_resolution(window.ew_res, ewres, x);
G_format_resolution(window.ns_res, nsres, x);
EW_DIST1 =
G_distance(window.east, window.north, window.west, window.north);
/* EW Dist at South Edge */
EW_DIST2 =
G_distance(window.east, window.south, window.west, window.south);
/* NS Dist at East edge */
NS_DIST1 =
G_distance(window.east, window.north, window.east, window.south);
/* NS Dist at West edge */
NS_DIST2 =
G_distance(window.west, window.north, window.west, window.south);
xres = ((EW_DIST1 + EW_DIST2) / 2) / window.cols;
yres = ((NS_DIST1 + NS_DIST2) / 2) / window.rows;
if (xres > yres)
maxd = xres;
else
maxd = yres;
}
/* Look at maps given on command line */
if (vect) {
for (i = 0; vect[i]; i++)
;
nvects = i;
//.........这里部分代码省略.........
开发者ID:AsherBond, 项目名称:MondocosmOS, 代码行数:101, 代码来源:main.c
示例13: main
int main(int argc, char **argv)
{
struct Flag *printattributes, *topo_flag, *shell_flag;
struct Option *opt1, *coords_opt, *maxdistance;
struct Cell_head window;
struct GModule *module;
char *mapset;
char *str;
char buf[2000];
int i, j, level, width = 0, mwidth = 0, ret;
double xval, yval, xres, yres, maxd, x;
double EW_DIST1, EW_DIST2, NS_DIST1, NS_DIST2;
char nsres[30], ewres[30];
char ch;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
module = G_define_module();
module->keywords = _("vector, querying");
module->description = _("Queries a vector map layer at given locations.");
opt1 = G_define_standard_option(G_OPT_V_MAP);
opt1->multiple = YES;
opt1->required = YES;
coords_opt = G_define_option();
coords_opt->key = "east_north";
coords_opt->type = TYPE_DOUBLE;
coords_opt->key_desc = "east,north";
coords_opt->required = NO;
coords_opt->multiple = YES;
coords_opt->label = _("Coordinates for query");
coords_opt->description = _("If not given reads from standard input");
maxdistance = G_define_option();
maxdistance->type = TYPE_DOUBLE;
maxdistance->key = "distance";
maxdistance->answer = "0";
maxdistance->multiple = NO;
maxdistance->description = _("Query threshold distance");
topo_flag = G_define_flag();
topo_flag->key = 'd';
topo_flag->description = _("Print topological information (debugging)");
printattributes = G_define_flag();
printattributes->key = 'a';
printattributes->description = _("Print attribute information");
shell_flag = G_define_flag();
shell_flag->key = 'g';
shell_flag->description = _("Print the stats in shell script style");
if ((argc > 1 || !vect) && G_parser(argc, argv))
exit(EXIT_FAILURE);
if (opt1->answers && opt1->answers[0])
vect = opt1->answers;
maxd = atof(maxdistance->answer);
/*
* fprintf(stdout, maxdistance->answer);
* fprintf(stdout, "Maxd is %f", maxd);
* fprintf(stdout, xcoord->answer);
* fprintf(stdout, "xval is %f", xval);
* fprintf(stdout, ycoord->answer);
* fprintf(stdout, "yval is %f", yval);
*/
if (maxd == 0.0) {
G_get_window(&window);
x = window.proj;
G_format_resolution(window.ew_res, ewres, x);
G_format_resolution(window.ns_res, nsres, x);
EW_DIST1 =
G_distance(window.east, window.north, window.west, window.north);
/* EW Dist at South Edge */
EW_DIST2 =
G_distance(window.east, window.south, window.west, window.south);
/* NS Dist at East edge */
NS_DIST1 =
G_distance(window.east, window.north, window.east, window.south);
/* NS Dist at West edge */
NS_DIST2 =
G_distance(window.west, window.north, window.west, window.south);
xres = ((EW_DIST1 + EW_DIST2) / 2) / window.cols;
yres = ((NS_DIST1 + NS_DIST2) / 2) / window.rows;
if (xres > yres)
maxd = xres;
else
maxd = yres;
}
/* Look at maps given on command line */
if (vect) {
for (i = 0; vect[i]; i++) ;
nvects = i;
//.........这里部分代码省略.........
开发者ID:imincik, 项目名称:pkg-grass, 代码行数:101, 代码来源:main.c
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19189| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9988| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8326| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8696| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8639| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9657| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8624| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7998| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8656| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7535| 2022-11-06
请发表评论