[GRASS-SVN] r39909 - grass/trunk/vector/v.random

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 6 03:46:11 EST 2009


Author: martinl
Date: 2009-12-06 03:46:11 -0500 (Sun, 06 Dec 2009)
New Revision: 39909

Modified:
   grass/trunk/vector/v.random/main.c
Log:
v.random: OGR support (read access)


Modified: grass/trunk/vector/v.random/main.c
===================================================================
--- grass/trunk/vector/v.random/main.c	2009-12-06 08:45:27 UTC (rev 39908)
+++ grass/trunk/vector/v.random/main.c	2009-12-06 08:46:11 UTC (rev 39909)
@@ -5,18 +5,10 @@
  *
  * AUTHOR(S):    James Darrell McCauley darrell at mccauley-usa.com
  * 	         http://mccauley-usa.com/
+ *               OGR support by Martin Landa <landa.martin gmail.com>
  *
  * PURPOSE:      Randomly generate a 2D/3D GRASS vector points map.
  *
- * COPYRIGHT:    (C) 2003-2007 by the GRASS Development Team
- *
- *               This program is free software under the
- *               GNU General Public License (>=v2).
- *               Read the file COPYING that comes with GRASS
- *               for details.
- *
-**************************************************************/
-/*
  * Modification History:
  *
  * s.rand v 0.5B <25 Jun 1995> Copyright (c) 1993-1995. James Darrell McCauley
@@ -28,13 +20,21 @@
  * <25 Feb 1995> - cleaned 'gcc -Wall' warnings (jdm)
  * <25 Jun 1995> - new site API (jdm)
  * <13 Sep 2000> - released under GPL
- */
+ *
+ * COPYRIGHT:    (C) 2003-2009 by the GRASS Development Team
+ *
+ *               This program is free software under the GNU General
+ *               Public License (>=v2).  Read the file COPYING that
+ *               comes with GRASS for details.
+ *
+**************************************************************/
 
 #include <stdlib.h>
 #include <math.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <string.h>
+
 #include <grass/gis.h>
 #include <grass/vector.h>
 #include <grass/dbmi.h>
@@ -83,7 +83,7 @@
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("statistics"));
-    module->description = _("Randomly generate a 2D/3D vector points map.");
+    module->description = _("Generates randomly 2D/3D vector points map.");
 
     parm.output = G_define_standard_option(G_OPT_V_OUTPUT);
 
@@ -100,6 +100,7 @@
     parm.zmin->description =
 	_("Minimum z height (needs -z flag or column name)");
     parm.zmin->answer = "0.0";
+    parm.zmin->guisection = _("3D output");
 
     parm.zmax = G_define_option();
     parm.zmax->key = "zmax";
@@ -108,19 +109,19 @@
     parm.zmax->description =
 	_("Maximum z height (needs -z flag or column name)");
     parm.zmax->answer = "0.0";
+    parm.zmax->guisection = _("3D output");
 
     parm.zcol = G_define_standard_option(G_OPT_DB_COLUMN);
-    parm.zcol->key = "column";
-    parm.zcol->required = NO;
-    parm.zcol->multiple = NO;
     parm.zcol->label =
-	_("Column name and type (i.e. INTEGER, DOUBLE PRECISION) for z values");
+	_("Name of column for z values (only numeric type)");
     parm.zcol->description =
-	_("Writes Z data to column instead of 3D vector");
+	_("Writes z values to column instead of 3D vector");
+    parm.zcol->guisection = _("3D output");
 
     flag.z = G_define_flag();
     flag.z->key = 'z';
     flag.z->description = _("Create 3D output");
+    flag.z->guisection = _("3D output");
 
     flag.drand48 = G_define_flag();
     flag.drand48->key = 'd';
@@ -134,7 +135,7 @@
 	exit(EXIT_FAILURE);
 
     if (flag.z->answer && parm.zcol->answer) {
-	G_fatal_error(_("v.random can't create 3D vector and attribute table at same time"));
+	G_fatal_error(_("Unable to create 3D vector and attribute table at same time"));
     }
 
     output = parm.output->answer;
@@ -290,7 +291,8 @@
 	Vect_cat_set(Cats, 1, i + 1);
 	Vect_write_line(&Out, GV_POINT, Points, Cats);
     }
-
+    G_percent(1, 1, 1);
+    
     if (parm.zcol->answer) {
 	db_commit_transaction(driver);
 	db_close_database_shutdown_driver(driver);



More information about the grass-commit mailing list