args.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #include <grass/gis.h>
  2. #include <grass/vector.h>
  3. #include <grass/glocale.h>
  4. #include "proto.h"
  5. void parse_options(struct GParm *parm, struct GFlag *flag)
  6. {
  7. char *desc;
  8. parm->input[0] = G_define_standard_option(G_OPT_V_INPUT);
  9. parm->input[0]->description = _("Input vector map from which to select features (A)");
  10. parm->input[0]->key = "ainput";
  11. parm->field[0] = G_define_standard_option(G_OPT_V_FIELD);
  12. parm->field[0]->label = _("Layer number (vector map A)");
  13. parm->field[0]->key = "alayer";
  14. parm->field[0]->guisection = _("Selection");
  15. parm->type[0] = G_define_standard_option(G_OPT_V_TYPE);
  16. parm->type[0]->label = _("Feature type (vector map A)");
  17. parm->type[0]->key = "atype";
  18. parm->type[0]->answer = "point,line,area";
  19. parm->type[0]->guisection = _("Selection");
  20. parm->input[1] = G_define_standard_option(G_OPT_V_INPUT);
  21. parm->input[1]->description = _("Query vector map (B)");
  22. parm->input[1]->key = "binput";
  23. parm->field[1] = G_define_standard_option(G_OPT_V_FIELD);
  24. parm->field[1]->label = _("Layer number (vector map B)");
  25. parm->field[1]->key = "blayer";
  26. parm->field[1]->guisection = _("Selection");
  27. parm->type[1] = G_define_standard_option(G_OPT_V_TYPE);
  28. parm->type[1]->label = _("Feature type (vector map B)");
  29. parm->type[1]->key = "btype";
  30. parm->type[1]->answer = "point,line,area";
  31. parm->type[1]->guisection = _("Selection");
  32. parm->output = G_define_standard_option(G_OPT_V_OUTPUT);
  33. parm->operator = G_define_option();
  34. parm->operator->key = "operator";
  35. parm->operator->type = TYPE_STRING;
  36. parm->operator->required = YES;
  37. parm->operator->multiple = NO;
  38. parm->operator->label =
  39. _("Operator defines required relation between features");
  40. parm->operator->description =
  41. _("A feature is written to output if the result of operation 'ainput operator binput' is true. "
  42. "An input feature is considered to be true, if category of given layer is defined.");
  43. parm->operator->answer = "overlap";
  44. desc = NULL;
  45. #ifndef HAVE_GEOS
  46. parm->operator->options = "overlap";
  47. G_asprintf(&desc,
  48. "overlap;%s",
  49. _("features partially or completely overlap"));
  50. parm->operator->descriptions = desc;
  51. parm->relate = NULL;
  52. #else
  53. G_asprintf(&desc,
  54. "overlap;%s;"
  55. "equals;%s;"
  56. "disjoint;%s;"
  57. "intersects;%s;"
  58. "touches;%s;"
  59. "crosses;%s;"
  60. "within;%s;"
  61. "contains;%s;"
  62. "overlaps;%s;"
  63. "relate;%s;",
  64. _("features partially or completely overlap"),
  65. _("features are spatially equals (using GEOS)"),
  66. _("features do not spatially intersect (using GEOS)"),
  67. _("features spatially intersect (using GEOS)"),
  68. _("features spatially touches (using GEOS)"),
  69. _("features spatially crosses (using GEOS)"),
  70. _("feature A is completely inside feature B (using GEOS)"),
  71. _("feature B is completely inside feature A (using GEOS)"),
  72. _("features spatially overlap (using GEOS)"),
  73. _("feature A is spatially related to feature B (using GEOS, "
  74. "requires 'relate' option)"));
  75. parm->operator->options = "overlap,equals,disjoint,intersects,touches,crosses,within,contains,overlaps,relate";
  76. parm->operator->descriptions = desc;
  77. parm->relate = G_define_option();
  78. parm->relate->key = "relate";
  79. parm->relate->type = TYPE_STRING;
  80. parm->relate->required = NO;
  81. parm->relate->multiple = NO;
  82. parm->relate->description = _("Intersection Matrix Pattern used for 'relate' operator");
  83. #endif
  84. flag->table = G_define_standard_flag(G_FLG_V_TABLE);
  85. flag->cat = G_define_flag();
  86. flag->cat->key = 'c';
  87. flag->cat->description = _("Do not skip features without category");
  88. flag->reverse = G_define_flag();
  89. flag->reverse->key = 'r';
  90. flag->reverse->description = _("Reverse selection");
  91. flag->reverse->guisection = _("Selection");
  92. }