Przeglądaj źródła

v.to.rast: allow `use=cat rgbcolumn=column`
enable warning when rasterization is done
(merge https://trac.osgeo.org/grass/changeset/49541 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49543 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 13 lat temu
rodzic
commit
f71497603e
2 zmienionych plików z 9 dodań i 4 usunięć
  1. 3 0
      vector/v.to.rast/support.c
  2. 6 4
      vector/v.to.rast/vect2rast.c

+ 3 - 0
vector/v.to.rast/support.c

@@ -132,6 +132,9 @@ int update_dbcolors(const char *rast_name, const char *vector_map, int field,
 	G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
 		      Fi->database, Fi->driver);
 
+    if (!attr_column)
+	attr_column = Fi->key;
+    
     /* get number of records in attr_column */
     if ((nrec =
 	 db_select_CatValArray(Driver, Fi->table, Fi->key, attr_column, NULL,

+ 6 - 4
vector/v.to.rast/vect2rast.c

@@ -177,6 +177,7 @@ int vect_to_rast(const char *vector_map, const char *raster_map, const char *fie
 	stat = output_raster(fd);
     } while (stat == 0);
 
+    G_suppress_warnings(0);
     /* stat: 0 == repeat; 1 == done; -1 == error; */
 
     Vect_destroy_line_struct(Points);
@@ -195,13 +196,14 @@ int vect_to_rast(const char *vector_map, const char *raster_map, const char *fie
 
     /* colors */
     if (rgbcolumn) {
-	if (use != USE_ATTR) {
+	if (use != USE_ATTR && use != USE_CAT) {
 	    G_warning(_("Color can be updated from database only if use=attr"));
 	    update_colors(raster_map);
 	}
-
-	update_dbcolors(raster_map, vector_map, field, rgbcolumn, is_fp,
-			column);
+	else {
+	  update_dbcolors(raster_map, vector_map, field, rgbcolumn, is_fp,
+			  column);
+	}
     }
     else if (use == USE_D)
 	update_fcolors(raster_map);