Browse Source

more precise surpression of warnings (needed at all?), add bad-coord warnings (side issue from https://trac.osgeo.org/grass/ticket/1142; merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43331 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 15 years ago
parent
commit
4d7dd6a689
3 changed files with 18 additions and 7 deletions
  1. 13 4
      raster/r.in.poly/get_item.c
  2. 0 3
      raster/r.in.poly/main.c
  3. 5 0
      raster/r.in.poly/poly2rast.c

+ 13 - 4
raster/r.in.poly/get_item.c

@@ -1,5 +1,7 @@
 #include <grass/gis.h>
 #include <grass/raster.h>
+#include <grass/glocale.h>
+
 int get_item(FILE * fd, int *type, long *cat, double **x, double **y,
 	     int *count, struct Categories *labels)
 {
@@ -70,13 +72,20 @@ int get_item(FILE * fd, int *type, long *cat, double **x, double **y,
 	    }
 	    continue;
 	}
-
-	if (sscanf(buf, "%s %s", east, north) != 2)
+	if (sscanf(buf, "%s %s", east, north) != 2) {
+	    G_warning(_("Illegal coordinate <%s, %s>, skipping."), east, north);
 	    continue;
-	if (!G_scan_northing(north, &n, G_projection()))
+	}
+
+	if (!G_scan_northing(north, &n, G_projection())) {
+	    G_warning(_("Illegal north coordinate <%s>, skipping."), north);
 	    continue;
-	if (!G_scan_easting(east, &e, G_projection()))
+	}
+
+	if (!G_scan_easting(east, &e, G_projection())) {
+	    G_warning(_("Illegal east coordinate <%s>, skipping."), east);
 	    continue;
+	}
 
 	if (*count >= nalloc) {
 	    nalloc += 32;

+ 0 - 3
raster/r.in.poly/main.c

@@ -59,8 +59,5 @@ int main(int argc, char *argv[])
     if (n < 1)
 	G_fatal_error(_("Minimum number of rows to hold in memory is 1"));
 
-    /* otherwise get complaints about window changes */
-    G_suppress_warnings(1);
-
     exit(poly_to_rast(input->answer, output->answer, title->answer, n));
 }

+ 5 - 0
raster/r.in.poly/poly2rast.c

@@ -41,7 +41,12 @@ int poly_to_rast(char *input_file, char *raster_map, char *title, int nrows)
     Rast_init_cats(title, &labels);
 
     format = getformat(ifd);
+    
+    /* ?? otherwise get complaints about window changes */
+    G_suppress_warnings(TRUE);
     npasses = begin_rasterization(nrows, format);
+    G_suppress_warnings(FALSE);
+
     pass = 0;
 
     do {