[GRASS-dev] [GRASS-SVN] r66058 - grass/trunk/raster/r.support

Hi,

just a question on this change:

On Sat, Aug 29, 2015 at 6:25 PM, <svn_grass@osgeo.org> wrote:

Author: huhabla
Date: 2015-08-29 09:25:06 -0700 (Sat, 29 Aug 2015)
New Revision: 66058

Modified:
   grass/trunk/raster/r.support/main.c
Log:
raster module r.support: Use the history to store the map title

Modified: grass/trunk/raster/r.support/main.c

--- grass/trunk/raster/r.support/main.c 2015-08-29 07:37:11 UTC (rev 66057)
+++ grass/trunk/raster/r.support/main.c 2015-08-29 16:25:06 UTC (rev 66058)
@@ -154,8 +154,10 @@
        strncpy(title, title_opt->answer, MAX_TITLE_LEN);
        title[MAX_TITLE_LEN - 1] = '\0'; /* strncpy doesn't null terminate oversized input */
        G_strip(title);
- G_debug(3, "map title= [%s] (%d chars)", title, strlen(title));
- Rast_put_cell_title(raster->answer, title);
+ G_debug(3, "map title= [%s] (%li chars)", title, strlen(title));
+ Rast_read_history(raster->answer, "", &hist);
+ Rast_set_history(&hist, HIST_TITLE, title);
+ Rast_write_history(raster->answer, &hist);
     }

Is it the better practice?

If yes, should also the other modules be updated?

grep Rast_put_cell_title */*.c
r.clump/main.c: Rast_put_cell_title(OUTPUT, title);
r.drain/main.c: Rast_put_cell_title(new_map_name, "Surface flow trace");
r.external/link.c: Rast_put_cell_title(output, title);
r.his/main.c: Rast_put_cell_title(name_r, "Red extracted from HIS");
r.his/main.c: Rast_put_cell_title(name_g, "Green extracted from HIS");
r.his/main.c: Rast_put_cell_title(name_b, "Blue extracted from HIS");
r.horizon/main.c: Rast_put_cell_title(shad_filename, msg_buff);
r.in.ascii/main.c: Rast_put_cell_title(output, title);
r.in.bin/main.c: Rast_put_cell_title(output, title);
r.in.gdal/main.c: Rast_put_cell_title(output, title);
r.in.gdal/main.c: Rast_put_cell_title(szBandName, title);
r.in.gridatb/file_io.c: Rast_put_cell_title(oname, buf);
r.in.lidar/main.c: Rast_put_cell_title(outmap, title);
r.in.mat/main.c: Rast_put_cell_title(map_name, map_title);
r.in.png/main.c: Rast_put_cell_title(ch->name, title);
r.in.xyz/main.c: Rast_put_cell_title(outmap, title);
r.mfilter/main.c: Rast_put_cell_title(out_name, title);
r.param.scale/close_down.c: Rast_put_cell_title(rast_out_name, map_title);
r.recode/main.c: Rast_put_cell_title(result, title);
r.relief/main.c: Rast_put_cell_title(sr_name, buf);
r.resamp.bspline/main.c: Rast_put_cell_title(out_opt->answer, title);
r.resamp.filter/main.c: Rast_put_cell_title(parm.rastout->answer, title);
r.resamp.interp/main.c: Rast_put_cell_title(rastout->answer, title);
r.resamp.stats/main.c: Rast_put_cell_title(parm.rastout->answer, title);
r.thin/main.c: Rast_put_cell_title(output, "Thinned linear features");
r.tile/main.c: Rast_put_cell_title(name, title);

?

Markus

Hi,

2015-09-05 10:57 GMT+02:00 Markus Neteler <neteler@osgeo.org>:

Hi,

just a question on this change:

On Sat, Aug 29, 2015 at 6:25 PM, <svn_grass@osgeo.org> wrote:

Author: huhabla
Date: 2015-08-29 09:25:06 -0700 (Sat, 29 Aug 2015)
New Revision: 66058

Modified:
   grass/trunk/raster/r.support/main.c
Log:
raster module r.support: Use the history to store the map title

Modified: grass/trunk/raster/r.support/main.c

--- grass/trunk/raster/r.support/main.c 2015-08-29 07:37:11 UTC (rev 66057)
+++ grass/trunk/raster/r.support/main.c 2015-08-29 16:25:06 UTC (rev 66058)
@@ -154,8 +154,10 @@
        strncpy(title, title_opt->answer, MAX_TITLE_LEN);
        title[MAX_TITLE_LEN - 1] = '\0'; /* strncpy doesn't null terminate oversized input */
        G_strip(title);
- G_debug(3, "map title= [%s] (%d chars)", title, strlen(title));
- Rast_put_cell_title(raster->answer, title);
+ G_debug(3, "map title= [%s] (%li chars)", title, strlen(title));
+ Rast_read_history(raster->answer, "", &hist);
+ Rast_set_history(&hist, HIST_TITLE, title);
+ Rast_write_history(raster->answer, &hist);
     }

Is it the better practice?

IMHO yes in case of r.support, since it sets the title in the history.
The function Rast_put_cell_title()
sets the category title. However, it is indeed confusing that there
are titles in the history and category files.

The module r.info shows the title from the history and so should
r.support set the title in the history ... at least to my
understanding.

If yes, should also the other modules be updated?

I don't think so, since they set the title for the categories.

grep Rast_put_cell_title */*.c
r.clump/main.c: Rast_put_cell_title(OUTPUT, title);
r.drain/main.c: Rast_put_cell_title(new_map_name, "Surface flow trace");
r.external/link.c: Rast_put_cell_title(output, title);
r.his/main.c: Rast_put_cell_title(name_r, "Red extracted from HIS");
r.his/main.c: Rast_put_cell_title(name_g, "Green extracted from HIS");
r.his/main.c: Rast_put_cell_title(name_b, "Blue extracted from HIS");
r.horizon/main.c: Rast_put_cell_title(shad_filename, msg_buff);
r.in.ascii/main.c: Rast_put_cell_title(output, title);
r.in.bin/main.c: Rast_put_cell_title(output, title);
r.in.gdal/main.c: Rast_put_cell_title(output, title);
r.in.gdal/main.c: Rast_put_cell_title(szBandName, title);
r.in.gridatb/file_io.c: Rast_put_cell_title(oname, buf);
r.in.lidar/main.c: Rast_put_cell_title(outmap, title);
r.in.mat/main.c: Rast_put_cell_title(map_name, map_title);
r.in.png/main.c: Rast_put_cell_title(ch->name, title);
r.in.xyz/main.c: Rast_put_cell_title(outmap, title);
r.mfilter/main.c: Rast_put_cell_title(out_name, title);
r.param.scale/close_down.c: Rast_put_cell_title(rast_out_name, map_title);
r.recode/main.c: Rast_put_cell_title(result, title);
r.relief/main.c: Rast_put_cell_title(sr_name, buf);
r.resamp.bspline/main.c: Rast_put_cell_title(out_opt->answer, title);
r.resamp.filter/main.c: Rast_put_cell_title(parm.rastout->answer, title);
r.resamp.interp/main.c: Rast_put_cell_title(rastout->answer, title);
r.resamp.stats/main.c: Rast_put_cell_title(parm.rastout->answer, title);
r.thin/main.c: Rast_put_cell_title(output, "Thinned linear features");
r.tile/main.c: Rast_put_cell_title(name, title);

?

Ciao
Sören

Markus
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev