[Mapcss] Nesting Selectors

Komяpa me at komzpa.net
Sat Apr 28 07:51:22 BST 2012


Hi!

> This would allow an object to be checked for the existence of a highway tag (for example) exactly once

I'm not sure that it's the thing worth implementing.
All this stuff can be guessed by engine on stylesheet parse time,
considering you support "exit" statement. I still think it's a hack,
and for me (in both komap / kothic js) stylesheet gets compiled into
native python/js code, so it's fast anyway.

If you want to omit a lot of consecutive checks, you can make a
bitfield cache for the most popular rules. So, on parse time:

 - determine the most popular (8/16/32/64 - unsure of architecture)
rules, number these as 2^i;
 - for each {style} block in sheet, remove rules that went to cache
and add a single integer that will store a sum of cached rendering
rules numbers (say "style_rules");
 - on rendering time, as a first pass do all cached checks and store
in a single integer as a sum of passed checks (say "obj_rules");
 - later, on doing checks against each {} block, do a check for
((obj_rules AND style_rules) EQ style_rules).

kinda that. If you do decomposition right ([amenity=telephone] is two
rules, [amenity][amenity=telephime]), you'll gain some speeds without
bringing ugly non-css into mapcss, and even on stylesheets written not
in your way.

-- 
Darafei "Komяpa" Praliaskouski
OSM BY Team - http://openstreetmap.by/
xmpp:me at komzpa.net mailto:me at komzpa.net



More information about the Mapcss mailing list