[GRASS-SVN] r56379 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 23 07:42:42 PDT 2013


Author: martinl
Date: 2013-05-23 07:42:41 -0700 (Thu, 23 May 2013)
New Revision: 56379

Modified:
   grass/trunk/lib/vector/Vlib/copy.c
Log:
vlib: report number of skipped area when copying vector features (as simple features)


Modified: grass/trunk/lib/vector/Vlib/copy.c
===================================================================
--- grass/trunk/lib/vector/Vlib/copy.c	2013-05-23 14:34:45 UTC (rev 56378)
+++ grass/trunk/lib/vector/Vlib/copy.c	2013-05-23 14:42:41 UTC (rev 56379)
@@ -295,7 +295,7 @@
     }
 
     if (nskipped > 0)
-        G_warning(_("%d features without category or from different layer skipped"), nskipped);
+        G_important_message(_("%d features without category or from different layer skipped"), nskipped);
     
     Vect_destroy_line_struct(Points);
     Vect_destroy_line_struct(CPoints);
@@ -407,7 +407,7 @@
 */
 int copy_areas(const struct Map_info *In, int field, struct Map_info *Out)
 {
-    int i, area, nareas, cat, isle, nisles, nparts_alloc;
+    int i, area, nareas, cat, isle, nisles, nparts_alloc, nskipped;
     struct line_pnts **Points;
     struct line_cats *Cats;
     
@@ -418,6 +418,7 @@
     Cats      = Vect_new_cats_struct();
 
     /* copy areas */
+    nskipped = 0;
     nareas = Vect_get_num_areas(In);
     G_message(_("Exporting areas..."));
     for (area = 1; area <= nareas; area++) {
@@ -428,8 +429,10 @@
         Vect_reset_cats(Cats);
         if (field > 0) {
             cat = Vect_get_area_cat(In, area, field);
-            if (cat == -1)
+            if (cat == -1) {
+                nskipped++;
                 continue; /* skip area without category in given layer */
+            }
             
             Vect_cat_set(Cats, field, cat);
         }
@@ -473,6 +476,9 @@
             return -1;
         }
     }
+
+    if (nskipped > 0)
+        G_important_message(_("%d areas without category or from different layer skipped"), nskipped);
     
     /* free allocated space for isles */
     for (i = 0; i < nparts_alloc; i++)



More information about the grass-commit mailing list