[GRASS-SVN] r48901 - grass/trunk/vector/v.out.ascii

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 21 07:54:37 EDT 2011


Author: martinl
Date: 2011-10-21 04:54:37 -0700 (Fri, 21 Oct 2011)
New Revision: 48901

Modified:
   grass/trunk/vector/v.out.ascii/args.c
   grass/trunk/vector/v.out.ascii/local_proto.h
   grass/trunk/vector/v.out.ascii/main.c
Log:
v.out.ascii: add `type` option


Modified: grass/trunk/vector/v.out.ascii/args.c
===================================================================
--- grass/trunk/vector/v.out.ascii/args.c	2011-10-21 11:53:52 UTC (rev 48900)
+++ grass/trunk/vector/v.out.ascii/args.c	2011-10-21 11:54:37 UTC (rev 48901)
@@ -10,16 +10,19 @@
 void parse_args(int argc, char **argv,
 		char **input, char**output, int *format, int *dp, char **delim,
 		char **field, char ***columns, char **where, int *region,
-		int *old_format, int *header, struct cat_list **clist)
+		int *old_format, int *header, struct cat_list **clist, int *type)
 {
     struct Option *input_opt, *output_opt, *format_opt, *dp_opt, *delim_opt,
-	*field_opt, *column_opt, *where_opt, *cats_opt;
+	*field_opt, *column_opt, *where_opt, *cats_opt, *type_opt;
     struct Flag *old_flag, *header_flag, *region_flag;
     
     input_opt = G_define_standard_option(G_OPT_V_INPUT);
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
     field_opt->guisection = _("Selection");
+
+    type_opt = G_define_standard_option(G_OPT_V3_TYPE);
+    type_opt->guisection = _("Selection");
     
     output_opt = G_define_standard_option(G_OPT_F_OUTPUT);
     output_opt->label = _("Name for output ASCII file "
@@ -105,6 +108,11 @@
 	*delim = G_store(delim_opt->answer);
     
     *field = G_store(field_opt->answer);
+    *type = Vect_option_to_types(type_opt);
+    if (*type & GV_AREA) {
+	*type |= GV_BOUNDARY;
+	*type |= GV_CENTROID;
+    }
     *columns = NULL;
     if (column_opt->answer) {
 	int i, nopt;

Modified: grass/trunk/vector/v.out.ascii/local_proto.h
===================================================================
--- grass/trunk/vector/v.out.ascii/local_proto.h	2011-10-21 11:53:52 UTC (rev 48900)
+++ grass/trunk/vector/v.out.ascii/local_proto.h	2011-10-21 11:54:37 UTC (rev 48901)
@@ -2,4 +2,4 @@
 void parse_args(int, char **,
 		char **, char**, int *, int *, char **,
 		char **, char ***, char **, int *, int *, int *,
-		struct cat_list **);
+		struct cat_list **, int *);

Modified: grass/trunk/vector/v.out.ascii/main.c
===================================================================
--- grass/trunk/vector/v.out.ascii/main.c	2011-10-21 11:53:52 UTC (rev 48900)
+++ grass/trunk/vector/v.out.ascii/main.c	2011-10-21 11:54:37 UTC (rev 48901)
@@ -34,7 +34,7 @@
 
     FILE *ascii, *att;
     char *input, *output, *delim, **columns, *where, *field_name;
-    int format, dp, field, ret, region, old_format, header;
+    int format, dp, field, ret, region, old_format, header, type;
     int ver, pnt;
 
     struct cat_list *clist;
@@ -50,7 +50,7 @@
 
     parse_args(argc, argv, &input, &output, &format, &dp, &delim,
 	       &field_name, &columns, &where, &region, &old_format, &header,
-	       &clist);
+	       &clist, &type);
     
     if (format == GV_ASCII_FORMAT_STD && columns) {
 	G_warning(_("Parameter 'column' ignored in standard mode"));
@@ -123,7 +123,7 @@
     if (where || columns || clist)
 	G_message(_("Fetching data..."));
     ret = Vect_write_ascii(ascii, att, &Map, ver, format, dp, delim,
-			   region, field, clist, (const char *)where,
+			   region, type, field, clist, (const char *)where,
 			   (const char **)columns, header);
 
     if (ret < 1) {



More information about the grass-commit mailing list