Modify

Opened 5 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#17483 closed defect (fixed)

[Patch] Selection menu doesn't respect filters

Reported by: j2tracey@… Owned by: team
Priority: normal Milestone:
Component: Plugin utilsplugin2 Version:
Keywords: template_report selection filter Cc:

Description

What steps will reproduce the problem?

  1. Create a filter (simplest to demonstrate if it filters almost everything; e.g., "-(name=highway_name)" to filter all but a single road -- in my case, I'm selecting only water features).
  2. Pick an option from the Selection menu that selects other objects from the current selection (e.g., "Adjacent ways", Shift-E).
  3. Observe the list of selected items.

What is the expected result?

Selected items should be subject to filters, so that nothing blocked by the filter is selected.

What happens instead?

Selection ignores filters, and will include ways and nodes which should not be selectable.

Attachments (2)

17483.diff (9.7 KB) - added by j2tracey@… 5 weeks ago.
patch
17483-v2.diff (13.8 KB) - added by j2tracey@… 5 weeks ago.
Second attempt at a patch (replaces original)

Download all attachments as: .zip

Change History (13)

comment:1 Changed 5 weeks ago by Don-vip

Keywords: selection filter added
Summary: Seletion menu doesn't respect filtersSelection menu doesn't respect filters

Changed 5 weeks ago by j2tracey@…

Attachment: 17483.diff added

patch

comment:2 Changed 5 weeks ago by anonymous

Summary: Selection menu doesn't respect filters[Patch] Selection menu doesn't respect filters

comment:3 Changed 5 weeks ago by GerdP

I've tried the patch. I think it works fine for "Shift+E" but classesSelectModNodesAction and SelectModWaysAction need more work.

Changed 5 weeks ago by j2tracey@…

Attachment: 17483-v2.diff added

Second attempt at a patch (replaces original)

comment:4 in reply to:  3 Changed 5 weeks ago by anonymous

Replying to GerdP:

I've tried the patch. I think it works fine for "Shift+E" but classesSelectModNodesAction and SelectModWaysAction need more work.

Should be fixed in the second patch. Fixed a few other bugs I found while testing the other menu items as well (I had assumed all the work was being done in the utils class, and therefore only made sure to test those methods, sorry about that).

comment:5 Changed 5 weeks ago by GerdP

Yes, looks better. I just don't know if the filter should work like this because I rarely use filters.
Example: When I search for objects which are filtered and I enable the checkbox for "all objects" the result list in the selection window will contain the filtered objects. Double-Clicking on one of the objects results in an empty selection list, but pressing the Delete key will remove them. If I got that right you would not want that to happen?

comment:6 in reply to:  5 Changed 5 weeks ago by j2tracey@…

Replying to GerdP:

Yes, looks better. I just don't know if the filter should work like this because I rarely use filters.
Example: When I search for objects which are filtered and I enable the checkbox for "all objects" the result list in the selection window will contain the filtered objects. Double-Clicking on one of the objects results in an empty selection list, but pressing the Delete key will remove them. If I got that right you would not want that to happen?

I don't think I understand. When I search right now, with or without my patch, the results don't include objects which were filtered out. But I also don't see any "all objects" checkbox, where is that located? Is there a different search dialogue I should be using?

In any case, yes, I think being able to delete an object while it is filtered out should not be possible (or at least be difficult), as that seems like unintuitive behavior. Right now, if I try to modify an object which is filtered out, e.g., by moving a node which is shared by a filtered and an unfiltered way, JOSM throws an error in my face explaining that's probably not what I intended (and indeed, it almost never is).

As for why I want the selection menu items to not select filtered out objects (aside from it being closer to how I expect filters behave, in that objects filtered out should not be selectable), here are some examples:

  • Create a filter for "waterway=* | *=water", then invert it. Select any waterway, then choose "All connected ways" from the Selection menu, repeatedly. You will see, spanning out 15 ways deep at a time, the entire watershed of that waterway. See some things that aren't being selected even though they should? You probably found a disconnected waterway to fix.
  • My hometown has several features that comprise a boundary. I'd like to select all of them, using the "Area boundary" menu item in the Selection menu. However, being a suburb in a metropolitan area, every single one of those features is a boundary for other cities/counties as well, and it keeps selecting the wrong one. Add an inverted filter for my hometown's name, and suddenly it knows which one I'm aiming for.
  • I can now select every stream that runs under an urban highway (The selection commands involving "intersecting ways" are now far easier to use in an efficient manner with the right filters; previously it would take too long to do anything useful in dense areas)
  • I can view all tags for all nodes on a river, excluding the noise from nodes tagged as dams (this can be done with search as well, but using filters allows it to persist while editing)

These are just a few usecases I've found in the couple days since I wrote the patch for myself. I'm guessing others could find even more powerful uses for it in other areas aside from watershed edits.

comment:7 Changed 5 weeks ago by GerdP

You have to enable the expert mode to see the "all objects" checkbox.

comment:8 in reply to:  7 Changed 5 weeks ago by j3tracey@…

Replying to GerdP:

You have to enable the expert mode to see the "all objects" checkbox.

Ah, that makes sense. The description says it includes incomplete and deleted objects -- both things that already aren't included in the selections created from the Selection menu. So I think it's fine that objects which are filtered out are also included when checking that box, since it's apparently designed to intentionally invoke atypical behavior. I suppose then I'm saying that the interface should treat objects that are filtered out as (approximately) the same as objects which are deleted; i.e., they should be unselectable unless you've gone out of your way to select them.

comment:9 Changed 5 weeks ago by GerdP

OK, sounds reasonable. If nobody complains I'll commit the patch on tomorrow.

comment:10 Changed 5 weeks ago by GerdP

Resolution: fixed
Status: newclosed

fixed with [o34932:34933]
Thanks for the patch!

comment:11 Changed 5 weeks ago by j2tracey@…

Awesome, thank you!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
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.