width option in d.vect

Ronald Wiemer ronald at masscomp
Mon Aug 29 10:33:28 EDT 1994


In fact I have a version of d.vect that lets you specify color and linewidth.
But, in order to achieve this you will have to change a number of things 
in your source code. The modifications you make will only give results when
you use the XDRIVER for display.

I have modified the raster library, the Xdriver, and recompiled every program 
that displays things on the graphics window.

This is what you have to do:

Create a file in $GISBASE/src/raster called

#include "graph.h"

	int index;
	int i;
	i = index;
	_send_ident(LINEMOD) ;


This function is called by every program that wants to change the linewidth.

Then you have to add the line


in the file $GISBASE/libes/raster/io/c.

after the lines:

sync_driver(name); /* syncronize driver */

and recompile the the raster library. Don't forget to add the Linemod.c in the

Next you have to do is modifying your Xdriver.
Edit the file:


Uncomment the line

/* Linemod(index);   */

Create a file 



#include <stdio.h>
#include "includes.h"

extern Display *dpy;
extern GC gc;

int number;
	XSetLineAttributes (dpy, gc, number, NULL, NULL, NULL );

and recompile your XDRIVER. (Don't forget to add Linemod.c in the Gmakefile)

Now the basics is done. In fact you can now use  the R_linemode() call in your 

For d.vect it's simple, just edit the file:


edit the line

int i, stat ;

to be

int i, stat, width ;

edit the line

struct Option *opt1, *opt2;

to be

struct Option *opt1, *opt2, *opt3;

Insert the following lines ;

Opt3 = G_define_option() ;
opt3->anser = "0" ;


opt2->description="Color desired for drawing map";

The last thing you have to do is add the line:


after the line


Now recompile d.vect.

If you would not recompile all other display programs, and you would interrupt 
the d.vect program, any other program would draw lines in the last selected 

I have another program which uses a lookup table for setting colors and line-
widths, based on attributenumber. This program is called d.vect.lu, An older
version in the incoming directory on moon. As soon as I have time, I will
put a new version there, which also takes linewidth into account.

Ronald Wiemer

More information about the grass-dev mailing list