Sebastian Spaeth wrote:
Heureka! ceux does multi-strokes with subparts now
I had to try quite a lot of options and rewrite a bit of code, but it
seems to work fine now. Let me describe the strategy I chose:
1) For each element, if there are only "generic" rules (without any
subparts specified), render that as one stroke/fill. So:
way [natural] {fill-opacity: 0.4;} way [natural] {fill-color:black;}
will fill an area blackish-transparent.
2) As soon as there is at least one subpart specified that matches an
element, we won't draw the generic stroke/fill, but only the subpart
ones, so this:
way [natural=water]::area { z-index: -0.1; fill-color: #b5d6f1;
color: #b0b0b0;} way [natural=water]::label { z-index: 5; width: 0;
casing-width:0; text: name;} way [natural] {fill-opacity: 1.0; width:
1; color: black;}
will do 2 and not three strokes: the ::area and the ::label stroke.
It will use the style rules from the generic one as base, but rules
given for the subparts will always override the stroke style for that
subpart (even if the generic rule comes later in the file). That
means the above three rules are equivalent to these 2:
/* Next rules gets fill-opacity, width, but NOT color from the
generic as color is specified in the ::area rule */ way
[natural=water]::area { z-index: -0.1; fill-color: #b5d6f1; color:
#b0b0b0; fill-opacity: 1.0; width: 1;} /* Next rules gets
fill-opacity, color, but NOT width from the generic */ way
[natural=water]::label { z-index: 5; width: 0; casing-width:0; text:
name; fill-opacity: 1.0; color:black;}
To sum it up, generic styles provide the base and subpart styles
complement and override specific styles. If there are only generic
styles, render that as 1 stroke, but as soon as there are subparts,
don't render the generic one.
In my implementation: way [highway]::* is a synonym for "way
[highway]" (the generic) which matches all subparts.
In my implementation: way [highway]:: refers to a specific subpart
(call it __unnamed__)
Does this make sense?
Happy SOTM or where ever you are. Sebastian
Sounds good, I like the fact it is backwards compatible to style sheets
without subparts.
Question: You say that subpart styles override generic style even if it
comes later in the file. And the line
way [highway]::*
suggests that it applies to all subparts and consequently overrides them
all if it comes later in the file. But you write it is synonym to "way
[highway]", could you clarify?
Btw., it could be useful to be able to override style for all subparts:
E.g. override the anti-aliasing for efficiency or make everything
transparent (by a certain factor (?)), ...
What is
way [highway]::
and how is it used?
Regards, Sebastian
_______________________________________________
Mapcss mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/mapcss