فهرست منبع

gislib: add G_OPT_V_ID(S)
(merge from devbr6, https://trac.osgeo.org/grass/changeset/34673)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@34674 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 سال پیش
والد
کامیت
46d729c785
4فایلهای تغییر یافته به همراه21 افزوده شده و 26 حذف شده
  1. 2 0
      include/gis.h
  2. 14 0
      lib/gis/parser.c
  3. 2 5
      vector/v.category/main.c
  4. 3 21
      vector/v.edit/args.c

+ 2 - 0
include/gis.h

@@ -190,6 +190,8 @@ static const char *GRASS_copyright __attribute__ ((unused))
     G_OPT_V_FIELD,		/* layer number (layers used to be called fields) */
     G_OPT_V_CAT,		/* one category */
     G_OPT_V_CATS,		/* more categories */
+    G_OPT_V_ID, 		/* one feature id */
+    G_OPT_V_IDS,		/* more feature ids */
 
     G_OPT_F_INPUT,		/* old input file */
     G_OPT_F_OUTPUT,		/* new output file */

+ 14 - 0
lib/gis/parser.c

@@ -622,6 +622,20 @@ struct Option *G_define_standard_option(int opt)
 	Opt->label = _("Category values");
 	Opt->description = _("Example: 1,3,7-9,13");
 	break;
+    case G_OPT_V_ID:
+	Opt->key = "id";
+	Opt->type = TYPE_INTEGER;
+	Opt->required = NO;
+	Opt->description = _("Feature id");
+	break;
+    case G_OPT_V_IDS:
+	Opt->key = "ids";
+	Opt->type = TYPE_STRING;
+	Opt->key_desc = "range";
+	Opt->required = NO;
+	Opt->label = _("Feature ids");
+	Opt->description = _("Example: 1,3,7-9,13");
+	break;
 
 	/* files */
     case G_OPT_F_INPUT:

+ 2 - 5
vector/v.category/main.c

@@ -96,11 +96,8 @@ int main(int argc, char *argv[])
     field_opt->multiple = YES;
     field_opt->guisection = _("Selection");
 
-    id_opt = G_define_standard_option(G_OPT_V_CAT);
-    id_opt->multiple = YES;
-    id_opt->label = _("Feature id(s)");
-    id_opt->description = _("By default all ids are processed");
-    id_opt->key = "id";
+    id_opt = G_define_standard_option(G_OPT_V_IDS);
+    id_opt->label = _("Feature ids (by default all features are processed)");
     id_opt->guisection = _("Selection");
 
     cat_opt = G_define_standard_option(G_OPT_V_CAT);

+ 3 - 21
vector/v.edit/args.c

@@ -38,6 +38,7 @@ int parser(int argc, char *argv[], struct GParams *params,
     params->map->description = _("Name of vector map to edit");
 
     params->fld = G_define_standard_option(G_OPT_V_FIELD);
+    params->fld->gisprompt = "new_layer,layer,layer";
     params->fld->guisection = _("Selection");
 
     params->type = G_define_standard_option(G_OPT_V_TYPE);
@@ -120,13 +121,9 @@ int parser(int argc, char *argv[], struct GParams *params,
 	_("'-1' for threshold based on the current resolution settings");
     params->maxdist->answer = "-1,0,0";
 
-    params->id = G_define_standard_option(G_OPT_V_CATS);
-    params->id->required = NO;
-    params->id->key = "ids";
-    params->id->label = _("ID values");
+    params->id = G_define_standard_option(G_OPT_V_IDS);
     params->id->guisection = _("Selection");
 
-
     params->cat = G_define_standard_option(G_OPT_V_CATS);
     params->cat->required = NO;
     params->cat->guisection = _("Selection");
@@ -202,12 +199,7 @@ int parser(int argc, char *argv[], struct GParams *params,
     params->reverse = G_define_flag();
     params->reverse->key = 'r';
     params->reverse->description = _("Reverse selection");
-
-    /*
-       params -> print = G_define_flag();
-       params -> print -> key = 'i';
-       params -> print -> description = _("Print ID's of edited features");
-     */
+    params->reverse->guisection = _("Selection");
 
     params->close = G_define_flag();
     params->close->key = 'c';
@@ -228,16 +220,6 @@ int parser(int argc, char *argv[], struct GParams *params,
     params->move_first->description =
 	_("Modify only first found feature in bounding box");
 
-    /*
-       params -> boundary = G_define_flag();
-       params -> boundary -> key = 'b';
-       params -> boundary -> description = _("Assign cats to boundaries too");
-
-       params -> print_cat = G_define_flag();
-       params -> print_cat -> key = 'c';
-       params -> print_cat -> description = _("Print category numbers instead of ID's");
-     */
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);