parser_standard_options.c 23 KB

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