Opened 5 years ago
Last modified 2 years ago
#19190 new enhancement
Option to set and call variables in tagging presets and validator rules
Reported by: | skyper | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | variable tagging preset rule | Cc: |
Description
I often find myself copy & pasting value strings which are identical in presets.
An option to define that string in a variable and call it later would make life much easier, especially, when updating values and in terms of consistency.
<combo key="turn:lanes:forward" text="Turn lanes in way direction" values="left|left,left|through,left;through|through,left;through|through;right,left|through;right,left;through|right,through|through,through|through;right,through|right,right|right,none|right,left|none,left|through|right,left|through|through;right,left;through|through|right,left;through|through;right|right,left|left;through|through|right,left|through|through;right|right,left|through|through|right,merge_to_right|merge_to_left,none|merge_to_left,merge_to_right|none,reverse|sharp_left;left|slight_left|through|slight_right;right|sharp_right|none" values_searchable="true" values_sort="false" match="key" /> <combo key="turn:lanes:backward" text="Turn lanes opposed to way direction" values="left|left,left|through,left;through|through,left;through|through;right,left|through;right,left;through|right,through|through,through|through;right,through|right,right|right,none|right,left|none,left|through|right,left|through|through;right,left;through|through|right,left;through|through;right|right,left|left;through|through|right,left|through|through;right|right,left|through|through|right,merge_to_right|merge_to_left,none|merge_to_left,merge_to_right|none,reverse|sharp_left;left|slight_left|through|slight_right;right|sharp_right|none" values_searchable="true" values_sort="false" match="key" />
Would change to:
<var name="turnlane" value="left|left,left|through,left;through|through,left;through|through;right,left|through;right,left;through|right,through|through,through|through;right,through|right,right|right,none|right,left|none,left|through|right,left|through|through;right,left;through|through|right,left;through|through;right|right,left|left;through|through|right,left|through|through;right|right,left|through|through|right,merge_to_right|merge_to_left,none|merge_to_left,merge_to_right|none,reverse|sharp_left;left|slight_left|through|slight_right;right|sharp_right|none" /> <combo key="turn:lanes:forward" text="Turn lanes in way direction" values="match_var(turnlane)" values_searchable="true" values_sort="false" match="key" /> <combo key="turn:lanes:backward" text="Turn lanes opposed to way direction" values="match_var(turnlane)" values_searchable="true" values_sort="false" match="key" />
Similar is true for, e.g., long regex in validator rules. Again, a variable could solve the problem.
Attachments (0)
Change History (2)
comment:1 by , 5 years ago
comment:2 by , 2 years ago
There is already a solution for this for values: using a list of list_entry elements in a chunk. See https://github.com/simonpoole/beautified-JOSM-preset/pull/355
Oh, according to wiki:Help/Styles/MapCSSImplementation#Userdefinedproperties it should work for validator rules but I did not understand it. What do I do wrong or does the feature not work?