parser_standard_options.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  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
  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_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. Opt->gisprompt = "old,cat,cats";
  504. break;
  505. case G_OPT_V_CATS:
  506. Opt->key = "cats";
  507. Opt->type = TYPE_STRING;
  508. Opt->key_desc = "range";
  509. Opt->required = NO;
  510. Opt->label = _("Category values");
  511. Opt->description = _("Example: 1,3,7-9,13");
  512. Opt->gisprompt = "old,cats,cats";
  513. break;
  514. case G_OPT_V_ID:
  515. Opt->key = "id";
  516. Opt->type = TYPE_INTEGER;
  517. Opt->required = NO;
  518. Opt->description = _("Feature id");
  519. break;
  520. case G_OPT_V_IDS:
  521. Opt->key = "ids";
  522. Opt->type = TYPE_STRING;
  523. Opt->key_desc = "range";
  524. Opt->required = NO;
  525. Opt->label = _("Feature ids");
  526. Opt->description = _("Example: 1,3,7-9,13");
  527. break;
  528. /* files */
  529. case G_OPT_F_INPUT:
  530. Opt->key = "input";
  531. Opt->type = TYPE_STRING;
  532. Opt->key_desc = "name";
  533. Opt->required = YES;
  534. Opt->gisprompt = "old,file,file";
  535. Opt->description = _("Name of input file");
  536. break;
  537. case G_OPT_F_BIN_INPUT:
  538. Opt->key = "input";
  539. Opt->type = TYPE_STRING;
  540. Opt->key_desc = "name";
  541. Opt->required = YES;
  542. Opt->gisprompt = "old,bin,file";
  543. Opt->description = _("Name of input file");
  544. break;
  545. case G_OPT_F_OUTPUT:
  546. Opt->key = "output";
  547. Opt->type = TYPE_STRING;
  548. Opt->key_desc = "name";
  549. Opt->required = YES;
  550. Opt->gisprompt = "new,file,file";
  551. Opt->description = _("Name for output file");
  552. break;
  553. case G_OPT_F_SEP:
  554. Opt->key = "separator";
  555. Opt->type = TYPE_STRING;
  556. Opt->key_desc = "character";
  557. Opt->required = NO;
  558. Opt->gisprompt = "old,separator,separator";
  559. Opt->answer = "pipe";
  560. Opt->label = _("Field separator");
  561. Opt->description = _("Special characters: pipe, comma, space, tab, newline");
  562. break;
  563. /* colors */
  564. case G_OPT_C:
  565. Opt->key = "color";
  566. Opt->type = TYPE_STRING;
  567. Opt->key_desc = "name";
  568. Opt->required = NO;
  569. Opt->answer = DEFAULT_FG_COLOR;
  570. Opt->gisprompt = "old,color,color";
  571. Opt->label = _("Color");
  572. Opt->description =
  573. _("Either a standard color name or R:G:B triplet");
  574. break;
  575. case G_OPT_CN:
  576. Opt->key = "color";
  577. Opt->type = TYPE_STRING;
  578. Opt->key_desc = "name";
  579. Opt->required = NO;
  580. Opt->answer = DEFAULT_FG_COLOR;
  581. Opt->gisprompt = "old,color_none,color";
  582. Opt->label = _("Color");
  583. Opt->description =
  584. _("Either a standard color name, R:G:B triplet, or \"none\"");
  585. break;
  586. /* misc */
  587. case G_OPT_M_DIR:
  588. Opt->key = "input";
  589. Opt->type = TYPE_STRING;
  590. Opt->key_desc = "name";
  591. Opt->required = YES;
  592. Opt->gisprompt = "old,dir,dir";
  593. Opt->description = _("Name of input directory");
  594. break;
  595. case G_OPT_M_UNITS:
  596. Opt->key = "units";
  597. Opt->type = TYPE_STRING;
  598. Opt->required = NO;
  599. Opt->multiple = NO;
  600. Opt->options =
  601. "miles,feet,meters,kilometers,acres,hectares";
  602. Opt->description = _("Units");
  603. break;
  604. case G_OPT_M_DATATYPE:
  605. Opt->key = "type";
  606. Opt->key_desc = "datatype";
  607. Opt->type = TYPE_STRING;
  608. Opt->required = YES;
  609. Opt->multiple = YES;
  610. Opt->description = _("Data type(s)");
  611. break;
  612. case G_OPT_M_MAPSET:
  613. Opt->key = "mapset";
  614. Opt->type = TYPE_STRING;
  615. Opt->required = NO;
  616. Opt->multiple = NO;
  617. Opt->key_desc = "name";
  618. Opt->gisprompt = "old,mapset,mapset";
  619. Opt->label = _("Name of mapset (default: current search path)");
  620. Opt->description = _("'.' for current mapset");
  621. break;
  622. case G_OPT_M_COORDS:
  623. Opt->key = "coordinates";
  624. Opt->type = TYPE_DOUBLE;
  625. Opt->required = NO;
  626. Opt->multiple = NO;
  627. Opt->key_desc = "east,north";
  628. Opt->gisprompt = "old,coords,coords";
  629. Opt->description = _("Coordinates");
  630. break;
  631. case G_OPT_M_COLR:
  632. Opt->key = "color";
  633. Opt->key_desc = "style";
  634. Opt->type = TYPE_STRING;
  635. Opt->required = NO;
  636. Opt->options = G_color_rules_options();
  637. Opt->description = _("Name of color table");
  638. Opt->descriptions = G_color_rules_descriptions();
  639. Opt->gisprompt = "old,colortable,colortable";
  640. break;
  641. case G_OPT_M_NULL_VALUE:
  642. Opt->key = "null_value";
  643. Opt->key_desc = "string";
  644. Opt->type = TYPE_STRING;
  645. Opt->required = NO;
  646. Opt->multiple = NO;
  647. Opt->description = _("String representing NULL value");
  648. break;
  649. case G_OPT_M_REGION:
  650. Opt->key = "region";
  651. Opt->type = TYPE_STRING;
  652. Opt->key_desc = "name";
  653. Opt->required = NO;
  654. Opt->gisprompt = "old,windows,region";
  655. Opt->description = _("Name of saved region");
  656. break;
  657. /* Spatio-temporal modules of the temporal GIS framework */
  658. case G_OPT_STDS_INPUT:
  659. Opt->key = "input";
  660. Opt->type = TYPE_STRING;
  661. Opt->key_desc = "name";
  662. Opt->required = YES;
  663. Opt->gisprompt = "old,stds,stds";
  664. Opt->description = _("Name of the input space time dataset");
  665. break;
  666. case G_OPT_STDS_INPUTS:
  667. Opt->key = "inputs";
  668. Opt->type = TYPE_STRING;
  669. Opt->key_desc = "name";
  670. Opt->required = YES;
  671. Opt->multiple = YES;
  672. Opt->gisprompt = "old,stds,stds";
  673. Opt->description = _("Name of the input space time datasets");
  674. break;
  675. case G_OPT_STDS_OUTPUT:
  676. Opt->key = "output";
  677. Opt->type = TYPE_STRING;
  678. Opt->key_desc = "name";
  679. Opt->required = YES;
  680. Opt->gisprompt = "new,stds,stds";
  681. Opt->description = _("Name of the output space time dataset");
  682. break;
  683. case G_OPT_STRDS_INPUT:
  684. Opt->key = "input";
  685. Opt->type = TYPE_STRING;
  686. Opt->key_desc = "name";
  687. Opt->required = YES;
  688. Opt->gisprompt = "old,strds,strds";
  689. Opt->description = _("Name of the input space time raster dataset");
  690. break;
  691. case G_OPT_STRDS_INPUTS:
  692. Opt->key = "inputs";
  693. Opt->type = TYPE_STRING;
  694. Opt->key_desc = "name";
  695. Opt->required = YES;
  696. Opt->multiple = YES;
  697. Opt->gisprompt = "old,strds,strds";
  698. Opt->description = _("Name of the input space time raster datasets");
  699. break;
  700. case G_OPT_STRDS_OUTPUT:
  701. Opt->key = "output";
  702. Opt->type = TYPE_STRING;
  703. Opt->key_desc = "name";
  704. Opt->required = YES;
  705. Opt->gisprompt = "new,strds,strds";
  706. Opt->description = _("Name of the output space time raster dataset");
  707. break;
  708. case G_OPT_STVDS_INPUT:
  709. Opt->key = "input";
  710. Opt->type = TYPE_STRING;
  711. Opt->key_desc = "name";
  712. Opt->required = YES;
  713. Opt->gisprompt = "old,stvds,stvds";
  714. Opt->description = _("Name of the input space time vector dataset");
  715. break;
  716. case G_OPT_STVDS_INPUTS:
  717. Opt->key = "inputs";
  718. Opt->type = TYPE_STRING;
  719. Opt->key_desc = "name";
  720. Opt->required = YES;
  721. Opt->multiple = YES;
  722. Opt->gisprompt = "old,stvds,stvds";
  723. Opt->description = _("Name of the input space time vector datasets");
  724. break;
  725. case G_OPT_STVDS_OUTPUT:
  726. Opt->key = "output";
  727. Opt->type = TYPE_STRING;
  728. Opt->key_desc = "name";
  729. Opt->required = YES;
  730. Opt->gisprompt = "new,stvds,stvds";
  731. Opt->description = _("Name of the output space time vector dataset");
  732. break;
  733. case G_OPT_STR3DS_INPUT:
  734. Opt->key = "input";
  735. Opt->type = TYPE_STRING;
  736. Opt->key_desc = "name";
  737. Opt->required = YES;
  738. Opt->gisprompt = "old,str3ds,str3ds";
  739. Opt->description = _("Name of the input space time raster3d dataset");
  740. break;
  741. case G_OPT_STR3DS_INPUTS:
  742. Opt->key = "inputs";
  743. Opt->type = TYPE_STRING;
  744. Opt->key_desc = "name";
  745. Opt->required = YES;
  746. Opt->multiple = YES;
  747. Opt->gisprompt = "old,str3ds,str3ds";
  748. Opt->description = _("Name of the input space time raster3d datasets");
  749. break;
  750. case G_OPT_STR3DS_OUTPUT:
  751. Opt->key = "output";
  752. Opt->type = TYPE_STRING;
  753. Opt->key_desc = "name";
  754. Opt->required = YES;
  755. Opt->gisprompt = "new,str3ds,str3ds";
  756. Opt->description = _("Name of the output space time raster3d dataset");
  757. break;
  758. case G_OPT_STDS_TYPE:
  759. Opt->key = "type";
  760. Opt->type = TYPE_STRING;
  761. Opt->key_desc = "name";
  762. Opt->required = NO;
  763. Opt->answer = "strds";
  764. Opt->options = "strds,stvds,str3ds";
  765. Opt->description = _("Type of the input space time dataset");
  766. break;
  767. case G_OPT_MAP_INPUT:
  768. Opt->key = "map";
  769. Opt->type = TYPE_STRING;
  770. Opt->key_desc = "name";
  771. Opt->required = YES;
  772. Opt->gisprompt = "old,map,map";
  773. Opt->description = _("Name of the input map");
  774. break;
  775. case G_OPT_MAP_INPUTS:
  776. Opt->key = "maps";
  777. Opt->type = TYPE_STRING;
  778. Opt->key_desc = "name";
  779. Opt->required = YES;
  780. Opt->multiple = YES;
  781. Opt->gisprompt = "old,map,map";
  782. Opt->description = _("Name of the input maps");
  783. break;
  784. case G_OPT_MAP_TYPE:
  785. Opt->key = "type";
  786. Opt->type = TYPE_STRING;
  787. Opt->key_desc = "name";
  788. Opt->required = NO;
  789. Opt->answer = "raster";
  790. Opt->options = "raster,vector,raster_3d";
  791. Opt->description = _("Type of the input map");
  792. break;
  793. case G_OPT_T_TYPE:
  794. Opt->key = "temporaltype";
  795. Opt->type = TYPE_STRING;
  796. Opt->key_desc = "name";
  797. Opt->required = NO;
  798. Opt->answer = "absolute";
  799. Opt->options = "absolute,relative";
  800. Opt->description = _("The temporal type of the space time dataset");
  801. break;
  802. case G_OPT_T_WHERE:
  803. Opt->key = "where";
  804. Opt->type = TYPE_STRING;
  805. Opt->key_desc = "sql_query";
  806. Opt->required = NO;
  807. Opt->label = _("WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework");
  808. Opt->description = _("Example: start_time > '2001-01-01 12:30:00'");
  809. break;
  810. case G_OPT_T_SAMPLE:
  811. Opt->key = "sampling";
  812. Opt->type = TYPE_STRING;
  813. Opt->key_desc = "name";
  814. Opt->required = NO;
  815. Opt->multiple = YES;
  816. Opt->answer = "start";
  817. Opt->options = "start,during,overlap,contain,equal,follows,precedes";
  818. Opt->description = _("The method to be used for sampling the input dataset");
  819. break;
  820. }
  821. return Opt;
  822. }
  823. /*!
  824. \brief Create standardised Flag structure.
  825. This function will create a standardised Flag structure defined by
  826. parameter <i>flag</i>. A list of valid parameters bellow. It
  827. allocates memory for the Flag structure and returns a pointer to
  828. this memory.
  829. If an invalid parameter was specified a empty Flag structure will be
  830. returned (not NULL).
  831. - G_FLG_V_TABLE (do not create attribute table)
  832. - G_FLG_V_TOPO (do not build topology)
  833. \param flag type of Flag struct to create specified by STD_FLG enum.
  834. \return pointer to an Flag struct
  835. */
  836. struct Flag *G_define_standard_flag(int flag)
  837. {
  838. struct Flag *Flg;
  839. Flg = G_define_flag();
  840. switch (flag) {
  841. case G_FLG_V_TABLE:
  842. Flg->key = 't';
  843. Flg->description = _("Do not create attribute table");
  844. break;
  845. case G_FLG_V_TOPO:
  846. Flg->key = 'b';
  847. Flg->description = _("Do not build topology");
  848. break;
  849. }
  850. return Flg;
  851. }