[GRASS-SVN] r39198 - grass/trunk/display/d.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 14 09:04:28 EDT 2009


Author: martinl
Date: 2009-09-14 09:04:28 -0400 (Mon, 14 Sep 2009)
New Revision: 39198

Modified:
   grass/trunk/display/d.vect/main.c
   grass/trunk/display/d.vect/plot1.c
Log:
d.vect: print number of plotted features in verbose mode
	direct OGR support activated


Modified: grass/trunk/display/d.vect/main.c
===================================================================
--- grass/trunk/display/d.vect/main.c	2009-09-14 12:18:53 UTC (rev 39197)
+++ grass/trunk/display/d.vect/main.c	2009-09-14 13:04:28 UTC (rev 39198)
@@ -84,7 +84,6 @@
     int size;
     int default_width;
     double width_scale;
-    int verbose = FALSE;
     double minreg, maxreg, reg;
     char map_name[128];
     struct GModule *module;
@@ -359,9 +358,6 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    if (G_verbose() > G_verbose_std())
-	verbose = TRUE;
-
     G_get_set_window(&window);
 
     if (D_open_driver() != 0)
@@ -439,7 +435,7 @@
     Clist->field = atoi(field_opt->answer);
 
     /* open vector */
-    level = Vect_open_old(&Map, map_name, "");
+    level = Vect_open_old2(&Map, map_name, "", field_opt->answer);
 
     if (where_opt->answer) {
 	if (Clist->field < 1)
@@ -585,8 +581,7 @@
 
     D_setup(0);
 
-    if (verbose)
-	G_message(_("Plotting ..."));
+    G_verbose_message(_("Plotting..."));
 
     if (level >= 2)
 	Vect_get_map_box(&Map, &box);
@@ -682,8 +677,7 @@
 
     D_close_driver();
 
-    if (verbose)
-	G_done_msg(" ");
+    G_done_msg(" ");
 
     Vect_close(&Map);
     Vect_destroy_cat_list(Clist);

Modified: grass/trunk/display/d.vect/plot1.c
===================================================================
--- grass/trunk/display/d.vect/plot1.c	2009-09-14 12:18:53 UTC (rev 39197)
+++ grass/trunk/display/d.vect/plot1.c	2009-09-14 13:04:28 UTC (rev 39198)
@@ -58,7 +58,8 @@
     dbCatVal *cv_rgb = NULL, *cv_width = NULL, *cv_size = NULL, *cv_rot = NULL;
     int nrec_rgb = 0, nrec_width = 0, nrec_size = 0, nrec_rot = 0;
     int nerror_rgb;
-    
+    int n_points, n_lines, n_centroids, n_boundaries, n_faces;
+
     int open_db;
     int custom_rgb = FALSE;
     char colorstring[12];	/* RRR:GGG:BBB */
@@ -263,6 +264,9 @@
 	nlines = Vect_get_num_lines(Map);
 
     line = 0;
+    n_points = n_lines = 0;
+    n_centroids = n_boundaries = 0;
+    n_faces = 0;
     while (1) {
 	line++;
 	if (Vect_level(Map) >= 2) {
@@ -582,13 +586,44 @@
 	    else		/*use different user defined render methods */
 		D_polyline_abs(x, y, Points->n_points);
 	}
+	
+	switch (ltype) {
+	case GV_POINT:
+	    n_points++;
+	    break;
+	case GV_LINE:
+	    n_lines++;
+	    break;
+	case GV_CENTROID:
+	    n_centroids++;
+	    break;
+	case GV_BOUNDARY:
+	    n_boundaries++;
+	    break;
+	case GV_FACE:
+	    n_faces++;
+	    break;
+	default:
+	    break;
+	}
     }
-
+    
     if (nerror_rgb > 0) {
 	G_warning(_("Error in color definition column '%s': %d features affected"),
 		  rgb_column, nerror_rgb);
     }
     
+    if (n_points > 0) 
+	G_verbose_message(_("%d points plotted"), n_points);
+    if (n_lines > 0) 
+	G_verbose_message(_("%d lines plotted"), n_lines);
+    if (n_centroids > 0) 
+	G_verbose_message(_("%d centroids plotted"), n_centroids);
+    if (n_boundaries > 0) 
+	G_verbose_message(_("%d boundaries plotted"), n_boundaries);
+    if (n_faces > 0) 
+	G_verbose_message(_("%d faces plotted"), n_faces);
+    
     Vect_destroy_line_struct(Points);
     Vect_destroy_cats_struct(Cats);
 



More information about the grass-commit mailing list