[GRASS-user] Label difficulties
Adam Dershowitz
adershowitz at exponent.com
Wed Aug 29 11:51:11 EDT 2007
On Aug 29, 2007, at 2:50 AM, Hamish wrote:
> Hamish wrote:
>>> maybe a way to process the text string with formatting codes to
>>> newlines automatically? (tcl is string friendly, so search and
>>> replace shouldn't be too hard, although I've no idea how)
>
> Ivan wrote:
>> It's rather simple:
>>
>> % set a {1\n2}
>> 1\n2
>> % subst -nocommands -novariables $a
>> 1
>> 2
>> %
>
>
> Thanks Ivan, that works! Applied in 6.3cvs.
>
> The border box still needs to be updated to count the number of
> lines in
> the string and adjust the background box width and height
> accordingly. For
> now you can just turn off the background box.
>
> Bug: I notice that if you try and change the PS label background box
> color or font color it just gets reset when you redraw the display.
>
> I've little idea about Tcl/Tk so I must leave these small tasks for
> someone else. The "sample" label file that comes with Spearfish has a
> \n newline in it to test with.
>
> I would hold off backporting the fixes to the 6.2.x branch until it is
> all working in 6.3cvs, then do it as a single patch.
>
>
Hamish,
you and a few others suggested that I could use r.blend. Initially
it did not work as expected. It turns out that my top map was
smaller than my basemap and that r.blend was still blending beyond
the border of the top map, so that the bottom map looked washed out.
I ended up editing r.blend to make it work as I expected. I am not
sure who this should go to, but let me suggest the following change
to r.blend:
Replace this:
r.mapcalc "$GIS_OPT_OUTPUT.r = r#$GIS_OPT_FIRST * .$GIS_OPT_PERCENT +
(1.0 - .$GIS_OPT_PERCENT) * r#$GIS_OPT_SECOND"
r.mapcalc "$GIS_OPT_OUTPUT.g = g#$GIS_OPT_FIRST * .$GIS_OPT_PERCENT +
(1.0 - .$GIS_OPT_PERCENT) * g#$GIS_OPT_SECOND"
r.mapcalc "$GIS_OPT_OUTPUT.b = b#$GIS_OPT_FIRST * .$GIS_OPT_PERCENT +
(1.0 - .$GIS_OPT_PERCENT) * b#$GIS_OPT_SECOND"
with this:
r.mapcalc "$GIS_OPT_OUTPUT.r = if(isnull($GIS_OPT_FIRST),r#
$GIS_OPT_SECOND, r#$GIS_OPT_FIRST * .$GIS_OPT_PERCENT + (1.0 - .
$GIS_OPT_PERCENT) * r#$GIS_OPT_SECOND)"
r.mapcalc "$GIS_OPT_OUTPUT.g = if(isnull($GIS_OPT_FIRST),g#
$GIS_OPT_SECOND, g#$GIS_OPT_FIRST * .$GIS_OPT_PERCENT + (1.0 - .
$GIS_OPT_PERCENT) * g#$GIS_OPT_SECOND)"
r.mapcalc "$GIS_OPT_OUTPUT.b = if(isnull($GIS_OPT_FIRST),b#
$GIS_OPT_SECOND, b#$GIS_OPT_FIRST * .$GIS_OPT_PERCENT + (1.0 - .
$GIS_OPT_PERCENT) * b#$GIS_OPT_SECOND)"
That way, in places where the top map is null it just leaves the
bottom map alone.
Is there a particular developer or other list that this suggestion
should be sent to?
Again, thanks for the help, and I do now have things working as I need.
More information about the grass-user
mailing list