parser_standard_options.c 24 KB

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