Opened 16 years ago
Closed 16 years ago
#2602 closed enhancement (fixed)
[PATCH] Search keywords "child" and "parent"
Reported by: | Matt | Owned by: | team |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Core | Version: | |
Keywords: | search | Cc: |
Description
It has been noted that search keywords for parent/child relationships would be useful, http://www.mail-archive.com/josm-dev@openstreetmap.org/msg01869.html
Attachments (3)
Change History (8)
by , 16 years ago
Attachment: | josm.child-parent-search.patch added |
---|
follow-up: 2 comment:1 by , 16 years ago
Summary: | Search keywords "child" and "parent" → [PATCH] Search keywords "child" and "parent" |
---|
comment:2 by , 16 years ago
Nice patch, but the child and parent operators can't be used in conjunction with any other search terms. I.e. "type:way" and then "child" works for finding all nodes which belong to ways, but "type:way child" doesn't. Neither does combining them with anything else.
And "parent child" doesn't work, which I would expect to find all relations a way belongs to and all of its nodes when I have a way selected that's a member of a relation.
follow-up: 4 comment:3 by , 16 years ago
Here's a better patch, which allows expression "arguments" to the parent and child keywords. For example, to select all neighbouring ways of a selected way, "parent(child(selected)) type:way" works nicely. The parentheses are optional for single-argument expressions, but its more readable to keep them. (i.e: the above could have been "parent child selected type:way")
by , 16 years ago
Attachment: | josm.child-parent-search.2.patch added |
---|
A better patch for parent/child relationship search.
comment:4 by , 16 years ago
Replying to Matt:
Here's a better patch, which allows expression "arguments" to the parent and child keywords. For example, to select all neighbouring ways of a selected way, "parent(child(selected)) type:way" works nicely. The parentheses are optional for single-argument expressions, but its more readable to keep them. (i.e: the above could have been "parent child selected type:way")
This minor patch improves upon your patch:
- "child" or "parent" i.e. without argument is no longer a NullPointerException but equivalent to "parent()" or "child()" respectively. I.e. it'll match everything that's the child or parent of some other object. I thought about making it an error about "child/parent without argument" but that would be inconsistent with the rest of the search syntax where omitting optional expressions always means "match everything".
- The operators now stringify to child() and parent() instead of childof() and parentof()
Other than that I've tested this patch extensively and it's working just as expected. I can now do, for example:
parent(parent(type:node ^highway$:^traffic_signals$) ^highway$:^trunk$) ^type$:^route$
To select all route relations which cover trunk ways which have a traffic signal.
by , 16 years ago
Attachment: | josm.child-parent-search.3.patch added |
---|
attachment:josm.child-parent-search.3.patch with minor fixes
Patch to add "child" and "parent" keywords to search.