[GRASS5] Re: [NVIZ] Code for PPM dumps

Markus Neteler neteler at geog.uni-hannover.de
Mon Sep 25 09:08:34 EDT 2000


Hi Bob,

many thanks for your patches. I have applied them to CVS
(hope it's o.k. for all developers). The PPM format is
more common than the SGI image format. Probably a selection
window on image format would be perfect.

On Sun, Sep 24, 2000 at 10:51:04PM -0300, Bob Covill wrote:
> Hello,
> 
> I am attatching to this e-mail the code I have added to NVIZ to dump
> images to a PPM format. I have written out the installation steps, so
> hopefully it is not to complicated.
> 
> The first two files that should be incorporated are "Gmakefile" and
> "gsd_img_ppm.c". These two files should be copied to
> "$GISBASE/src/libes/ogsf". The "gsd_img_ppm.c" is a modified version of
> the routine to dump RGB files. It creates a new library routine entitled
> "G_write_ppm".
Here your Gmakefile does not fit any more to the current Gmakefile as
file name conflicts on Windows had to be fixed earlier this summer. I
have adjusted it, it compiles o.k. now.
 
> Note the image dump routine is byte order sensitive. The file
> "gsd_img_ppm.c" is currently set for a big-endian machine (eg. SUN). To
> build the library on a small-endian (linux) machine comment out lines 34
> to 36, and uncomment lines 38 to 40. There is a note in the code where
> this needs to be done. After copying the new files execute gmake5 to
> rebuild the ogsf library.

Here I have inserted a #ifdef statement.

#ifdef SUN
 /*big endian*/
  ...
else
 /*little endian*/
  ...
#endif

I think something with config.h to detect little/big endian would be
better than hard-code the platform names here. Feel free to modify it.

> The next two files; "anim_support.c" and "init_commands.c" should be
> copied to $GISBASE/src.contrib/GMSL/NVIZ2.2/src. These files will
> overwrite existing files. These files utilize the above PPM lib routine
> and create an NVIZ command entitled "Nwrite_ppm". This is the command
> that will be called from the nviz scripts. After adding the above two
> files, execute gmake5 to rebuild the NVIZ2.2 executable to incororate
> the new command.
> 
> After completing the above, three TCL scripts can be modified to execute
> the new dumping routine. The scripts are; "nviz2.2_script",
> "panel_animation.tcl", and "panel_kanimator.tcl".  I have also attached
> these three scripts. They can be placed in
> $GISBASE/src.contrib/GMSL/NVIZ2.2/scripts.
> 
> With the above changes execute gmake5 from
> $GISBASE/src.contrib/GMSL/NVIZ2.2 to install the updated scripts in the
> proper location.
> 
> Images should now be dumped to a *.ppm format.
Yes, working o.k. on Linux (no bad magic number problems!).
 
> If there are any problems or questions let me know. I have built and
> used the routines on both a Sun Sparc and Linux.
> --
> Bob Covill
> 
> Tekmap Consulting
> P.O. Box 2016
> Fall River, N.S.
> B2T 1K6
> Canada
> 
> E-Mail: bcovill at tekmap.ns.ca
> Phone: 902-860-1496
> Fax: 902-860-1498
> 

Many thanks, Bob. Your contribution will become part of the next GRASS 5
release.

Kind regards

 Markus Neteler

-- 
Dipl.-Geogr. Markus Neteler *  University of Hannover
Institute of Physical Geography and Landscape Ecology
Schneiderberg 50 * D-30167 Hannover * Germany
Tel: ++49-(0)511-762-4494  Fax: -3984

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list