#7253 closed enhancement (fixed)
[patch] ImproveWayAccuracy plugin patch to allow deleting nodes
Reported by: | ToeBee | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin | Version: | |
Keywords: | patch, ImproveWayAccuracy | Cc: | ToeBee, JoshD |
Description
Here is a patch for the ImproveWayAccuracy JOSM plugin that allows it to delete superfluous nodes by holding down ALT. I have been using this feature for several months now and find it extremely helpful, especially when improving over-noded TIGER ways. I blogged about it and was encouraged to submit a patch by JoshD. So here it is.
In addition to the delete code, I changed it to use the built in JOSM mouse cursor image for the "add node" mode instead of the one that was bundled with this plugin so the add_node.png file can be removed from the images/cursor/modifier/ directory of this plugin.
It only deletes a node if it has a single parent. Otherwise it would be too easy to mess up topology or a relation without knowing it.
The only catch is that some window managers in Linux use ALT+mouse1 to drag windows and eat the ALT+click event. I don't use that so it isn't a big deal for me to turn it off.
Attachments (1)
Change History (12)
comment:1 by , 13 years ago
Component: | Plugin → Plugin improvewayaccuracy |
---|
comment:2 by , 13 years ago
Cc: | added |
---|
follow-up: 4 comment:3 by , 13 years ago
Well SHIFT+CTRL is already a valid key combo in this plugin. I don't know if I've ever actually used that mode and I'm not sure it is all that useful really... but it exists. Maybe the less useful one should be moved to ALT and delete should be SHIFT+CTRL?
As for tagged nodes, that is probably a decent suggestion. I'm guessing tags like source/created_by/attribution should be excepted? I know the JOSM filter has the conecpt of "untagged" which ignores certain tags. Is there an easy method to easily check if a node is "untagged" according to these rules?
comment:4 by , 13 years ago
Replying to ToeBee:
Well SHIFT+CTRL is already a valid key combo in this plugin. I don't know if I've ever actually used that mode and I'm not sure it is all that useful really... but it exists. Maybe the less useful one should be moved to ALT and delete should be SHIFT+CTRL?
Ah, I had never tried that. While I don't think that mode has much use, there are some that probably use it, and it does make logical use of the SHIFT
key. Perhaps it's best to stick with ALT
then, or maybe CTRL+ALT
, which doesn't seem to have the same problem in Linux as just ALT
.
As for tagged nodes, that is probably a decent suggestion. I'm guessing tags like source/created_by/attribution should be excepted? I know the JOSM filter has the conecpt of "untagged" which ignores certain tags. Is there an easy method to easily check if a node is "untagged" according to these rules?
There is, the list can be retrieved with org.openstreetmap.josm.data.osm.OsmPrimitive.getUninterestingKeys()
.
comment:5 by , 13 years ago
I implemented your suggestions. Not sure why I never thought of using CTRL+ALT :)
It also now iterates through a node's tags and checks to see if any of them are "interesting" according to JOSM's definition.
I also fixed a bug that at first I thought I had introduced but I'm pretty sure it was present in the original code. After using CTRL to add a node, the automatic locking mechanism that is supposed to kick in when you perform a mouse drag stopped working. I think oldCtrl was getting set to true and never getting set back to false. Since that was the only function of this variable I ripped it out along with the unread oldShift one.
comment:6 by , 13 years ago
Alt+Click is swallowed by gnome window manager, but the second Alt key (Alt Gr) works as normal. So if you also check for AltGr, there is no need for complicated modifier combos.
comment:7 by , 13 years ago
ALT usage inside JOSM (i.e. rotation feature) handles both ALT keys equal due to thus Unix behaviour for windows movement with ALT.
comment:8 by , 13 years ago
Oh right... the OTHER alt key. Well whatever. I personally kind of prefer keeping my hand on the left side of the keyboard and am happy with the CTRL+ALT. Yes, I'm right-handed. And I guess going back to ALT wouldn't affect me anyway since I've turned that off in my window manager. So I don't really care one way or the other. But I'm leaving now for the long weekend so don't expect any more changes from me :)
comment:9 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I went ahead and committed your patch ([o27474]), but changed the modifier key to Alt (or AltGr), added preview drawing, and updated the mode help text ([o27475]). I also updated the wiki to reflect the new usage:
http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ImproveWayAccuracy
Please update the plugin, try it out, and report any bugs ASAP.
comment:10 by , 13 years ago
So for kicks, I turned the ALT+drag feature back on in gnome (gnome 3 shell on Linux Mint) and it turns out it does swallow both of my alt keys. I asked someone else to try and they reported the same behavior in xmonad. Then they discovered that it depends on keyboard layout. The default English (US) keyboard layout doesn't have AltGr in it. xev reports ALT_L and ALT_R for my two ALT keys. If I switch to the keyboard layout titled "International AltGr dead keys" then I get ALT_L and ISO_Level3_Shift in xev and only the left one gets swallowed.
Is this just the US messing up the standards for the rest of the world again? :)
comment:11 by , 8 years ago
Component: | Plugin ImproveWay → Plugin |
---|
Clean up components. (This is the only ticket for the old improvewayaccuracy plugin, which was integrated into core in r4846. The other tickets belong to the newer ImproveWay plugin.)
Thanks for creating this patch. If most Linux users are going to have trouble with the
ALT
modifier, then perhaps it's better to use an alternative likeSHIFT+CTRL
(which may be better anyways because deletion is a more dangerous act). Also, in addition to checking for parents before deleting, we shouldn't allow node deletion if there are any existing tags. If no one beats me to it I'll try and work on this by the weekend.