GRASS GIS 7 Programmer's Manual  7.2.0(2016)-exported
parser_standard_options.c
Go to the documentation of this file.
1 /*!
2  \file lib/gis/parser_standard_options.c
3 
4  \brief GIS Library - Argument parsing functions (standard options)
5 
6  (C) 2001-2016 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Original author CERL
12  \author Soeren Gebbert added Dec. 2009 WPS process_description document
13  \author Luca Delucchi added Aug 2011 G_OPT_M_DIR
14 */
15 
16 #include <grass/gis.h>
17 #include <grass/glocale.h>
18 
19 #include "parser_local_proto.h"
20 
21 /*!
22  \brief Create standardised Option structure.
23 
24  This function will create a standardised Option structure defined by
25  parameter <i>opt</i>.
26 
27  Valid parameters are defined by the STD_OPT enum in the file gis.h.
28  A list of valid parameter values sorted to groups is below.
29 
30  This function allocates memory for the Option structure and returns a
31  pointer to this memory.
32 
33  If an invalid parameter was specified a empty Option structure will
34  be returned (not NULL).
35 
36 
37  \par List of STD_OPT values sorted by module group
38  - database:
39  - G_OPT_DB_SQL
40  - G_OPT_DB_WHERE
41  - G_OPT_DB_TABLE
42  - G_OPT_DB_DRIVER
43  - G_OPT_DB_DATABASE
44  - G_OPT_DB_SCHEMA
45  - G_OPT_DB_COLUMN
46  - G_OPT_DB_COLUMNS
47  - G_OPT_DB_KEYCOLUMN
48 
49  - imagery:
50  - G_OPT_I_GROUP
51  - G_OPT_I_SUBGROUP
52 
53  - raster:
54  - G_OPT_R_INPUT
55  - G_OPT_R_INPUTS
56  - G_OPT_R_OUTPUT
57  - G_OPT_R_MAP
58  - G_OPT_R_MAPS
59  - G_OPT_R_BASE
60  - G_OPT_R_COVER
61  - G_OPT_R_ELEV
62  - G_OPT_R_ELEVS
63  - G_OPT_R_INTERP_TYPE
64  - G_OPT_R_BASENAME_INPUT
65  - G_OPT_R_BASENAME_OUTPUT
66 
67  - raster3d:
68  - G_OPT_R3_INPUT
69  - G_OPT_R3_INPUTS
70  - G_OPT_R3_OUTPUT
71  - G_OPT_R3_MAP
72  - G_OPT_R3_MAPS
73 
74  - vector:
75  - G_OPT_V_INPUT
76  - G_OPT_V_INPUTS
77  - G_OPT_V_OUTPUT
78  - G_OPT_V_MAP
79  - G_OPT_V_MAPS
80  - G_OPT_V_TYPE
81  - G_OPT_V_FIELD
82  - G_OPT_V_FIELD_ALL
83  - G_OPT_V_CAT
84  - G_OPT_V_CATS
85  - G_OPT_V_ID
86  - G_OPT_V_IDS
87 
88  - files
89  - G_OPT_F_INPUT
90  - G_OPT_F_BIN_INPUT
91  - G_OPT_F_OUTPUT
92  - G_OPT_F_SEP
93 
94  - colors
95  - G_OPT_C
96  - G_OPT_CN
97 
98  - misc
99  - G_OPT_M_DIR
100  - G_OPT_M_UNITS
101  - G_OPT_M_DATATYPE
102  - G_OPT_M_MAPSET
103  - G_OPT_M_LOCATION
104  - G_OPT_M_DBASE
105  - G_OPT_M_COORDS
106  - G_OPT_M_COLR
107  - G_OPT_M_REGION
108  - G_OPT_M_NULL_VALUE
109 
110  - temporal GIS framework
111  - G_OPT_STDS_INPUT
112  - G_OPT_STDS_INPUTS
113  - G_OPT_STDS_OUTPUT
114  - G_OPT_STRDS_INPUT
115  - G_OPT_STRDS_INPUTS
116  - G_OPT_STRDS_OUTPUT
117  - G_OPT_STR3DS_INPUT
118  - G_OPT_STR3DS_INPUTS
119  - G_OPT_STR3DS_OUTPUT
120  - G_OPT_STVDS_INPUT
121  - G_OPT_STVDS_INPUTS
122  - G_OPT_STVDS_OUTPUT
123  - G_OPT_MAP_INPUT
124  - G_OPT_MAP_INPUTS
125  - G_OPT_STDS_TYPE
126  - G_OPT_MAP_TYPE
127  - G_OPT_T_TYPE
128  - G_OPT_T_WHERE
129 
130  \param opt type of Option struct to create specified by STD_OPT enum
131 
132  \return pointer to an Option struct
133 */
134 struct Option *G_define_standard_option(int opt)
135 {
136  struct Option *Opt;
137 
138  Opt = G_define_option();
139 
140  switch (opt) {
141  case G_OPT_DB_SQL:
142  Opt->key = "sql";
143  Opt->type = TYPE_STRING;
144  Opt->key_desc = "sql_query";
145  Opt->required = NO;
146  Opt->label = _("SQL select statement");
147  Opt->description =
148  _("For example: 'select * from rybniky where kapri = 'hodne'");
149  break;
150  case G_OPT_DB_WHERE:
151  Opt->key = "where";
152  Opt->type = TYPE_STRING;
153  Opt->key_desc = "sql_query";
154  Opt->required = NO;
155  Opt->label = _("WHERE conditions of SQL statement without 'where' keyword");
156  Opt->description = _("Example: income < 1000 and inhab >= 10000");
157  break;
158  case G_OPT_DB_TABLE:
159  Opt->key = "table";
160  Opt->type = TYPE_STRING;
161  Opt->key_desc = "name";
162  Opt->required = NO;
163  Opt->multiple = NO;
164  Opt->description = _("Name of attribute table");
165  Opt->gisprompt = "old,dbtable,dbtable";
166  break;
167  case G_OPT_DB_DRIVER:
168  Opt->key = "driver";
169  Opt->type = TYPE_STRING;
170  Opt->key_desc = "name";
171  Opt->required = NO;
172  Opt->multiple = NO;
173  Opt->description = _("Name of database driver");
174  Opt->gisprompt = "old,dbdriver,dbdriver";
175  break;
176  case G_OPT_DB_DATABASE:
177  Opt->key = "database";
178  Opt->type = TYPE_STRING;
179  Opt->key_desc = "name";
180  Opt->required = NO;
181  Opt->multiple = NO;
182  Opt->description = _("Name of database");
183  Opt->gisprompt = "old,dbname,dbname";
184  break;
185  case G_OPT_DB_SCHEMA:
186  Opt->key = "schema";
187  Opt->type = TYPE_STRING;
188  Opt->key_desc = "name";
189  Opt->required = NO;
190  Opt->multiple = NO;
191  Opt->label = _("Database schema");
192  Opt->description = _("Do not use this option if schemas "
193  "are not supported by driver/database server");
194  break;
195  case G_OPT_DB_COLUMN:
196  Opt->key = "column";
197  Opt->type = TYPE_STRING;
198  Opt->key_desc = "name";
199  Opt->required = NO;
200  Opt->multiple = NO;
201  Opt->description = _("Name of attribute column");
202  Opt->gisprompt = "old,dbcolumn,dbcolumn";
203  break;
204  case G_OPT_DB_COLUMNS:
205  Opt->key = "columns";
206  Opt->type = TYPE_STRING;
207  Opt->key_desc = "name";
208  Opt->required = NO;
209  Opt->multiple = YES;
210  Opt->description = _("Name of attribute column(s)");
211  Opt->gisprompt = "old,dbcolumn,dbcolumn";
212  break;
213  case G_OPT_DB_KEYCOLUMN:
214  Opt->key = "key";
215  Opt->type = TYPE_STRING;
216  Opt->key_desc = "name";
217  Opt->required = NO;
218  Opt->multiple = NO;
219  Opt->label = _("Name of key column");
220  Opt->description = _("Must refer to an integer column");
221  /* Opt->gisprompt = "old,dbcolumn,dbcolumn"; */
222  Opt->answer = GV_KEY_COLUMN;
223  break;
224 
225  /* imagery group */
226  case G_OPT_I_GROUP:
227  Opt->key = "group";
228  Opt->type = TYPE_STRING;
229  Opt->key_desc = "name";
230  Opt->required = YES;
231  Opt->gisprompt = "old,group,group";
232  Opt->description = _("Name of input imagery group");
233  break;
234  case G_OPT_I_SUBGROUP:
235  Opt->key = "subgroup";
236  Opt->type = TYPE_STRING;
237  Opt->key_desc = "name";
238  Opt->required = YES;
239  Opt->gisprompt = "old,subgroup,subgroup";
240  Opt->description = _("Name of input imagery subgroup");
241  break;
242 
243  /* raster maps */
244  case G_OPT_R_INPUT:
245  Opt->key = "input";
246  Opt->type = TYPE_STRING;
247  Opt->key_desc = "name";
248  Opt->required = YES;
249  Opt->gisprompt = "old,cell,raster";
250  Opt->description = _("Name of input raster map");
251  break;
252  case G_OPT_R_INPUTS:
253  Opt->key = "input";
254  Opt->type = TYPE_STRING;
255  Opt->key_desc = "name";
256  Opt->required = YES;
257  Opt->multiple = YES;
258  Opt->gisprompt = "old,cell,raster";
259  Opt->description = _("Name of input raster map(s)");
260  break;
261  case G_OPT_R_OUTPUT:
262  Opt->key = "output";
263  Opt->type = TYPE_STRING;
264  Opt->key_desc = "name";
265  Opt->required = YES;
266  Opt->gisprompt = "new,cell,raster";
267  Opt->description = _("Name for output raster map");
268  break;
269  case G_OPT_R_OUTPUTS:
270  Opt->key = "output";
271  Opt->type = TYPE_STRING;
272  Opt->key_desc = "name";
273  Opt->required = YES;
274  Opt->multiple = YES;
275  Opt->gisprompt = "new,cell,raster";
276  Opt->description = _("Name for output raster map(s)");
277  break;
278  case G_OPT_R_MAP:
279  Opt->key = "map";
280  Opt->type = TYPE_STRING;
281  Opt->key_desc = "name";
282  Opt->required = YES;
283  Opt->gisprompt = "old,cell,raster";
284  Opt->description = _("Name of raster map");
285  break;
286  case G_OPT_R_MAPS:
287  Opt->key = "map";
288  Opt->type = TYPE_STRING;
289  Opt->key_desc = "name";
290  Opt->required = YES;
291  Opt->multiple = YES;
292  Opt->gisprompt = "old,cell,raster";
293  Opt->description = _("Name of raster map(s)");
294  break;
295  case G_OPT_R_BASE:
296  Opt->key = "base";
297  Opt->type = TYPE_STRING;
298  Opt->key_desc = "name";
299  Opt->required = YES;
300  Opt->gisprompt = "old,cell,raster";
301  Opt->description = _("Name of base raster map");
302  break;
303  case G_OPT_R_COVER:
304  Opt->key = "cover";
305  Opt->type = TYPE_STRING;
306  Opt->key_desc = "name";
307  Opt->required = YES;
308  Opt->gisprompt = "old,cell,raster";
309  Opt->description = _("Name of cover raster map");
310  break;
311  case G_OPT_R_ELEV:
312  Opt->key = "elevation";
313  Opt->type = TYPE_STRING;
314  Opt->key_desc = "name";
315  Opt->required = YES;
316  Opt->gisprompt = "old,cell,raster";
317  Opt->description = _("Name of input elevation raster map");
318  break;
319  case G_OPT_R_ELEVS:
320  Opt->key = "elevation";
321  Opt->type = TYPE_STRING;
322  Opt->key_desc = "name";
323  Opt->required = YES;
324  Opt->multiple = YES;
325  Opt->gisprompt = "old,cell,raster";
326  Opt->description = _("Name of input elevation raster map(s)");
327  break;
328  case G_OPT_R_INTERP_TYPE:
329  Opt->key = "method";
330  Opt->type = TYPE_STRING;
331  Opt->required = NO;
332  Opt->description = _("Sampling interpolation method");
333  Opt->options = "nearest,bilinear,bicubic";
334  G_asprintf((char **) &(Opt->descriptions),
335  "nearest;%s;bilinear;%s;bicubic;%s",
336  _("Nearest-neighbor interpolation"),
337  _("Bilinear interpolation"),
338  _("Bicubic interpolation"));
339  break;
340  case G_OPT_R_BASENAME_INPUT:
341  Opt->key = "input";
342  Opt->type = TYPE_STRING;
343  Opt->key_desc = "basename";
344  Opt->required = YES;
345  Opt->multiple = NO;
346  Opt->gisprompt = "old,cell,raster";
347  Opt->description = _("Name of input basename raster map(s)");
348  break;
349  case G_OPT_R_BASENAME_OUTPUT:
350  Opt->key = "output";
351  Opt->type = TYPE_STRING;
352  Opt->key_desc = "basename";
353  Opt->required = YES;
354  Opt->multiple = NO;
355  Opt->gisprompt = "new,cell,raster";
356  Opt->description = _("Name for output basename raster map(s)");
357  break;
358 
359  /*g3d maps */
360  case G_OPT_R3_INPUT:
361  Opt->key = "input";
362  Opt->type = TYPE_STRING;
363  Opt->key_desc = "name";
364  Opt->required = YES;
365  Opt->gisprompt = "old,grid3,raster_3d";
366  Opt->description = _("Name of input 3D raster map");
367  break;
368  case G_OPT_R3_INPUTS:
369  Opt->key = "input";
370  Opt->type = TYPE_STRING;
371  Opt->key_desc = "name";
372  Opt->required = YES;
373  Opt->multiple = YES;
374  Opt->gisprompt = "old,grid3,raster_3d";
375  Opt->description = _("Name of input 3D raster map(s)");
376  break;
377  case G_OPT_R3_OUTPUT:
378  Opt->key = "output";
379  Opt->type = TYPE_STRING;
380  Opt->key_desc = "name";
381  Opt->required = YES;
382  Opt->gisprompt = "new,grid3,raster_3d";
383  Opt->description = _("Name for output 3D raster map");
384  break;
385  case G_OPT_R3_MAP:
386  Opt->key = "map";
387  Opt->type = TYPE_STRING;
388  Opt->key_desc = "name";
389  Opt->required = YES;
390  Opt->gisprompt = "old,grid3,raster_3d";
391  Opt->description = _("Name of 3D raster map");
392  break;
393  case G_OPT_R3_MAPS:
394  Opt->key = "map";
395  Opt->type = TYPE_STRING;
396  Opt->key_desc = "name";
397  Opt->required = YES;
398  Opt->multiple = YES;
399  Opt->gisprompt = "old,grid3,raster_3d";
400  Opt->description = _("Name of 3D raster map(s)");
401  break;
402  case G_OPT_R3_TYPE:
403  Opt->key = "type";
404  Opt->type = TYPE_STRING;
405  Opt->required = NO;
406  Opt->multiple = NO;
407  Opt->answer = "default";
408  Opt->options = "default,double,float";
409  Opt->description = _("Data type used in the output raster3d map");
410  break;
411  case G_OPT_R3_PRECISION:
412  Opt->key = "precision";
413  Opt->type = TYPE_STRING;
414  Opt->required = NO;
415  Opt->multiple = NO;
416  Opt->answer = "default";
417  Opt->description =
418  _("Number of digits used as mantissa in the internal map storage, 0 -23 for float, 0 - 52 for double, max or default");
419  break;
420  case G_OPT_R3_COMPRESSION:
421  Opt->key = "compression";
422  Opt->type = TYPE_STRING;
423  Opt->required = NO;
424  Opt->multiple = NO;
425  Opt->answer = "default";
426  Opt->options = "default,zip,none";
427  Opt->description =
428  _("The compression method used in the output raster3d map");
429  break;
430  case G_OPT_R3_TILE_DIMENSION:
431  Opt->key = "tiledimension";
432  Opt->type = TYPE_STRING;
433  Opt->required = NO;
434  Opt->multiple = NO;
435  Opt->key_desc = "XxYxZ";
436  Opt->answer = "default";
437  Opt->description =
438  _("The dimensions of the tiles used in the output raster3d map (XxYxZ or default: 16x16x8)");
439  break;
440 
441  /*vector maps */
442  case G_OPT_V_INPUT:
443  Opt->key = "input";
444  Opt->type = TYPE_STRING;
445  Opt->key_desc = "name";
446  Opt->required = YES;
447  Opt->gisprompt = "old,vector,vector";
448  Opt->label = _("Name of input vector map");
449  Opt->description = _("Or data source for direct OGR access");
450  break;
451  case G_OPT_V_INPUTS:
452  Opt->key = "input";
453  Opt->type = TYPE_STRING;
454  Opt->key_desc = "name";
455  Opt->required = YES;
456  Opt->multiple = YES;
457  Opt->gisprompt = "old,vector,vector";
458  Opt->label = _("Name of input vector map(s)");
459  Opt->description = _("Or data source(s) for direct OGR access");
460  break;
461  case G_OPT_V_OUTPUT:
462  Opt->key = "output";
463  Opt->type = TYPE_STRING;
464  Opt->key_desc = "name";
465  Opt->required = YES;
466  Opt->gisprompt = "new,vector,vector";
467  Opt->description = _("Name for output vector map");
468  break;
469  case G_OPT_V_MAP:
470  Opt->key = "map";
471  Opt->type = TYPE_STRING;
472  Opt->key_desc = "name";
473  Opt->required = YES;
474  Opt->gisprompt = "old,vector,vector";
475  Opt->label = _("Name of vector map");
476  Opt->description = _("Or data source for direct OGR access");
477  break;
478  case G_OPT_V_MAPS:
479  Opt->key = "map";
480  Opt->type = TYPE_STRING;
481  Opt->key_desc = "name";
482  Opt->required = YES;
483  Opt->multiple = YES;
484  Opt->gisprompt = "old,vector,vector";
485  Opt->description = _("Name of vector map(s)");
486  break;
487  case G_OPT_V_TYPE:
488  Opt->key = "type";
489  Opt->type = TYPE_STRING;
490  Opt->required = NO;
491  Opt->multiple = YES;
492  Opt->answer = "point,line,boundary,centroid,area";
493  Opt->options = "point,line,boundary,centroid,area";
494  Opt->description = _("Input feature type");
495  break;
496  case G_OPT_V3_TYPE:
497  Opt->key = "type";
498  Opt->type = TYPE_STRING;
499  Opt->required = NO;
500  Opt->multiple = YES;
501  Opt->answer = "point,line,boundary,centroid,area,face,kernel";
502  Opt->options = "point,line,boundary,centroid,area,face,kernel";
503  Opt->description = _("Input feature type");
504  break;
505  case G_OPT_V_FIELD:
506  Opt->key = "layer";
507  Opt->type = TYPE_STRING;
508  Opt->required = NO;
509  Opt->answer = "1";
510  Opt->label = _("Layer number or name");
511  Opt->description =
512  _("Vector features can have category values in different layers."
513  " This number determines which layer to use. "
514  "When used with direct OGR access this is the layer name.");
515  Opt->gisprompt = "old,layer,layer";
516  break;
517  case G_OPT_V_FIELD_ALL:
518  Opt->key = "layer";
519  Opt->type = TYPE_STRING;
520  Opt->required = NO;
521  Opt->answer = "-1";
522  Opt->label = _("Layer number or name ('-1' for all layers)");
523  Opt->description =
524  _("A single vector map can be connected to multiple database "
525  "tables. This number determines which table to use. "
526  "When used with direct OGR access this is the layer name.");
527  Opt->gisprompt = "old,layer_all,layer";
528  break;
529  case G_OPT_V_CAT:
530  Opt->key = "cat";
531  Opt->type = TYPE_INTEGER;
532  Opt->required = NO;
533  Opt->description = _("Category value");
534  Opt->gisprompt = "old,cat,cats";
535  break;
536  case G_OPT_V_CATS:
537  Opt->key = "cats";
538  Opt->type = TYPE_STRING;
539  Opt->key_desc = "range";
540  Opt->required = NO;
541  Opt->label = _("Category values");
542  Opt->description = _("Example: 1,3,7-9,13");
543  Opt->gisprompt = "old,cats,cats";
544  break;
545  case G_OPT_V_ID:
546  Opt->key = "id";
547  Opt->type = TYPE_INTEGER;
548  Opt->required = NO;
549  Opt->description = _("Feature id");
550  break;
551  case G_OPT_V_IDS:
552  Opt->key = "ids";
553  Opt->type = TYPE_STRING;
554  Opt->key_desc = "range";
555  Opt->required = NO;
556  Opt->label = _("Feature ids");
557  Opt->description = _("Example: 1,3,7-9,13");
558  break;
559 
560  /* files */
561  case G_OPT_F_INPUT:
562  Opt->key = "input";
563  Opt->type = TYPE_STRING;
564  Opt->key_desc = "name";
565  Opt->required = YES;
566  Opt->gisprompt = "old,file,file";
567  Opt->description = _("Name of input file");
568  break;
569  case G_OPT_F_BIN_INPUT:
570  Opt->key = "input";
571  Opt->type = TYPE_STRING;
572  Opt->key_desc = "name";
573  Opt->required = YES;
574  Opt->gisprompt = "old,bin,file";
575  Opt->description = _("Name of input file");
576  break;
577  case G_OPT_F_OUTPUT:
578  Opt->key = "output";
579  Opt->type = TYPE_STRING;
580  Opt->key_desc = "name";
581  Opt->required = YES;
582  Opt->gisprompt = "new,file,file";
583  Opt->description = _("Name for output file");
584  break;
585  case G_OPT_F_SEP:
586  Opt->key = "separator";
587  Opt->type = TYPE_STRING;
588  Opt->key_desc = "character";
589  Opt->required = NO;
590  Opt->gisprompt = "old,separator,separator";
591  Opt->answer = "pipe";
592  Opt->label = _("Field separator");
593  Opt->description = _("Special characters: pipe, comma, space, tab, newline");
594  break;
595 
596  /* colors */
597  case G_OPT_C:
598  Opt->key = "color";
599  Opt->type = TYPE_STRING;
600  Opt->key_desc = "name";
601  Opt->required = NO;
602  Opt->answer = DEFAULT_FG_COLOR;
603  Opt->gisprompt = "old,color,color";
604  Opt->label = _("Color");
605  Opt->description =
606  _("Either a standard color name or R:G:B triplet");
607  break;
608  case G_OPT_CN:
609  Opt->key = "color";
610  Opt->type = TYPE_STRING;
611  Opt->key_desc = "name";
612  Opt->required = NO;
613  Opt->answer = DEFAULT_FG_COLOR;
614  Opt->gisprompt = "old,color_none,color";
615  Opt->label = _("Color");
616  Opt->description =
617  _("Either a standard color name, R:G:B triplet, or \"none\"");
618  break;
619 
620  /* misc */
621 
622  case G_OPT_M_DIR:
623  Opt->key = "input";
624  Opt->type = TYPE_STRING;
625  Opt->key_desc = "name";
626  Opt->required = YES;
627  Opt->gisprompt = "old,dir,dir";
628  Opt->description = _("Name of input directory");
629  break;
630 
631  case G_OPT_M_UNITS:
632  Opt->key = "units";
633  Opt->type = TYPE_STRING;
634  Opt->required = NO;
635  Opt->multiple = NO;
636  Opt->options =
637  "miles,feet,meters,kilometers,acres,hectares";
638  Opt->description = _("Units");
639  break;
640 
641  case G_OPT_M_DATATYPE:
642  Opt->key = "type";
643  Opt->key_desc = "datatype";
644  Opt->type = TYPE_STRING;
645  Opt->required = YES;
646  Opt->multiple = YES;
647  Opt->description = _("Data type(s)");
648  break;
649 
650  case G_OPT_M_MAPSET:
651  Opt->key = "mapset";
652  Opt->type = TYPE_STRING;
653  Opt->required = NO;
654  Opt->multiple = NO;
655  Opt->key_desc = "name";
656  Opt->gisprompt = "old,mapset,mapset";
657  Opt->label = _("Name of mapset (default: current search path)");
658  Opt->description = _("'.' for current mapset");
659  break;
660 
661  case G_OPT_M_LOCATION:
662  Opt->key = "location";
663  Opt->type = TYPE_STRING;
664  Opt->required = NO;
665  Opt->multiple = NO;
666  Opt->label = _("Location name");
667  Opt->description = _("Location name (not location path)");
668  Opt->gisprompt = "old,location,location";
669  Opt->key_desc = "name";
670  break;
671 
672  case G_OPT_M_DBASE:
673  Opt->key = "dbase";
674  Opt->type = TYPE_STRING;
675  Opt->required = NO;
676  Opt->multiple = NO;
677  Opt->label = _("GRASS GIS database directory");
678  Opt->description = _("Default: path to the current GRASS GIS database");
679  Opt->gisprompt = "old,dbase,dbase";
680  Opt->key_desc = "path";
681  break;
682 
683  case G_OPT_M_COORDS:
684  Opt->key = "coordinates";
685  Opt->type = TYPE_DOUBLE;
686  Opt->required = NO;
687  Opt->multiple = NO;
688  Opt->key_desc = "east,north";
689  Opt->gisprompt = "old,coords,coords";
690  Opt->description = _("Coordinates");
691  break;
692 
693  case G_OPT_M_COLR:
694  Opt->key = "color";
695  Opt->key_desc = "style";
696  Opt->type = TYPE_STRING;
697  Opt->required = NO;
698  Opt->options = G_color_rules_options();
699  Opt->description = _("Name of color table");
700  Opt->descriptions = G_color_rules_descriptions();
701  Opt->gisprompt = "old,colortable,colortable";
702  break;
703 
704  case G_OPT_M_NULL_VALUE:
705  Opt->key = "null_value";
706  Opt->key_desc = "string";
707  Opt->type = TYPE_STRING;
708  Opt->required = NO;
709  Opt->multiple = NO;
710  Opt->description = _("String representing NULL value");
711  break;
712 
713  case G_OPT_M_REGION:
714  Opt->key = "region";
715  Opt->type = TYPE_STRING;
716  Opt->key_desc = "name";
717  Opt->required = NO;
718  Opt->gisprompt = "old,windows,region";
719  Opt->description = _("Name of saved region");
720  break;
721 
722  /* Spatio-temporal modules of the temporal GIS framework */
723  case G_OPT_STDS_INPUT:
724  Opt->key = "input";
725  Opt->type = TYPE_STRING;
726  Opt->key_desc = "name";
727  Opt->required = YES;
728  Opt->gisprompt = "old,stds,stds";
729  Opt->description = _("Name of the input space time dataset");
730  break;
731  case G_OPT_STDS_INPUTS:
732  Opt->key = "inputs";
733  Opt->type = TYPE_STRING;
734  Opt->key_desc = "name";
735  Opt->required = YES;
736  Opt->multiple = YES;
737  Opt->gisprompt = "old,stds,stds";
738  Opt->description = _("Name of the input space time datasets");
739  break;
740  case G_OPT_STDS_OUTPUT:
741  Opt->key = "output";
742  Opt->type = TYPE_STRING;
743  Opt->key_desc = "name";
744  Opt->required = YES;
745  Opt->gisprompt = "new,stds,stds";
746  Opt->description = _("Name of the output space time dataset");
747  break;
748  case G_OPT_STRDS_INPUT:
749  Opt->key = "input";
750  Opt->type = TYPE_STRING;
751  Opt->key_desc = "name";
752  Opt->required = YES;
753  Opt->gisprompt = "old,strds,strds";
754  Opt->description = _("Name of the input space time raster dataset");
755  break;
756  case G_OPT_STRDS_INPUTS:
757  Opt->key = "inputs";
758  Opt->type = TYPE_STRING;
759  Opt->key_desc = "name";
760  Opt->required = YES;
761  Opt->multiple = YES;
762  Opt->gisprompt = "old,strds,strds";
763  Opt->description = _("Name of the input space time raster datasets");
764  break;
765  case G_OPT_STRDS_OUTPUT:
766  Opt->key = "output";
767  Opt->type = TYPE_STRING;
768  Opt->key_desc = "name";
769  Opt->required = YES;
770  Opt->gisprompt = "new,strds,strds";
771  Opt->description = _("Name of the output space time raster dataset");
772  break;
773  case G_OPT_STVDS_INPUT:
774  Opt->key = "input";
775  Opt->type = TYPE_STRING;
776  Opt->key_desc = "name";
777  Opt->required = YES;
778  Opt->gisprompt = "old,stvds,stvds";
779  Opt->description = _("Name of the input space time vector dataset");
780  break;
781  case G_OPT_STVDS_INPUTS:
782  Opt->key = "inputs";
783  Opt->type = TYPE_STRING;
784  Opt->key_desc = "name";
785  Opt->required = YES;
786  Opt->multiple = YES;
787  Opt->gisprompt = "old,stvds,stvds";
788  Opt->description = _("Name of the input space time vector datasets");
789  break;
790  case G_OPT_STVDS_OUTPUT:
791  Opt->key = "output";
792  Opt->type = TYPE_STRING;
793  Opt->key_desc = "name";
794  Opt->required = YES;
795  Opt->gisprompt = "new,stvds,stvds";
796  Opt->description = _("Name of the output space time vector dataset");
797  break;
798  case G_OPT_STR3DS_INPUT:
799  Opt->key = "input";
800  Opt->type = TYPE_STRING;
801  Opt->key_desc = "name";
802  Opt->required = YES;
803  Opt->gisprompt = "old,str3ds,str3ds";
804  Opt->description = _("Name of the input space time raster3d dataset");
805  break;
806  case G_OPT_STR3DS_INPUTS:
807  Opt->key = "inputs";
808  Opt->type = TYPE_STRING;
809  Opt->key_desc = "name";
810  Opt->required = YES;
811  Opt->multiple = YES;
812  Opt->gisprompt = "old,str3ds,str3ds";
813  Opt->description = _("Name of the input space time raster3d datasets");
814  break;
815  case G_OPT_STR3DS_OUTPUT:
816  Opt->key = "output";
817  Opt->type = TYPE_STRING;
818  Opt->key_desc = "name";
819  Opt->required = YES;
820  Opt->gisprompt = "new,str3ds,str3ds";
821  Opt->description = _("Name of the output space time raster3d dataset");
822  break;
823  case G_OPT_STDS_TYPE:
824  Opt->key = "type";
825  Opt->type = TYPE_STRING;
826  Opt->key_desc = "name";
827  Opt->required = NO;
828  Opt->answer = "strds";
829  Opt->options = "strds,stvds,str3ds";
830  Opt->description = _("Type of the input space time dataset");
831  break;
832  case G_OPT_MAP_INPUT:
833  Opt->key = "map";
834  Opt->type = TYPE_STRING;
835  Opt->key_desc = "name";
836  Opt->required = YES;
837  Opt->gisprompt = "old,map,map";
838  Opt->description = _("Name of the input map");
839  break;
840  case G_OPT_MAP_INPUTS:
841  Opt->key = "maps";
842  Opt->type = TYPE_STRING;
843  Opt->key_desc = "name";
844  Opt->required = YES;
845  Opt->multiple = YES;
846  Opt->gisprompt = "old,map,map";
847  Opt->description = _("Name of the input maps");
848  break;
849  case G_OPT_MAP_TYPE:
850  Opt->key = "type";
851  Opt->type = TYPE_STRING;
852  Opt->key_desc = "name";
853  Opt->required = NO;
854  Opt->answer = "raster";
855  Opt->options = "raster,vector,raster_3d";
856  Opt->description = _("Type of the input map");
857  break;
858  case G_OPT_T_TYPE:
859  Opt->key = "temporaltype";
860  Opt->type = TYPE_STRING;
861  Opt->key_desc = "name";
862  Opt->required = NO;
863  Opt->answer = "absolute";
864  Opt->options = "absolute,relative";
865  Opt->description = _("The temporal type of the space time dataset");
866  break;
867  case G_OPT_T_WHERE:
868  Opt->key = "where";
869  Opt->type = TYPE_STRING;
870  Opt->key_desc = "sql_query";
871  Opt->required = NO;
872  Opt->label = _("WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework");
873  Opt->description = _("Example: start_time > '2001-01-01 12:30:00'");
874  break;
875  case G_OPT_T_SAMPLE:
876  Opt->key = "sampling";
877  Opt->type = TYPE_STRING;
878  Opt->key_desc = "name";
879  Opt->required = NO;
880  Opt->multiple = YES;
881  Opt->answer = "start";
882  Opt->options = "start,during,overlap,contain,equal,follows,precedes";
883  Opt->description = _("The method to be used for sampling the input dataset");
884  break;
885  }
886 
887  return Opt;
888 }
889 
890 /*!
891  \brief Create standardised Flag structure.
892 
893  This function will create a standardised Flag structure defined by
894  parameter <i>flag</i>. A list of valid parameters below. It
895  allocates memory for the Flag structure and returns a pointer to
896  this memory.
897 
898  If an invalid parameter was specified a empty Flag structure will be
899  returned (not NULL).
900 
901  - G_FLG_V_TABLE (do not create attribute table)
902  - G_FLG_V_TOPO (do not build topology)
903 
904  \param flag type of Flag struct to create specified by STD_FLG enum.
905 
906  \return pointer to an Flag struct
907 */
908 struct Flag *G_define_standard_flag(int flag)
909 {
910  struct Flag *Flg;
911 
912  Flg = G_define_flag();
913 
914  switch (flag) {
915  case G_FLG_V_TABLE:
916  Flg->key = 't';
917  Flg->description = _("Do not create attribute table");
918  break;
919  case G_FLG_V_TOPO:
920  Flg->key = 'b';
921  Flg->label = _("Do not build topology");
922  Flg->description = _("Advantageous when handling a large number of points");
923  break;
924  }
925 
926  return Flg;
927 }
struct Option * G_define_standard_option(int opt)
Create standardised Option structure.
int G_asprintf(char **out, const char *fmt,...)
Definition: asprintf.c:70
struct Flag * G_define_standard_flag(int flag)
Create standardised Flag structure.
struct Flag * G_define_flag(void)
Initializes a Flag struct.
Definition: parser.c:156
struct Option * G_define_option(void)
Initializes an Option struct.
Definition: parser.c:210
char * G_color_rules_descriptions(void)
Get color rules description for Option->descriptions.
Definition: color_rules.c:63
char * G_color_rules_options(void)
Get list of color rules for Option->options.
Definition: color_rules.c:25