Modify

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#19012 closed enhancement (fixed)

Tagging presets: Possibility to set "match" negative

Reported by: skyper Owned by: simon04
Priority: normal Milestone: 21.03
Component: Core Version:
Keywords: template_report tagging preset match false Cc: Klumbumbus

Description (last modified by skyper)

I need an option to exclude generic presets from Tags/Memberships panel and only show specific ones if objects contain certain tags. See wiki:Presets/MastAndTower for a real life example and ticket:6157:josm_6157_Preset_Debug.zip for a condensed one.

What steps will reproduce the problem?

  1. Have a general preset and a specific preset for the same main tag with both including same secondary tags
  2. Add main tag to object
  3. Add secondary tag to object

What is the expected result?

  • After 2. the general preset is linked to from Tags/Memberships panel
  • After 3. only the specific preset is linked

What happens instead?

After 3. generic and specific presets both are linked

Please provide any additional information below. Attach a screenshot if possible.

I could live with match="false" for now but I wonder how I could add a tag not present in the preset to match negative.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-03-30 07:18:28 +0200 (Mon, 30 Mar 2020)
Revision:16220
Build-Date:2020-03-30 23:25:33
URL:https://josm.openstreetmap.de/svn/trunk

Attachments (0)

Change History (11)

comment:1 by skyper, 4 years ago

Description: modified (diff)

comment:2 by simon04, 4 years ago

For relation <role>s, we use member_expression to test for matches. Would a similar attribute be helpful for a preset <item> as well?

comment:3 by skyper, 4 years ago

Well for keys within the preset match="negKey/negKeyValue" or similar should work and looks much easier.

Overall a complete search expression is much more flexible and would cover the case that the key is not present in the preset.

comment:4 by simon04, 4 years ago

I guess the crucial part of the example is the following:

<item name="General preset Tower">
  <key key="man_made" value="tower"/>
</item>
<item name="Small communication tower">
  <key key="man_made" value="tower"/>
  <key key="tower:type" value="communication"/>
</item>

For a node man_made=tower tower:type=communication only the second preset should match?

Where/how would you specify match="negKey/negKeyValue"?

in reply to:  4 comment:5 by skyper, 4 years ago

Replying to simon04:

I guess the crucial part of the example is the following:

<item name="General preset Tower">
  <key key="man_made" value="tower"/>
</item>
<item name="Small communication tower">
  <key key="man_made" value="tower"/>
  <key key="tower:type" value="communication"/>
</item>

For a node man_made=tower tower:type=communication only the second preset should match?

Yes, this is without the key in the first item and the general approach.

Where/how would you specify match="negKey/negKeyValue"?

My preset looks like this:

<item name="General preset Tower">
  <key key="man_made" value="tower"/>
  <multiselect key="tower:type" text="Type of tower" values_searchable="true" values_sort="false" rows="11" match="negKey">
    <list_entry value="bell_tower" display_value="Bell tower" icon="Tower_bell_tower.svg" />
    <list_entry value="communication" display_value="Small communication tower" icon="Tower_cantilever_communication.svg" />
    <list_entry value="cooling" display_value="Cooling" icon="Tower_cooling.svg" />
  </multiselect>
</item>
<item name="Small communication tower">
  <key key="man_made" value="tower"/>
  <key key="tower:type" value="communication"/>
</item>
Version 0, edited 4 years ago by skyper (next)

in reply to:  2 comment:6 by skyper, 4 years ago

Cc: Klumbumbus added

Replying to simon04:

For relation <role>s, we use member_expression to test for matches. Would a similar attribute be helpful for a preset <item> as well?

Definitely! Never used it, but it looks like the need extension also for preset links

I just noticed the problem is already present in defaultspresets, meanwhile. Have a look at a bus stop with bus=yes. The "Access Restriction" preset is linked.

comment:7 by simon04, 3 years ago

Milestone: 21.03
Owner: changed from team to simon04
Status: newassigned

comment:8 by simon04, 3 years ago

Resolution: fixed
Status: assignedclosed

In 17662/josm:

fix #19012 - Tagging presets: additional matching criteria via <item match_expression="...">

comment:9 by skyper, 3 years ago

Thanks, so defaultpresets can profit from this for now, as my presets have to wait at least a few months, see #20667.

comment:10 by skyper, 3 years ago

Add to documentation: Tagging Presets (diff)

comment:11 by skyper, 3 years ago

Does this work? See #20843.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain simon04.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.