[GRASS-dev] Re: #339: d.mon doesn't work (WinGrass commandline)

Glynn Clements glynn at gclements.plus.com
Mon Oct 20 06:53:10 EDT 2008


Moritz Lennert wrote:

> >> Except that d.mon isn't specific to XDRIVER, nor is the lack of
> >> monitors on Windows.
> >>
> >> And AFAICT, the legacy display architecture was originally designed
> >> for Tektronix 41xx (and similar) terminals; X support came later.
> > 
> > Yes I think so too - IIRC in the 1987 GRASS promotional video you see an 
> > example of GRASS being used with a standalone graphics terminal.
> > 
> > How about for GRASS 7 on all platforms, turning d.mon into a script that 
> > runs an image display program that initialises the image it displays 
> > from GRASS_PNGFILE and automatically refreshes the display when the file 
> > is modified? If the display program was simple (I guess a very simple 
> > cross-platform PNG viewer might not be too difficult to implement?) it 
> > could be included in the GRASS source code and would be convenient for 
> > people to use all their favourite non-interactive d.* commands without 
> > having to run the GUI.
> 
> Just to add my 2 cents: I've successfully used gqview [1] in that 
> manner, i.e. leaving it open and displaying map.png. It automatically 
> updates the images when it changes. I bet there must be several other 
> programs that do the same, so I don't think we really need to program 
> anything. Maybe just offer a list of programs that users might consider.

Note that there's also visualisation/ximgview, which exists for this
purpose (although more as a proof-of-concept than anything).

One limitation of ximgview is that it only works for mmap()d BMP
files. The reason for this is so that it will never have to deal with
an incomplete file.

To use it:

	export GRASS_PNGFILE=map.bmp
	# create the file
	d.erase
	export GRASS_PNG_MAPPED=TRUE
	export GRASS_PNG_READ=TRUE
	ximgview map.bmp

Also, you can set:

	export GRASS_NOTIFY="kill -USR1 `pidof ximgview`"

This will cause R_close_driver() to send a signal to ximgview to
update the display, rather than waiting for it to poll. In that
situation, pass percent=1 to ximgview (percent=0 causes a
divide-by-zero).

At present, this mechanism won't work on Windows as the support for
memory-mapped files in the PNG and cairo drivers is Unix-specific
(mmap()).

I have been thinking about writing something similar in wxPython. The
main issue is that without GRASS_PNG_MAPPED, the viewer needs to be
robust against incomplete image files, and I don't know if this is
true for the built-in image handlers.

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


More information about the grass-dev mailing list