[Mapcss] relative width for overlays
Sebastian Klein
bastikln at googlemail.com
Sat Oct 2 20:29:25 BST 2010
Hi,
Thanks for you answers! Because it is so common, I was tempted to use a
shortcut:
width: +4;
But maybe it is not a good idea to introduce too many special rules.
As a shorter notation for
width: eval(num(prop("width", "default"))+4);
I then came up with
width: default::width + 4;
but it's basically the same, so I don't mind.
Sebastian
Komяpa wrote:
>>> I would like to create transparent overlay for bridges and tunnels that
>>> is 4 pixels wider than the main line style. How can this be done without
>>> repeating all highway types?
>> In Halcyon this is done by accessing a special '_width' variable, which has
>> the width of the widest rendered stroke, so:
>>
>> way :selected { z-index: 2; width: eval('_width+10'); color: yellow;
>> opacity: 0.7;}
>>
>> (see
>> http://svn.openstreetmap.org/applications/editors/potlatch2/net/systemeD/halcyon/styleparser/StyleChooser.as
>> and, in particular, tags['_width']=sl.maxwidth; r.runEvals(tags);)
>>
>> As ever, very open to better ways of doing it. :)
>
> The question is not as simple as it seems.
> You need to get a width of stroke on another sublayer. For now,
> proposed eval() syntax lets you get only properties from current
> sublayer.
>
> What I propose is to allow prop() have an optional second argument -
> name of sublayer to get properties from. So I'd propose:
>
> way[bridge=yes]::bridge-over {
> color: #000080;
> opacity: 0.5;
> z-index: 0.01;
> width: eval(num(prop("width", "default"))+4);
> }
>
> Any better ideas?
>
More information about the Mapcss
mailing list