-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Detach Node operation #4320 #5127
Conversation
I tested this patch, and I believe it causes serious side effects, if the node in question is part of a relation. Let's say, I'm detaching a via node of a turn restriction. This pull request creates a new node and replaces all occurrences in the involved ways, but it fails to update the relations. This will eventually break the turn restriction. In JOSM, this detaching operation is quite involved. Maybe you could take a look how it is implemented there to identify all relevant use cases and how to deal with them. |
Thanks for the information @mmd-osm, I hadn't considered relations membership! I've taken a quick look at the JOSM action, and I'll ask a question back on the original issue as I'm not sure if there are already any examples of actions in ID that require additional user input. |
I recently added a lot of this logic to Lines 60 to 211 in de12396
|
Thanks @bhousel - I've done a few experiments using the logic you added in the actions/connect file (I've moved it out to a new util file so I can re-use it without repeating it), and it seems ok. My knowledge of turn restrictions is a bit basic, so I'll do a bit more reading up to see if I'm covering all the cases or whether a modified version of the logic is necessary for the detach node operation. |
I've done a bit more reading on restrictions at https://wiki.openstreetmap.org/wiki/Relation:restriction and I think that the code can be simplified from the connect.js logic. I've got an experimental branch which I'll work on for a bit to check it manages to prevent breaking the turn restrictions and once I've got some unit tests, I'll update the pull request. |
cool thanks @Psigio ! I forgot to comment yesterday - I'm not sure whether it makes sense to split out the logic into a new util file. I think it might depend on what the action is trying to do. But if you can find a way to make it generic , go for it! |
location_hint role in a turn restriction. Update to move any other relation to new node.
Hi, I've done a bit more on this. The operation will now prevent the detach operation if the target node is a via or location_hint role within a restriction relationship. It won't prevent a node within a via way being detached as this shouldn't affect the restriction. The action now also deals with other relationships too, it will swap the membership of the detached node to the new replacement one. Hopefully this is a bit better now, happy to make any other changes that are necessary! |
Thanks again @Psigio - I just merged this! I made a bunch of cleanups in 119792f, but all minor stuff: Another cool thing with using |
Hi - I've had an attempt at implementing the Detach Node operation as described in #4320. I've added the new operation, action & some unit tests for the action. It will only operate on nodes that are part of at least one way and have at least one tag. After detaching the node (and replacing with a duplicate without any tags in the way), it switches to move mode immediately so the user can move the detached node.
I'm not sure about the move mode switch, it's not perfect as the mouse pointer is offset from the node based upon the position in the context menu where the Detach Node operation is rendered.
Let me know if you want any changes made!