parser_standard_options.c 24 KB

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