[GRASS-SVN] r56744 - grass/branches/releasebranch_6_4/vector/v.to.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 16 23:03:45 PDT 2013


Author: hamish
Date: 2013-06-16 23:03:44 -0700 (Sun, 16 Jun 2013)
New Revision: 56744

Modified:
   grass/branches/releasebranch_6_4/vector/v.to.rast/support.c
Log:
update history, avoid overflow on long names (#1974, merge from devbr6)


Modified: grass/branches/releasebranch_6_4/vector/v.to.rast/support.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.to.rast/support.c	2013-06-17 05:17:37 UTC (rev 56743)
+++ grass/branches/releasebranch_6_4/vector/v.to.rast/support.c	2013-06-17 06:03:44 UTC (rev 56744)
@@ -22,16 +22,14 @@
     if (raster_name == NULL)
 	return (-1);
 
-    if (G_read_history(raster_name, G_mapset(), &hist) < 0)
-	return -1;
+    G_short_history(raster_name, "raster", &hist);
 
-    strcpy(hist.title, raster_name);
+    /* store information from vector map's digit file into history */
+    G_snprintf(hist.datsrc_1, RECORD_LEN-1, "Vector Map: %s in mapset %s",
+	      vector_name, vector_mapset);
+    G_snprintf(hist.datsrc_2, RECORD_LEN-1,
+	      "Original scale from vector map: 1:%ld", scale);	/* 4.0 */
 
-    /* store information from digit file into history */
-    sprintf(hist.datsrc_1, "Vector Map: %s in mapset %s", vector_name,
-	    vector_mapset);
-    sprintf(hist.datsrc_2, "Original scale from vector map: 1:%ld", scale);	/* 4.0 */
-
     /* store command line options */
     G_command_history(&hist);
 
@@ -276,7 +274,7 @@
 		break;
 	    }
 
-	    G_set_raster_cats_title("Labels", &rast_cats);
+	    G_set_raster_cats_title("Rasterized vector map from labels", &rast_cats);
 
 	    /* open vector map and database driver */
 	    Vect_set_open_level(1);
@@ -387,7 +385,7 @@
 	    struct Range range;
 
 	    map_type = G_raster_map_type(rast_name, G_mapset());
-	    G_set_raster_cats_title("Values", &rast_cats);
+	    G_set_raster_cats_title("Rasterized vector map from values", &rast_cats);
 
 	    if (map_type == CELL_TYPE) {
 		CELL min, max;
@@ -426,7 +424,7 @@
 
 	    if (label_column) {
 
-		G_set_raster_cats_title("Labels", &rast_cats);
+		G_set_raster_cats_title("Rasterized vector map from labels", &rast_cats);
 
 		/* open vector map and database driver */
 		Vect_set_open_level(1);
@@ -516,7 +514,7 @@
 		    G_fatal_error(_("Cannot allocate memory for row buffer"));
 
 		G_init_cell_stats(&stats);
-		G_set_raster_cats_title("Categories", &rast_cats);
+		G_set_raster_cats_title("Rasterized vector map from categories", &rast_cats);
 
 		rows = G_window_rows();
 
@@ -551,7 +549,8 @@
 
 	    mapset = G_mapset();
 	    map_type = G_raster_map_type(rast_name, mapset);
-	    G_set_raster_cats_title("Degrees", &rast_cats);
+	    G_set_raster_cats_title("Rasterized vector map from line direction", &rast_cats);
+	    G_write_raster_units(rast_name, "degrees CCW from +x");
 
 	    for (i = 1; i <= 360; i++) {
 		sprintf(msg, "%d degrees", i);



More information about the grass-commit mailing list