Opened 15 years ago

Last modified 5 years ago

#6129 new enhancement

[PATCH] have even more flexiblity in mapcss — at Version 3

Reported by: cmuelle8 Owned by: team
Priority: normal Milestone:
Component: Core mappaint Version:
Keywords: Cc:

Description (last modified by cmuelle8)

Hi,

I wondered why the follow mapcss was not working:

relation[type=route][wiki:symbol] > way
{
    wicon: get_tag_value("wiki:symbol");
    is-cycle-route: true;
}

way[eval(prop(is-cycle-route))] > node
{
    icon-image: eval(concat(SOMEURL, prop("wicon")));
}

If we have descendant selectors, the trouble is, that the parents Environment is created from scratch. The patch attached hashes the environment in ElemStyles and makes it possible to question the proper environment of the parent when descendant selectors (+cond) are used. Moreover I put some patches into Expression to make it possible to query the parents environment in the childs rules. So the following works:

relation[type=route][wiki:symbol] > way
{
    icon: get_tag_value("parent.wiki:symbol");
    is-cycle-route: true;
}

way[eval(prop(is-cycle-route))] > node
{
    icon-image: eval(concat(SOMEURL, prop("parent.icon")));
}

With "parent." we can reference the environment of the parent in the descendant selector. This makes it possible to extract symbols out of relations and style the nodes accordingly.

Currently I'm missing a way to find out the correct URL of a wp commons image if I just have the filename (as is tagged on some relations with wiki:symbol). The idea is to add yet another function to Expression class that is able to find out the right url for us, maybe find_wiki_symbol(filename).. So ATM it works only if you build the URL yourself (with concat) or if the whole URL is supplied in the primitive's tag.

Another nice thing would be a "osmc:symbol" decoder in ImageProvider, or directly in mappaint's node code..

Regards,
Christian

Change History (4)

by cmuelle8, 15 years ago

have more mapcss features..

comment:1 by cmuelle8, 15 years ago

Type: defectenhancement

comment:2 by cmuelle8, 15 years ago

Ticket #6122 has been marked as a duplicate of this ticket.

comment:3 by cmuelle8, 15 years ago

Description: modified (diff)

typo fixed..

Note: See TracTickets for help on using tickets.