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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Apr 23 10:18:07 EDT 2010


Author: martinl
Date: 2010-04-23 10:18:04 -0400 (Fri, 23 Apr 2010)
New Revision: 41999

Modified:
   grass/trunk/vector/v.random/main.c
Log:
fix #1037 ('column_type' added)


Modified: grass/trunk/vector/v.random/main.c
===================================================================
--- grass/trunk/vector/v.random/main.c	2010-04-23 14:02:11 UTC (rev 41998)
+++ grass/trunk/vector/v.random/main.c	2010-04-23 14:18:04 UTC (rev 41999)
@@ -21,7 +21,7 @@
  * <25 Jun 1995> - new site API (jdm)
  * <13 Sep 2000> - released under GPL
  *
- * COPYRIGHT:    (C) 2003-2009 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2003-2010 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2).  Read the file COPYING that
@@ -67,7 +67,7 @@
     struct GModule *module;
     struct
     {
-	struct Option *output, *nsites, *zmin, *zmax, *zcol;
+	struct Option *output, *nsites, *zmin, *zmax, *zcol, *ztype;
     } parm;
     struct
     {
@@ -83,6 +83,7 @@
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("statistics"));
+    G_add_keyword(_("random"));
     module->description = _("Generates randomly 2D/3D vector points map.");
 
     parm.output = G_define_standard_option(G_OPT_V_OUTPUT);
@@ -112,12 +113,21 @@
     parm.zmax->guisection = _("3D output");
 
     parm.zcol = G_define_standard_option(G_OPT_DB_COLUMN);
-    parm.zcol->label =
-	_("Name of column for z values (only numeric type)");
+    parm.zcol->label = _("Name of column for z values");
     parm.zcol->description =
 	_("Writes z values to column instead of 3D vector");
     parm.zcol->guisection = _("3D output");
 
+    parm.ztype = G_define_option();
+    parm.ztype->key = "column_type";
+    parm.ztype->type = TYPE_STRING;
+    parm.ztype->required = NO;
+    parm.ztype->multiple = NO;
+    parm.ztype->description = _("Type of column for z values");
+    parm.ztype->options = "integer,double precision";
+    parm.ztype->answer = "double precision";
+    parm.ztype->guisection = _("3D output");
+
     flag.z = G_define_flag();
     flag.z->key = 'z';
     flag.z->description = _("Create 3D output");
@@ -165,8 +175,8 @@
 	db_begin_transaction(driver);
 
 	db_init_string(&sql);
-	sprintf(buf, "create table %s (cat integer, %s double precision)", Fi->table,
-		parm.zcol->answer);
+	sprintf(buf, "create table %s (cat integer, %s %s)", Fi->table,
+		parm.zcol->answer, parm.ztype->answer);
 	db_set_string(&sql, buf);
 	Vect_map_add_dblink(&Out, 1, NULL, Fi->table, "cat", Fi->database,
 			    Fi->driver);



More information about the grass-commit mailing list