parser_standard_options.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  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_OUTPUTS:
  240. Opt->key = "output";
  241. Opt->type = TYPE_STRING;
  242. Opt->key_desc = "name";
  243. Opt->required = YES;
  244. Opt->multiple = YES;
  245. Opt->gisprompt = "new,cell,raster";
  246. Opt->description = _("Name for output raster map(s)");
  247. break;
  248. case G_OPT_R_MAP:
  249. Opt->key = "map";
  250. Opt->type = TYPE_STRING;
  251. Opt->key_desc = "name";
  252. Opt->required = YES;
  253. Opt->gisprompt = "old,cell,raster";
  254. Opt->description = _("Name of raster map");
  255. break;
  256. case G_OPT_R_MAPS:
  257. Opt->key = "map";
  258. Opt->type = TYPE_STRING;
  259. Opt->key_desc = "name";
  260. Opt->required = YES;
  261. Opt->multiple = YES;
  262. Opt->gisprompt = "old,cell,raster";
  263. Opt->description = _("Name of raster map(s)");
  264. break;
  265. case G_OPT_R_BASE:
  266. Opt->key = "base";
  267. Opt->type = TYPE_STRING;
  268. Opt->key_desc = "name";
  269. Opt->required = YES;
  270. Opt->gisprompt = "old,cell,raster";
  271. Opt->description = _("Name of base raster map");
  272. break;
  273. case G_OPT_R_COVER:
  274. Opt->key = "cover";
  275. Opt->type = TYPE_STRING;
  276. Opt->key_desc = "name";
  277. Opt->required = YES;
  278. Opt->gisprompt = "old,cell,raster";
  279. Opt->description = _("Name of cover raster map");
  280. break;
  281. case G_OPT_R_ELEV:
  282. Opt->key = "elevation";
  283. Opt->type = TYPE_STRING;
  284. Opt->key_desc = "name";
  285. Opt->required = YES;
  286. Opt->gisprompt = "old,cell,raster";
  287. Opt->description = _("Name of input elevation raster map");
  288. break;
  289. case G_OPT_R_ELEVS:
  290. Opt->key = "elevation";
  291. Opt->type = TYPE_STRING;
  292. Opt->key_desc = "name";
  293. Opt->required = YES;
  294. Opt->multiple = YES;
  295. Opt->gisprompt = "old,cell,raster";
  296. Opt->description = _("Name of input elevation raster map(s)");
  297. break;
  298. case G_OPT_R_INTERP_TYPE:
  299. Opt->key = "method";
  300. Opt->type = TYPE_STRING;
  301. Opt->required = NO;
  302. Opt->description = _("Sampling interpolation method");
  303. Opt->options = "nearest,bilinear,bicubic";
  304. G_asprintf((char **) &(Opt->descriptions),
  305. "nearest;%s;bilinear;%s;bicubic;%s",
  306. _("Nearest-neighbor interpolation"),
  307. _("Bilinear interpolation"),
  308. _("Bicubic interpolation"));
  309. break;
  310. case G_OPT_R_BASENAME_INPUT:
  311. Opt->key = "input";
  312. Opt->type = TYPE_STRING;
  313. Opt->key_desc = "basename";
  314. Opt->required = YES;
  315. Opt->multiple = NO;
  316. Opt->gisprompt = "old,cell,raster";
  317. Opt->description = _("Name of input basename raster map(s)");
  318. break;
  319. case G_OPT_R_BASENAME_OUTPUT:
  320. Opt->key = "output";
  321. Opt->type = TYPE_STRING;
  322. Opt->key_desc = "basename";
  323. Opt->required = YES;
  324. Opt->multiple = NO;
  325. Opt->gisprompt = "new,cell,raster";
  326. Opt->description = _("Name for output basename raster map(s)");
  327. break;
  328. /*g3d maps */
  329. case G_OPT_R3_INPUT:
  330. Opt->key = "input";
  331. Opt->type = TYPE_STRING;
  332. Opt->key_desc = "name";
  333. Opt->required = YES;
  334. Opt->gisprompt = "old,grid3,3d-raster";
  335. Opt->description = _("Name of input 3D raster map");
  336. break;
  337. case G_OPT_R3_INPUTS:
  338. Opt->key = "input";
  339. Opt->type = TYPE_STRING;
  340. Opt->key_desc = "name";
  341. Opt->required = YES;
  342. Opt->multiple = YES;
  343. Opt->gisprompt = "old,grid3,3d-raster";
  344. Opt->description = _("Name of input 3D raster map(s)");
  345. break;
  346. case G_OPT_R3_OUTPUT:
  347. Opt->key = "output";
  348. Opt->type = TYPE_STRING;
  349. Opt->key_desc = "name";
  350. Opt->required = YES;
  351. Opt->gisprompt = "new,grid3,3d-raster";
  352. Opt->description = _("Name for output 3D raster map");
  353. break;
  354. case G_OPT_R3_MAP:
  355. Opt->key = "map";
  356. Opt->type = TYPE_STRING;
  357. Opt->key_desc = "name";
  358. Opt->required = YES;
  359. Opt->gisprompt = "old,grid3,3d-raster";
  360. Opt->description = _("Name of 3D raster map");
  361. break;
  362. case G_OPT_R3_MAPS:
  363. Opt->key = "map";
  364. Opt->type = TYPE_STRING;
  365. Opt->key_desc = "name";
  366. Opt->required = YES;
  367. Opt->multiple = YES;
  368. Opt->gisprompt = "old,grid3,3d-raster";
  369. Opt->description = _("Name of 3D raster map(s)");
  370. break;
  371. case G_OPT_R3_TYPE:
  372. Opt->key = "type";
  373. Opt->type = TYPE_STRING;
  374. Opt->required = NO;
  375. Opt->multiple = NO;
  376. Opt->answer = "default";
  377. Opt->options = "default,double,float";
  378. Opt->description = _("Data type used in the output raster3d map");
  379. break;
  380. case G_OPT_R3_PRECISION:
  381. Opt->key = "precision";
  382. Opt->type = TYPE_STRING;
  383. Opt->required = NO;
  384. Opt->multiple = NO;
  385. Opt->answer = "default";
  386. Opt->description =
  387. _("Number of digits used as mantissa in the internal map storage, 0 -23 for float, 0 - 52 for double, max or default");
  388. break;
  389. case G_OPT_R3_COMPRESSION:
  390. Opt->key = "compression";
  391. Opt->type = TYPE_STRING;
  392. Opt->required = NO;
  393. Opt->multiple = NO;
  394. Opt->answer = "default";
  395. Opt->options = "default,zip,none";
  396. Opt->description =
  397. _("The compression method used in the output raster3d map");
  398. break;
  399. case G_OPT_R3_TILE_DIMENSION:
  400. Opt->key = "tiledimension";
  401. Opt->type = TYPE_STRING;
  402. Opt->required = NO;
  403. Opt->multiple = NO;
  404. Opt->key_desc = "XxYxZ";
  405. Opt->answer = "default";
  406. Opt->description =
  407. _("The dimensions of the tiles used in the output raster3d map (XxYxZ or default: 16x16x8)");
  408. break;
  409. /*vector maps */
  410. case G_OPT_V_INPUT:
  411. Opt->key = "input";
  412. Opt->type = TYPE_STRING;
  413. Opt->key_desc = "name";
  414. Opt->required = YES;
  415. Opt->gisprompt = "old,vector,vector";
  416. Opt->label = _("Name of input vector map");
  417. Opt->description = _("Or data source for direct OGR access");
  418. break;
  419. case G_OPT_V_INPUTS:
  420. Opt->key = "input";
  421. Opt->type = TYPE_STRING;
  422. Opt->key_desc = "name";
  423. Opt->required = YES;
  424. Opt->multiple = YES;
  425. Opt->gisprompt = "old,vector,vector";
  426. Opt->label = _("Name of input vector map(s)");
  427. Opt->description = _("Or data source(s) for direct OGR access");
  428. break;
  429. case G_OPT_V_OUTPUT:
  430. Opt->key = "output";
  431. Opt->type = TYPE_STRING;
  432. Opt->key_desc = "name";
  433. Opt->required = YES;
  434. Opt->gisprompt = "new,vector,vector";
  435. Opt->description = _("Name for output vector map");
  436. break;
  437. case G_OPT_V_MAP:
  438. Opt->key = "map";
  439. Opt->type = TYPE_STRING;
  440. Opt->key_desc = "name";
  441. Opt->required = YES;
  442. Opt->gisprompt = "old,vector,vector";
  443. Opt->label = _("Name of vector map");
  444. Opt->description = _("Or data source for direct OGR access");
  445. break;
  446. case G_OPT_V_MAPS:
  447. Opt->key = "map";
  448. Opt->type = TYPE_STRING;
  449. Opt->key_desc = "name";
  450. Opt->required = YES;
  451. Opt->multiple = YES;
  452. Opt->gisprompt = "old,vector,vector";
  453. Opt->description = _("Name of vector map(s)");
  454. break;
  455. case G_OPT_V_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";
  461. Opt->options = "point,line,boundary,centroid,area";
  462. Opt->description = _("Input feature type");
  463. break;
  464. case G_OPT_V3_TYPE:
  465. Opt->key = "type";
  466. Opt->type = TYPE_STRING;
  467. Opt->required = NO;
  468. Opt->multiple = YES;
  469. Opt->answer = "point,line,boundary,centroid,area,face,kernel";
  470. Opt->options = "point,line,boundary,centroid,area,face,kernel";
  471. Opt->description = _("Input feature type");
  472. break;
  473. case G_OPT_V_FIELD:
  474. Opt->key = "layer";
  475. Opt->type = TYPE_STRING;
  476. Opt->required = NO;
  477. Opt->answer = "1";
  478. Opt->label = _("Layer number or name");
  479. Opt->description =
  480. _("Vector features can have category values in different layers."
  481. " This number determines which layer to use. "
  482. "When used with direct OGR access this is the layer name.");
  483. Opt->gisprompt = "old,layer,layer";
  484. break;
  485. case G_OPT_V_FIELD_ALL:
  486. Opt->key = "layer";
  487. Opt->type = TYPE_STRING;
  488. Opt->required = NO;
  489. Opt->answer = "-1";
  490. Opt->label = _("Layer number or name ('-1' for all layers)");
  491. Opt->description =
  492. _("A single vector map can be connected to multiple database "
  493. "tables. This number determines which table to use. "
  494. "When used with direct OGR access this is the layer name.");
  495. Opt->gisprompt = "old,layer_all,layer";
  496. break;
  497. case G_OPT_V_CAT:
  498. Opt->key = "cat";
  499. Opt->type = TYPE_INTEGER;
  500. Opt->required = NO;
  501. Opt->description = _("Category value");
  502. break;
  503. case G_OPT_V_CATS:
  504. Opt->key = "cats";
  505. Opt->type = TYPE_STRING;
  506. Opt->key_desc = "range";
  507. Opt->required = NO;
  508. Opt->label = _("Category values");
  509. Opt->description = _("Example: 1,3,7-9,13");
  510. break;
  511. case G_OPT_V_ID:
  512. Opt->key = "id";
  513. Opt->type = TYPE_INTEGER;
  514. Opt->required = NO;
  515. Opt->description = _("Feature id");
  516. break;
  517. case G_OPT_V_IDS:
  518. Opt->key = "ids";
  519. Opt->type = TYPE_STRING;
  520. Opt->key_desc = "range";
  521. Opt->required = NO;
  522. Opt->label = _("Feature ids");
  523. Opt->description = _("Example: 1,3,7-9,13");
  524. break;
  525. /* files */
  526. case G_OPT_F_INPUT:
  527. Opt->key = "input";
  528. Opt->type = TYPE_STRING;
  529. Opt->key_desc = "name";
  530. Opt->required = YES;
  531. Opt->gisprompt = "old,file,file";
  532. Opt->description = _("Name of input file");
  533. break;
  534. case G_OPT_F_OUTPUT:
  535. Opt->key = "output";
  536. Opt->type = TYPE_STRING;
  537. Opt->key_desc = "name";
  538. Opt->required = YES;
  539. Opt->gisprompt = "new,file,file";
  540. Opt->description = _("Name for output file");
  541. break;
  542. case G_OPT_F_SEP:
  543. Opt->key = "separator";
  544. Opt->type = TYPE_STRING;
  545. Opt->key_desc = "character";
  546. Opt->required = NO;
  547. Opt->gisprompt = "old,separator,separator";
  548. Opt->answer = "pipe";
  549. Opt->label = _("Field separator");
  550. Opt->description = _("Special characters: pipe, comma, space, tab, newline");
  551. break;
  552. /* colors */
  553. case G_OPT_C_FG:
  554. Opt->key = "color";
  555. Opt->type = TYPE_STRING;
  556. Opt->key_desc = "name";
  557. Opt->required = NO;
  558. Opt->answer = DEFAULT_FG_COLOR;
  559. Opt->gisprompt = "old,color,color";
  560. Opt->label = _("Color");
  561. Opt->description =
  562. _("Either a standard color name, R:G:B triplet, or \"none\"");
  563. break;
  564. case G_OPT_C_BG:
  565. Opt->key = "bgcolor";
  566. Opt->type = TYPE_STRING;
  567. Opt->key_desc = "name";
  568. Opt->required = NO;
  569. Opt->answer = DEFAULT_BG_COLOR;
  570. Opt->gisprompt = "old,color_none,color";
  571. Opt->label = _("Background color");
  572. Opt->description =
  573. _("Either a standard color name, R:G:B triplet, or \"none\"");
  574. break;
  575. /* misc */
  576. case G_OPT_M_DIR:
  577. Opt->key = "input";
  578. Opt->type = TYPE_STRING;
  579. Opt->key_desc = "name";
  580. Opt->required = YES;
  581. Opt->gisprompt = "old,dir,dir";
  582. Opt->description = _("Name of input directory");
  583. break;
  584. case G_OPT_M_UNITS:
  585. Opt->key = "units";
  586. Opt->type = TYPE_STRING;
  587. Opt->required = NO;
  588. Opt->multiple = NO;
  589. Opt->options =
  590. "miles,feet,meters,kilometers,acres,hectares";
  591. Opt->description = _("Units");
  592. break;
  593. case G_OPT_M_DATATYPE:
  594. Opt->key = "type";
  595. Opt->key_desc = "datatype";
  596. Opt->type = TYPE_STRING;
  597. Opt->required = YES;
  598. Opt->multiple = YES;
  599. Opt->description = _("Data type(s)");
  600. break;
  601. case G_OPT_M_MAPSET:
  602. Opt->key = "mapset";
  603. Opt->type = TYPE_STRING;
  604. Opt->required = NO;
  605. Opt->multiple = NO;
  606. Opt->key_desc = "name";
  607. Opt->gisprompt = "old,mapset,mapset";
  608. Opt->label = _("Name of mapset (default: current search path)");
  609. Opt->description = _("'.' for current mapset");
  610. break;
  611. case G_OPT_M_COORDS:
  612. Opt->key = "coordinates";
  613. Opt->type = TYPE_DOUBLE;
  614. Opt->required = NO;
  615. Opt->multiple = NO;
  616. Opt->key_desc = "east,north";
  617. Opt->gisprompt = "old,coords,coords";
  618. Opt->description = _("Coordinates");
  619. break;
  620. case G_OPT_M_COLR:
  621. Opt->key = "color";
  622. Opt->key_desc = "style";
  623. Opt->type = TYPE_STRING;
  624. Opt->required = NO;
  625. Opt->options = G_color_rules_options();
  626. Opt->description = _("Name of color table");
  627. Opt->descriptions = G_color_rules_descriptions();
  628. Opt->gisprompt = "old,colortable,colortable";
  629. break;
  630. case G_OPT_M_NULL_VALUE:
  631. Opt->key = "null_value";
  632. Opt->key_desc = "string";
  633. Opt->type = TYPE_STRING;
  634. Opt->required = NO;
  635. Opt->multiple = NO;
  636. Opt->description = _("String representing NULL value data cell");
  637. break;
  638. case G_OPT_M_REGION:
  639. Opt->key = "region";
  640. Opt->type = TYPE_STRING;
  641. Opt->key_desc = "name";
  642. Opt->required = NO;
  643. Opt->gisprompt = "old,windows,region";
  644. Opt->description = _("Name of saved region");
  645. break;
  646. /* Spatio-temporal modules of the temporal GIS framework */
  647. case G_OPT_STDS_INPUT:
  648. Opt->key = "input";
  649. Opt->type = TYPE_STRING;
  650. Opt->key_desc = "name";
  651. Opt->required = YES;
  652. Opt->gisprompt = "old,stds,stds";
  653. Opt->description = _("Name of the input space time dataset");
  654. break;
  655. case G_OPT_STDS_INPUTS:
  656. Opt->key = "inputs";
  657. Opt->type = TYPE_STRING;
  658. Opt->key_desc = "name";
  659. Opt->required = YES;
  660. Opt->multiple = YES;
  661. Opt->gisprompt = "old,stds,stds";
  662. Opt->description = _("Name of the input space time datasets");
  663. break;
  664. case G_OPT_STDS_OUTPUT:
  665. Opt->key = "output";
  666. Opt->type = TYPE_STRING;
  667. Opt->key_desc = "name";
  668. Opt->required = YES;
  669. Opt->gisprompt = "new,stds,stds";
  670. Opt->description = _("Name of the output space time dataset");
  671. break;
  672. case G_OPT_STRDS_INPUT:
  673. Opt->key = "input";
  674. Opt->type = TYPE_STRING;
  675. Opt->key_desc = "name";
  676. Opt->required = YES;
  677. Opt->gisprompt = "old,strds,strds";
  678. Opt->description = _("Name of the input space time raster dataset");
  679. break;
  680. case G_OPT_STRDS_INPUTS:
  681. Opt->key = "inputs";
  682. Opt->type = TYPE_STRING;
  683. Opt->key_desc = "name";
  684. Opt->required = YES;
  685. Opt->multiple = YES;
  686. Opt->gisprompt = "old,strds,strds";
  687. Opt->description = _("Name of the input space time raster datasets");
  688. break;
  689. case G_OPT_STRDS_OUTPUT:
  690. Opt->key = "output";
  691. Opt->type = TYPE_STRING;
  692. Opt->key_desc = "name";
  693. Opt->required = YES;
  694. Opt->gisprompt = "new,strds,strds";
  695. Opt->description = _("Name of the output space time raster dataset");
  696. break;
  697. case G_OPT_STVDS_INPUT:
  698. Opt->key = "input";
  699. Opt->type = TYPE_STRING;
  700. Opt->key_desc = "name";
  701. Opt->required = YES;
  702. Opt->gisprompt = "old,stvds,stvds";
  703. Opt->description = _("Name of the input space time vector dataset");
  704. break;
  705. case G_OPT_STVDS_INPUTS:
  706. Opt->key = "inputs";
  707. Opt->type = TYPE_STRING;
  708. Opt->key_desc = "name";
  709. Opt->required = YES;
  710. Opt->multiple = YES;
  711. Opt->gisprompt = "old,stvds,stvds";
  712. Opt->description = _("Name of the input space time vector datasets");
  713. break;
  714. case G_OPT_STVDS_OUTPUT:
  715. Opt->key = "output";
  716. Opt->type = TYPE_STRING;
  717. Opt->key_desc = "name";
  718. Opt->required = YES;
  719. Opt->gisprompt = "new,stvds,stvds";
  720. Opt->description = _("Name of the output space time vector dataset");
  721. break;
  722. case G_OPT_STR3DS_INPUT:
  723. Opt->key = "input";
  724. Opt->type = TYPE_STRING;
  725. Opt->key_desc = "name";
  726. Opt->required = YES;
  727. Opt->gisprompt = "old,str3ds,str3ds";
  728. Opt->description = _("Name of the input space time raster3d dataset");
  729. break;
  730. case G_OPT_STR3DS_INPUTS:
  731. Opt->key = "inputs";
  732. Opt->type = TYPE_STRING;
  733. Opt->key_desc = "name";
  734. Opt->required = YES;
  735. Opt->multiple = YES;
  736. Opt->gisprompt = "old,str3ds,str3ds";
  737. Opt->description = _("Name of the input space time raster3d datasets");
  738. break;
  739. case G_OPT_STR3DS_OUTPUT:
  740. Opt->key = "output";
  741. Opt->type = TYPE_STRING;
  742. Opt->key_desc = "name";
  743. Opt->required = YES;
  744. Opt->gisprompt = "new,str3ds,str3ds";
  745. Opt->description = _("Name of the output space time raster3d dataset");
  746. break;
  747. case G_OPT_STDS_TYPE:
  748. Opt->key = "type";
  749. Opt->type = TYPE_STRING;
  750. Opt->key_desc = "name";
  751. Opt->required = NO;
  752. Opt->answer = "strds";
  753. Opt->options = "strds,stvds,str3ds";
  754. Opt->description = _("Type of the input space time dataset");
  755. break;
  756. case G_OPT_MAP_INPUT:
  757. Opt->key = "map";
  758. Opt->type = TYPE_STRING;
  759. Opt->key_desc = "name";
  760. Opt->required = YES;
  761. Opt->gisprompt = "old,map,map";
  762. Opt->description = _("Name of the input map");
  763. break;
  764. case G_OPT_MAP_INPUTS:
  765. Opt->key = "maps";
  766. Opt->type = TYPE_STRING;
  767. Opt->key_desc = "name";
  768. Opt->required = YES;
  769. Opt->multiple = YES;
  770. Opt->gisprompt = "old,map,map";
  771. Opt->description = _("Name of the input maps");
  772. break;
  773. case G_OPT_MAP_TYPE:
  774. Opt->key = "type";
  775. Opt->type = TYPE_STRING;
  776. Opt->key_desc = "name";
  777. Opt->required = NO;
  778. Opt->answer = "rast";
  779. Opt->options = "rast,vect,rast3d";
  780. Opt->description = _("Type of the input map");
  781. break;
  782. case G_OPT_T_TYPE:
  783. Opt->key = "temporaltype";
  784. Opt->type = TYPE_STRING;
  785. Opt->key_desc = "name";
  786. Opt->required = NO;
  787. Opt->answer = "absolute";
  788. Opt->options = "absolute,relative";
  789. Opt->description = _("The temporal type of the space time dataset");
  790. break;
  791. case G_OPT_T_WHERE:
  792. Opt->key = "where";
  793. Opt->type = TYPE_STRING;
  794. Opt->key_desc = "sql_query";
  795. Opt->required = NO;
  796. Opt->label = _("WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework");
  797. Opt->description = _("Example: start_time > '2001-01-01 12:30:00'");
  798. break;
  799. case G_OPT_T_SAMPLE:
  800. Opt->key = "sampling";
  801. Opt->type = TYPE_STRING;
  802. Opt->key_desc = "name";
  803. Opt->required = NO;
  804. Opt->multiple = YES;
  805. Opt->answer = "start";
  806. Opt->options = "start,during,overlap,contain,equal,follows,precedes";
  807. Opt->description = _("The method to be used for sampling the input dataset");
  808. break;
  809. }
  810. return Opt;
  811. }
  812. /*!
  813. \brief Create standardised Flag structure.
  814. This function will create a standardised Flag structure defined by
  815. parameter <i>flag</i>. A list of valid parameters bellow. It
  816. allocates memory for the Flag structure and returns a pointer to
  817. this memory.
  818. If an invalid parameter was specified a empty Flag structure will be
  819. returned (not NULL).
  820. - G_FLG_V_TABLE (do not create attribute table)
  821. - G_FLG_V_TOPO (do not build topology)
  822. \param flag type of Flag struct to create specified by STD_FLG enum.
  823. \return pointer to an Flag struct
  824. */
  825. struct Flag *G_define_standard_flag(int flag)
  826. {
  827. struct Flag *Flg;
  828. Flg = G_define_flag();
  829. switch (flag) {
  830. case G_FLG_V_TABLE:
  831. Flg->key = 't';
  832. Flg->description = _("Do not create attribute table");
  833. break;
  834. case G_FLG_V_TOPO:
  835. Flg->key = 'b';
  836. Flg->description = _("Do not build topology");
  837. break;
  838. }
  839. return Flg;
  840. }