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