本文整理汇总了C++中G_define_option函数的典型用法代码示例。如果您正苦于以下问题:C++ G_define_option函数的具体用法?C++ G_define_option怎么用?C++ G_define_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_define_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
//.........这里部分代码省略.........
示例2: main
int 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();
//.........这里部分代码省略.........
示例3: main
int 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;
//.........这里部分代码省略.........
示例4: main
int 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);
//.........这里部分代码省略.........
示例5: user_input
void 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;
//.........这里部分代码省略.........
示例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;
//.........这里部分代码省略.........
示例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;
}
示例8: main
int 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 */
//.........这里部分代码省略.........
示例9: main
int 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");
//.........这里部分代码省略.........
示例10: main
int 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);
//.........这里部分代码省略.........
示例11: main
int 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))
//.........这里部分代码省略.........
示例12: main
int 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);
}
示例13: main
int 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);
//.........这里部分代码省略.........
示例14: main
int 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);
//.........这里部分代码省略.........
示例15: main
int 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 */
//.........这里部分代码省略.........