[GRASS-SVN] r72420 - grass/branches/releasebranch_7_4/vector/v.random

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 20 09:44:37 PDT 2018


Author: martinl
Date: 2018-03-20 09:44:37 -0700 (Tue, 20 Mar 2018)
New Revision: 72420

Modified:
   grass/branches/releasebranch_7_4/vector/v.random/main.c
Log:
v.random: use G_option_requires + new guisection for restrict (merge r72419 from trunk)

Modified: grass/branches/releasebranch_7_4/vector/v.random/main.c
===================================================================
--- grass/branches/releasebranch_7_4/vector/v.random/main.c	2018-03-20 16:43:12 UTC (rev 72419)
+++ grass/branches/releasebranch_7_4/vector/v.random/main.c	2018-03-20 16:44:37 UTC (rev 72420)
@@ -117,7 +117,8 @@
     parm.input->required = NO;
     parm.input->description = _("Restrict points to areas in input vector");
     parm.input->guisection = _("Selection");
-
+    parm.input->guisection = _("Restrict");
+ 
     parm.field = G_define_standard_option(G_OPT_V_FIELD_ALL);
     parm.field->guisection = _("Selection");
 
@@ -175,10 +176,13 @@
 
     flag.a = G_define_flag();
     flag.a->key = 'a';
-    flag.a->description = _("Generate n points for each individual area");
-
+    flag.a->description = _("Generate n points for each individual area (requires restrict parameter)");
+    flag.a->guisection = _("Restrict");
+    
     flag.notopo = G_define_standard_flag(G_FLG_V_TOPO);
 
+    G_option_requires(flag.a, parm.input, NULL);
+    
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -218,11 +222,6 @@
 	    G_fatal_error(_("No areas in vector map <%s>"), parm.input->answer);
 	}
     }
-    else {
-	if (flag.a->answer)
-	    G_fatal_error(_("The <-%c> flag requires an input vector with areas"),
-	                  flag.a->key);
-    }
 
     /* create new vector map */
     if (-1 == Vect_open_new(&Out, output, flag.z->answer ? WITH_Z : WITHOUT_Z))



More information about the grass-commit mailing list