parser_standard_options.c 25 KB

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