[GRASS5] d.legend with vector file support

Hallo developers,
thanks Hamish and Glynn, things have moved fast forward and I would like to give you some
patches and new files for d.legend, which should enable d.legend to make legend
from database table of vector files (according to GRASSRGB column).

You can use "type" option, however points are not supported yet, but
"boundary", "line", "area" and "face" are.

I have still some problems whith layouting the color boxes, I hope to get it
somehow work..

After moving the code to separate file, I get warnings:

    ...
    vector.c:213: warning: passing arg 1 of `R_RGB_color' with different width due to prototype
    ...

and I don't know what to do with this

In main.c are only minor changes, the most importand part of the code are two
functions stored in vector.c

I hope, it will be usable, looking forward to your comments

Jachym
--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/

(attachments)

d.legend.patches.tar (20 KB)

sorry

if you run this with raster map, you get segfault, sorry for this, here comes
the patch which solves this, it should be applayed after the patch from my
first e-mail.

the module has not been much tested, so I'm expecting other problems..

Jachym

On Tue, May 17, 2005 at 09:41:36PM +0200, Jachym Cepicky wrote:

Hallo developers,
thanks Hamish and Glynn, things have moved fast forward and I would like to give you some
patches and new files for d.legend, which should enable d.legend to make legend
from database table of vector files (according to GRASSRGB column).

You can use "type" option, however points are not supported yet, but
"boundary", "line", "area" and "face" are.

I have still some problems whith layouting the color boxes, I hope to get it
somehow work..

After moving the code to separate file, I get warnings:

    ...
    vector.c:213: warning: passing arg 1 of `R_RGB_color' with different width due to prototype
    ...

and I don't know what to do with this

In main.c are only minor changes, the most importand part of the code are two
functions stored in vector.c

I hope, it will be usable, looking forward to your comments

Jachym
--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/

(attachments)

main.c.patchII (368 Bytes)

Jachym Cepicky wrote:

After moving the code to separate file, I get warnings:

    ...
    vector.c:213: warning: passing arg 1 of `R_RGB_color' with different width due to prototype
    ...

and I don't know what to do with this

The red/green/blue fields of struct Vcat_clrs are of type int, but the
arguments to R_RGB_color() are of type unsigned char.

Either change the struct Vcat_clrs fields to unsigned char, or
explicitly cast the arguments to R_RGB_color(), e.g.:

  R_RGB_color(
    (unsigned char) vcat_clrs[i].red,
    (unsigned char) vcat_clrs[i].green,
    (unsigned char) vcat_clrs[i].blue);

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

New patches for d.legend. Thanks Martin, some functions have been improved.

    I added the flag -t (for vector), you never know, if there are not
                             ---^--
    two maps (raster and vector) with the same nema in GRASSDBASE.

    It would be good to solve points somehow. Maybe there should be other
    column in dbfile for vector points: except GRASSRGB for color GRASSPOINT
    for point type... and in the future GRASSLINE, GRASSAREA ...
    Anyway, I did not understand, how to draw point symbols to GRASS-monitor,
    if someone could give me some hint.

To the problem with R_RGB_color(), Glynn showed me, that it shoudl get unsigned
chars. I tryed to change it, but it did not help :frowning: I must be blind...

I'm sending new patches, which should be applied at fresh CVS version of
d.legend, so *not* over the patches, I sended last time.. sorry, If I'm doing
something wrong, this seems to me as the best way...

I'm sending new improved d.vect.leg2 too. It uses new d.legend funcionality.

Looking forward to your comments

Jachym
--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/

(attachments)

d.legend.patches.tar (30 KB)
d.vect.leg2 (2.53 KB)