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