[GRASS-SVN] r58202 - grass/trunk/vector/v.category

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 12 14:04:42 PST 2013


Author: zarch
Date: 2013-11-12 14:04:41 -0800 (Tue, 12 Nov 2013)
New Revision: 58202

Modified:
   grass/trunk/vector/v.category/main.c
Log:
Add a flag to skip to copy the attribute tables

Modified: grass/trunk/vector/v.category/main.c
===================================================================
--- grass/trunk/vector/v.category/main.c	2013-11-12 14:00:53 UTC (rev 58201)
+++ grass/trunk/vector/v.category/main.c	2013-11-12 22:04:41 UTC (rev 58202)
@@ -66,7 +66,7 @@
     struct GModule *module;
     struct Option *in_opt, *out_opt, *option_opt, *type_opt;
     struct Option *cat_opt, *field_opt, *step_opt, *id_opt;
-    struct Flag *shell;
+    struct Flag *shell, *nodb;
     FREPORT **freps;
     int nfreps, rtype, fld;
     char *desc;
@@ -137,6 +137,11 @@
     shell->key = 'g';
     shell->label = _("Shell script style, currently only for report");
     shell->description = _("Format: layer type count min max");
+    
+    nodb = G_define_flag();
+    nodb->key = 'n';
+    nodb->label = _("Avoid to copy the attribute table");
+    nodb->description = _("Avoid to copy the attribute table in the database");
 
     G_gisinit(argv[0]);
 
@@ -757,19 +762,21 @@
     }
 
     if (option == O_ADD || option == O_DEL || option == O_CHFIELD ||
-	option == O_SUM || option == O_TRANS) {
-	G_message(_("Copying attribute table(s)..."));
-        if (Vect_copy_tables(&In, &Out, 0))
-            G_warning(_("Failed to copy attribute table to output map"));
+        option == O_SUM || option == O_TRANS){
+        if (!nodb->answer){
+	    G_message(_("Copying attribute table(s)..."));
+            if (Vect_copy_tables(&In, &Out, 0))
+                G_warning(_("Failed to copy attribute table to output map"));
+	}
 	Vect_build(&Out);
 	Vect_close(&Out);
+    }
 
-	if (option == O_TRANS && nmodified > 0)
-	    for(i = 1; i < nfields; i++)
-		G_important_message(_("Categories copied from layer %d to layer %d"),
-				fields[0], fields[i]);
-	G_done_msg(_("%d features modified."), nmodified);
-    }
+    if (option == O_TRANS && nmodified > 0)
+        for(i = 1; i < nfields; i++)
+	    G_important_message(_("Categories copied from layer %d to layer %d"),
+		                  fields[0], fields[i]);
+    G_done_msg(_("%d features modified."), nmodified);
     Vect_close(&In);
 
     exit(EXIT_SUCCESS);



More information about the grass-commit mailing list