[Mapcss] Subpart syntax

Sebastian Klein bastikln at googlemail.com
Thu Feb 24 11:23:40 GMT 2011


Steve Bennett wrote:
> On Fri, Feb 4, 2011 at 5:46 AM, Sebastian Klein <bastikln at googlemail.com> wrote:
>> Its a draft, so if you have suggestions / criticism, we should discuss it.
>>
>> Let me suggest to change the symbol from double colon to something
>> unoccupied, e.g. a slash:
>>
>> way[access=private]::access  --->   way[access=private]/access
>>
>> The CSS spec has ::first_letter and ::before as examples for so called
>> pseudo elements [1]. The first makes the rule apply only to the first letter
>> and the latter inserts text like paragraph numbering into the document [2]
> 
> I just noticed this thread. First, can I check my understanding of the
> goal here. MapCSS currently allows multiple things to be rendered for
> a single rule, but only if they have distinct z-indexes. Any
> information from a single rule for a given z-index is merged. So what
> this aims to do is remove that limitation: multiple, independent
> renderings of a single rule, possibly on the same z-index.

The z-index looks like an innocent property, but in fact it does a lot 
behind the scenes. The idea is to demote z-index to an ordinary property 
(that can be overridden by subsequent rules) and make the rendering of 
new parts more explicit.

My basic use case is the following (JOSM):

You have a list of styles that the user has activated [1]. Usually there 
is one base style and then a couple of styles provided by other users [2]:

  * parking lanes
  * max speed
  * highlight of modified objects
  * more POI symbols (e.g. for sea maps)
  ...

Now as a style sheet author, you usually like to put your stuff on a 
different layer. How do you know, that a certain z-index is still available?

At the same time, it should be possible to _modify_ the rules from the 
base style. (That's what the "cascading" css is all about, right.) E.g. 
in the last example (more POI symbols) it doesn't make sense to have 2 
symbols of different size, overlapping each other. You either replace 
the symbol or keep the old.

This is my "requirement" and I'm open for ideas, that solve it in a 
elegant and easy-to-use way.


Sebastian

[1] https://josm.openstreetmap.de/wiki/Help/Dialog/MapStyleDialog
[2] https://josm.openstreetmap.de/wiki/Styles
my proposal: 
<http://wiki.openstreetmap.org/wiki/Talk:MapCSS/0.2#Dealing_with_z-index_and_cascades_more_sensibly>


PS: it was a dumb idea to replace "::" by "/". Then ::* would become /* 
and this would start a comment. :)



More information about the Mapcss mailing list