Modify

Opened 2 years ago

Closed 14 months ago

Last modified 13 months 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 Changed 2 years ago by skyper

Description: modified (diff)

comment:2 Changed 2 years ago by 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?

comment:3 Changed 2 years ago by skyper

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 Changed 2 years ago by 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?

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

comment:5 in reply to:  4 Changed 2 years ago by skyper

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" 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>
Last edited 2 years ago by skyper (previous) (diff)

comment:6 in reply to:  2 Changed 22 months ago by skyper

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 Changed 14 months ago by simon04

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

comment:8 Changed 14 months ago by simon04

Resolution: fixed
Status: assignedclosed

In 17662/josm:

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

comment:9 Changed 14 months ago by skyper

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

comment:10 Changed 14 months ago by skyper

Add to documentation: Tagging Presets (diff)

comment:11 Changed 13 months ago by skyper

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.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.