Open 1ec5 opened 6 years ago
Yep! The groundwork for doing this was laid down in #4602 and #4646, and I even wrote:
Use the nope targets to prevent users from joining things that should not join (e.g. power lines with roads) or from dragging things where they should not go (e.g. a junction that zig-zags across several roads)
So, we should do that! But how?
We are already checking for lines that intersect with themselves. I'm hoping we can come up with a "mathematical model" of what a bad drag looks like:
score | graph |
---|---|
😄 | |
🤔 | |
😭 |
It probably involves comparing the angles formed by the node being dragged vs the angles formed by the nodes adjacent.
One thing to be careful about is that the user might be creating the acute angle intentionally, as a first step toward making a gentler curve.
You'll still be able to hold down alt to override it..
Based on the example above, maybe all the affected ways should compound the score somehow. If you’re working with a complex intersection where a dual carriageway begins or ends, you may have no choice but to create some sharp angles. But if three or four ways connected to the node end up with sharp angles, then that might be cause for concern.
Ping @lukasmartinelli and @planemad - any ideas on how to detect "bad drags" like these? I could have iD prevent them now, if there's a heuristic for detecting them.
It probably involves comparing the angles formed by the node being dragged vs the angles formed by the nodes adjacent.
I think distance plays a role too. If a node gets an acute angle + the distance between it's successor suddenly increased by 400-500%.
Don't know if there's a more appropriate issue for this problem, but I noticed this changeset: https://overpass-api.de/achavi/?changeset=63516878 which dragged a vertex across the map and connected it to an area.
This was a user's first edit so I can forgive them for making a mistake, but iD should be at least warning users that there are unconnected ways that they have edited - if not preventing it at the time of editing.
Here's another example if you need one - it would be good to have something in place to stop this from happening, especially for new users: https://overpass-api.de/achavi/?changeset=97578575
The changeset tags say "warnings:crossing_ways:highway-highway=5" however when I recreated the dragged road and tried to save, it only warned me about the two highway-building crossings - surely it should also warn about the crossing highways?
@bhousel suggested that the “nope cursor” functionality could be extended to disallow rapidly dragging a vertex to form an acute angle (such as one <20°). The idea would be to prevent the sort of user error that led to the discussion in #4692.
One thing to be careful about is that the user might be creating the acute angle intentionally, as a first step toward making a gentler curve. It isn’t unheard of to draw the endpoints of a curve before refining it using the little ‣ grippies at midpoints between vertices. (This is not unlike how I often draw a roundabout by placing three points then pressing O.)
@bhousel, am I missing anything?