parser_standard_options.c 24 KB

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