[GRASS-dev] improved d.labels rendering

Wolf Bergenheim wolf+grass at bergenheim.net
Tue Apr 17 01:47:18 EDT 2007

On 17.04.2007 07:34, Hamish wrote:
> Wolf wrote:
>> I haven't tested multi-line labels, but rotation seems to work nicely.
>> There is however a bug. If there is a space between the ':' and the
>> label text, the space becomes part of the label and thus the label is
>> shifted to the right by one space. I have worked around this in
>> v.label.sa by not adding a space between the ':' and the label text.
> this is a bug in the rendering stage, not at the labels file creation
> stage (there is nothing wrong with the labels file). Fixed last week in
> d.labels/do_labels.c revs 1.20,1.21 with the improved rotation code.

Yes, exactly as I said. However it isn't fixed (see attached screen
shots; with_space.png and without_space.png)

> ps.map was already working correctly.

I haven't tested.

>> I have also attached a patch which will add support for a label
>> position "none none", which simply means to place the label at the
>> exact point given (no shifting in any direction).
> how does that differ from center,center (the default)? or is it "raw",
> which is {R_move_abs(x,y); R_text(string);} in that case how does
> none,none differ from the lower,left case?
> (why is this useful?)

I want the lower left corner of the text should go exactly on the point
given in the labels file. center,center puts the center of the text, and
lower,left put the lower left, but with some magic adjustment. So I
guess it is sort of "raw". In v.label.sa I calculate the exact position
of a label and it may not be shifted, or else the algorithm doesn't hold.

If someone could just verify that the attached patch works, I can commit
it. (I have made it against the most recent CVS version)



<:3 )---- Wolf Bergenheim ----( 8:>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: with_space.png
Type: image/png
Size: 18726 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070417/9a8c80a6/with_space.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: without_space.png
Type: image/png
Size: 13257 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070417/9a8c80a6/without_space.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: display~d.paint.labels~do_labels.c.diff
Type: text/x-patch
Size: 2525 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070417/9a8c80a6/displayd.paint.labelsdo_labels.c.bin

More information about the grass-dev mailing list