[GRASS-SVN] r42313 - grass/trunk/vector/v.info

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 19 03:24:08 EDT 2010


Author: mmetz
Date: 2010-05-19 03:24:08 -0400 (Wed, 19 May 2010)
New Revision: 42313

Modified:
   grass/trunk/vector/v.info/local_proto.h
   grass/trunk/vector/v.info/main.c
   grass/trunk/vector/v.info/parse.c
Log:
remove level 1 flag, simplify automated level handling

Modified: grass/trunk/vector/v.info/local_proto.h
===================================================================
--- grass/trunk/vector/v.info/local_proto.h	2010-05-19 01:47:35 UTC (rev 42312)
+++ grass/trunk/vector/v.info/local_proto.h	2010-05-19 07:24:08 UTC (rev 42313)
@@ -6,7 +6,7 @@
 /* parse.c */
 void parse_args(int, char**,
 		char **, char**,
-		int *, int *, int *, int *, int *, int *);
+		int *, int *, int *, int *, int *);
 
 /* print.c */
 void format_double(double, char *);

Modified: grass/trunk/vector/v.info/main.c
===================================================================
--- grass/trunk/vector/v.info/main.c	2010-05-19 01:47:35 UTC (rev 42312)
+++ grass/trunk/vector/v.info/main.c	2010-05-19 07:24:08 UTC (rev 42313)
@@ -27,7 +27,7 @@
     struct GModule *module;
 
     char *input_opt, *field_opt;
-    int hist_flag, col_flag, reg_flag, topo_flag, title_flag, level1_flag;
+    int hist_flag, col_flag, reg_flag, topo_flag, title_flag;
     
     struct Map_info Map;
     
@@ -42,25 +42,20 @@
 
     parse_args(argc, argv,
 	       &input_opt, &field_opt,
-	       &hist_flag, &col_flag, &reg_flag, &topo_flag, &title_flag, &level1_flag);
+	       &hist_flag, &col_flag, &reg_flag, &topo_flag, &title_flag);
 
-    if (!level1_flag) {
-	 /* try to open head-only on level 2 */
-	if (Vect_open_old_head2(&Map, input_opt, "", field_opt) < 2) {
-	    G_warning(_("Unable to open vector map <%s> on level 2, using level 1"),
-		      Vect_get_full_name(&Map));
-	    Vect_close(&Map);
-	    level1_flag = 1;
-	}
-    }
-
-    /* force level 1, open fully
-     * NOTE: number of points, lines, boundaries, centroids, faces, kernels is still available */
-    if (level1_flag) {
+     /* try to open head-only on level 2 */
+    if (Vect_open_old_head2(&Map, input_opt, "", field_opt) < 2) {
+	/* force level 1, open fully
+	 * NOTE: number of points, lines, boundaries, centroids, faces, kernels is still available */
+	Vect_close(&Map);
 	Vect_set_open_level(1); /* no topology */
 	if (Vect_open_old2(&Map, input_opt, "", field_opt) < 1)
 	    G_fatal_error(_("Unable to open vector map <%s>"), Vect_get_full_name(&Map));
-	level_one_info(&Map);
+
+	/* level one info not needed for history, title, columns */
+	if (!hist_flag && !title_flag && !col_flag)
+	    level_one_info(&Map);
     }
 
     if (hist_flag) {

Modified: grass/trunk/vector/v.info/parse.c
===================================================================
--- grass/trunk/vector/v.info/parse.c	2010-05-19 01:47:35 UTC (rev 42312)
+++ grass/trunk/vector/v.info/parse.c	2010-05-19 07:24:08 UTC (rev 42313)
@@ -5,10 +5,10 @@
 
 void parse_args(int argc, char** argv,
 		char** input, char** field,
-		int* history, int* columns, int* region, int* topo, int* title, int* level1)
+		int* history, int* columns, int* region, int* topo, int* title)
 {
     struct Option *input_opt, *field_opt;
-    struct Flag *hist_flag, *col_flag, *region_flag, *topo_flag, *title_flag, *level1_flag;
+    struct Flag *hist_flag, *col_flag, *region_flag, *topo_flag, *title_flag;
 
     input_opt = G_define_standard_option(G_OPT_V_MAP);
 
@@ -40,10 +40,6 @@
     topo_flag->description = _("Print topology information only");
     topo_flag->guisection = _("Print");
 
-    level1_flag = G_define_flag();
-    level1_flag->key = 'l';
-    level1_flag->description = _("Open vector map without topology (level 1)");
-    
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -55,5 +51,4 @@
     *region  = region_flag-> answer ? 1 : 0;
     *title   = title_flag-> answer ? 1 : 0;
     *topo    = topo_flag-> answer ? 1 : 0;
-    *level1  = level1_flag-> answer ? 1 : 0;
 }



More information about the grass-commit mailing list