Преглед изворни кода

vlib: report number of skipped area when copying vector features (as simple features)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56379 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa пре 12 година
родитељ
комит
71c0bb612b
1 измењених фајлова са 9 додато и 3 уклоњено
  1. 9 3
      lib/vector/Vlib/copy.c

+ 9 - 3
lib/vector/Vlib/copy.c

@@ -295,7 +295,7 @@ int copy_lines_2(struct Map_info *In, int field, int topo, struct Map_info *Out)
     }
 
     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 is_isle(const struct Map_info *Map, int area)
 */
 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 @@ int copy_areas(const struct Map_info *In, int field, struct Map_info *Out)
     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 @@ int copy_areas(const struct Map_info *In, int field, struct Map_info *Out)
         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 @@ int copy_areas(const struct Map_info *In, int field, struct Map_info *Out)
             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++)