Modify

Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#23442 closed defect (fixed)

Follow line bug when holding F

Reported by: Cartographer10 Owned by: GerdP
Priority: normal Milestone: 24.01
Component: Core Version: latest
Keywords: Cc:

Description

I found a bug where the follow line command closes to soon.
https://i.imgur.com/iprKL16.png

Reproduction steps

  1. Create a circle like the grey line below
  2. Create a new line, place the first node on the 1 below
  3. Click on the second node as marked below
  4. Press F and keep holding it

https://i.imgur.com/Z7YVIS2.png

Actual behavior
The line snaps back to the beginning after only a few nodes. It consistently snaps back after 2 or 3 nodes. It happens the most when making a sharp left turn as can be seen on the images.

Expected behavior
The new line should follow the entire line instead of snapping back after a few nodes

System information
OS: Linux mint: 21.3
Java: Openjdk-21-jre
JOSM: v18940

Attachments (3)

follow.JPG (18.7 KB ) - added by GerdP 9 months ago.
different geometry, same problem
23442.patch (956 bytes ) - added by GerdP 9 months ago.
23442-2.patch (694 bytes ) - added by GerdP 9 months ago.

Download all attachments as: .zip

Change History (19)

comment:1 by Taya, 9 months ago

This also happens to me. It happens more frequently to me if JOSM is running slow. It also seems to happen a lot more if I press F as soon as possible after clicking the second node.

comment:2 by Woazboat, 9 months ago

I added some debug output and it looks like the source of the problem is that the follow action is triggered twice for the same node when it's activated in quick succession.

2024-01-27 19:37:18.283 FINE: FollowLineAction, base node: {Node id=-25598 version=0 MV lat=53.56452634464472,lon=9.974486742835618}, new node: {Node id=-25599 version=0 MV lat=53.5645413500275,lon=9.974497445420058}
2024-01-27 19:37:18.306 FINE: Selection changed. 2 primitives are selected.
2024-01-27 19:37:18.841 FINE: FollowLineAction, base node: {Node id=-25599 version=0 MV lat=53.5645413500275,lon=9.974497445420058}, new node: {Node id=-25600 version=0 MV lat=53.5645523956531,lon=9.97447797022542}
2024-01-27 19:37:18.884 FINE: Selection changed. 2 primitives are selected.
2024-01-27 19:37:18.914 FINE: FollowLineAction, base node: {Node id=-25599 version=0 MV lat=53.5645413500275,lon=9.974497445420058}, new node: {Node id=-25600 version=0 MV lat=53.5645523956531,lon=9.97447797022542}
2024-01-27 19:37:18.927 FINE: Selection changed. 1 primitives are selected.

The base node that the follow action uses is taken from DrawAction. The DrawAction base node is updated in a selection change listener.

key event -> follow line action -> execute change way nodes command + change selection command -> selection change event -> DrawAction selection change listener -> update draw base node

I assume this is a race condition between the follow line action and the base node update in the draw action selection change listener.

Last edited 9 months ago by Woazboat (previous) (diff)

comment:3 by anonymous, 9 months ago

Reported this problem a year or so ago, exactly as pictured in the OP 1st screencut, set a first node, start the line to the second node and hit F. Reaching the 4th node jumps/connects back the line to the starting node, closing the way. The more data is in the active layer the sooner it happens
. Only a new line. Drawing a line along and edge, interrupting to do something else, resume A, then F has never caused this.

Having become used to it, always working in larger sets, most always simple polygon mapping of landuse/landcover, do a Ctrl+Z which reverses the loop back step and continue with F as the function was not terminated.

comment:4 by SekeRob, 9 months ago

Errata: Subjectively the occurrences have greatly diminished since the performance work was done v.v. the NSI plugin caused slowing and related. The datasets have to be big, 50-75MB saved, the present one grew to 116MB.

by GerdP, 9 months ago

Attachment: follow.JPG added

different geometry, same problem

comment:5 by GerdP, 9 months ago

Note also the strange numbering of the segments in my example. Whenever I was able to reproduce I see the same numbering. The first segment gets the 2, the last (wrong) segment the is rendered as 1st. To reproduce it seems to help to zoom out and press 8 to zoom back in so that GC is active.

different geometry, same problem

by GerdP, 9 months ago

Attachment: 23442.patch added

comment:6 by GerdP, 9 months ago

OK, I think I can always reproduce like this:
1) enter draw mode
2) select a node of a closed way with 6 or more nodes (doesn't matter which node)
3) press and hold F
4) move cursor close to next node in way until the snap-to cursor is rendered
5) left click

When I do this I see the problem more often then not. There is no need to have lots of data or change the zoom and nothing else keeps my CPU busy. Problem disappears with the attached patch but I am not yet sure where to reset oldLast.

Last edited 9 months ago by GerdP (previous) (diff)

comment:7 by GerdP, 9 months ago

The patch doesn't work when you undo one of the follow actions and try to use follow again, so it's too simple.

by GerdP, 9 months ago

Attachment: 23442-2.patch added

comment:8 by GerdP, 9 months ago

Milestone: 24.01
Owner: changed from team to GerdP
Status: newassigned

23442-2.patch looks like a good and simple solution. If nobody complains I'll commit it tomorrow.

comment:9 by Woazboat, 9 months ago

It doesn't solve the underlying problem but I guess it does mitigate it.

comment:10 by GerdP, 9 months ago

Right, it just doesn't rely on the idea that the returned value is either the first or the last node of the new way. In fact this happens very often but only in this special situation the problem was not detected.

comment:11 by GerdP, 9 months ago

I meant I think it solves this problem in the FollowLineAction for good, but we may find other actions which are not handling such a case properly.

in reply to:  3 ; comment:12 by GerdP, 9 months ago

Replying to anonym:

Reported this problem a year or so ago, exactly as pictured in the OP 1st screencut, set a first node, start the line to the second node and hit F. Reaching the 4th node jumps/connects back the line to the starting node, closing the way. The more data is in the active layer the sooner it happens
. Only a new line. Drawing a line along and edge, interrupting to do something else, resume A, then F has never caused this.

Having become used to it, always working in larger sets, most always simple polygon mapping of landuse/landcover, do a Ctrl+Z which reverses the loop back step and continue with F as the function was not terminated.

Do you have a ticket number for us?

comment:13 by GerdP, 9 months ago

Resolution: fixed
Status: assignedclosed

In 18959/josm:

fix #23442: Follow line bug when holding F

  • make sure that the node returned by DrawAction.getCurrentBaseNode() is either first or last node of the selected way.

in reply to:  12 comment:14 by SekeRob, 9 months ago

Replying to GerdP:

Replying to anonym:

Reported this problem a year or so ago, exactly as pictured in the OP 1st screencut, set a first node, start the line to the second node and hit F. Reaching the 4th node jumps/connects back the line to the starting node, closing the way. The more data is in the active layer the sooner it happens
. Only a new line. Drawing a line along and edge, interrupting to do something else, resume A, then F has never caused this.

Having become used to it, always working in larger sets, most always simple polygon mapping of landuse/landcover, do a Ctrl+Z which reverses the loop back step and continue with F as the function was not terminated.

Do you have a ticket number for us?

Here you go: https://josm.openstreetmap.de/ticket/22850

comment:15 by GerdP, 9 months ago

Ticket #22850 has been marked as a duplicate of this ticket.

comment:16 by GerdP, 9 months ago

Thanks, I wonder why I couldn't find it searching for "Follow"

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain GerdP.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.