Bug fixes for d.legend

Leonard Coop coopl at ippc2.orst.edu
Tue Nov 16 14:39:29 EST 1999


I am using GRASS 4.21 (April 1999),
Anyone who is sick of d.legend not painting the legend color squares
correctly and who does not want to see the "1)" category numbers
as part of
the legend entries, might want to incorporate these fixes to main.c of
d.legend; Compare example map legends made with
old: 
http://ippc2.orst.edu/wea/gis/prev/May_99/D_41n2May26.GIF 
and new:
http://ippc2.orst.edu/wea/gis/prev/September_99/D_50n2September23.GIF

--------------------------------------------
diff main.c main.c_old 
156,157c154
< /* next one detns top extent of color in box (def. 6; 5 goes one
higher)*/
<       y_box[1] = (5-dots_per_line) ;
---
>       y_box[1] = (6-dots_per_line) ;
161,162c158
< /* next one detns bottom extent of color in box (def. 6; 5 goes one
less)*/
<       y_box[3] = (dots_per_line-5) ;
---
>       y_box[3] = (dots_per_line-6) ;

also in new main.c
/* old version prints cat number which I dont want
                sprintf(buff, "%2d) %s", i, G_get_cat(i, &cats)) ;
*/
                sprintf(buff, "%s", G_get_cat(i, &cats)) ;
--------------------------------------------
PS I noticed these bugs when I first used GRASS 10 years ago, but
did not have access to source code back then. Someone should check
the first item on different hardware/operating systems before 
deciding whether to incorporate it into new GRASS releases. 10 years
ago it was a SUN/SunOS I think. The second item is cosmetic and
should perhaps be made a command line option (please make the
default no cat number!)

Leonard Coop
Dept IPPC & Entomology



More information about the grass-user mailing list