[GRASSLIST:9291] Re: make G_plot_line() persistant in monitor

Glynn Clements glynn at gclements.plus.com
Sun Dec 4 12:14:17 EST 2005


Dylan Beaudette wrote:

> I am writing a new module that draws to the active monitor using the function 
> G_plot_line (x, y, x+dx, y+dy); 
> 
> The line is drawn, but it is not persistant on the screen- in the way that the 
> output from something like d.grid would be. Poking around in the source code 
> for d.vect.thematic I found the following code, that *appears* to make the 
> lines persistant on the screen... but I am not sure how to interpret these 
> functions:
> -----------------from d.vect.chart ------------------------
> if(ret == 0) {
> 	D_add_to_list(G_recreate_command()) ;
>         D_set_dig_name(G_fully_qualified_name(map_opt->answer, mapset));
>         D_add_to_dig_list(G_fully_qualified_name(map_opt->answer, mapset));
> -----------------------------------------------------------------
> 
> inserting D_add_to_list(G_recreate_command())  into my new module seems to 
> make the line persistant, but why?

G_recreate_command() returns the command line which was used to run
the program. D_add_to_list() adds a command to a list stored within
the monitor. When the monitor window is resized, the driver runs all
of the commands in the list to redraw the window.

The list is also used to generate the output from d.save.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list