parser_standard_options.c 25 KB

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