Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#2503 closed defect (fixed)

wxdigit: wrong undo & redo

Reported by: mlennert Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: wxGUI Version: svn-trunk
Keywords: digitizer Cc: martinl
CPU: Unspecified Platform: Unspecified

Description

The undo and redo buttons in the digitizer (accessed via the Map Display) seem to work well for simple features, but as soon as I use tools like split line or similar, the results of undo and redo become somewhat arbitrary (at least to the innocent user).

See a screencast of the issue.

Change History (18)

comment:1 in reply to:  description ; Changed 5 years ago by mmetz

Replying to mlennert:

The undo and redo buttons in the digitizer (accessed via the Map Display) seem to work well for simple features, but as soon as I use tools like split line or similar, the results of undo and redo become somewhat arbitrary (at least to the innocent user).

Please try r63265 (trunk) or r63266 (relbr70).

comment:2 in reply to:  1 ; Changed 5 years ago by mlennert

Replying to mmetz:

Replying to mlennert:

The undo and redo buttons in the digitizer (accessed via the Map Display) seem to work well for simple features, but as soon as I use tools like split line or similar, the results of undo and redo become somewhat arbitrary (at least to the innocent user).

Please try r63265 (trunk) or r63266 (relbr70).

Much better, thanks !

There still is some confusion when one goes back one or two steps, then digitizes something else. When you then undo and redo again, the stack seems to be mixed between the different paths, sometimes leading to objects left on screen even when going all the way back to the last possible undo.

You can check a short example screencast and a longer example screencast.

Moritz

comment:3 in reply to:  2 ; Changed 5 years ago by mmetz

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

The undo and redo buttons in the digitizer (accessed via the Map Display) seem to work well for simple features, but as soon as I use tools like split line or similar, the results of undo and redo become somewhat arbitrary (at least to the innocent user).

Please try r63265 (trunk) or r63266 (relbr70).

Much better, thanks !

There still is some confusion when one goes back one or two steps, then digitizes something else.

The question is what should happen with the available redo steps if digitize something new after some undo steps. Eliminate the redo steps or insert the new changeset before the first redo step? This is handled by the wx digitizer, not the vector lib.

When you then undo and redo again, the stack seems to be mixed between the different paths, sometimes leading to objects left on screen even when going all the way back to the last possible undo.

It seems that a new changeset is appended after the last redo step if available, leading to a mix-up.

comment:4 in reply to:  3 ; Changed 5 years ago by mlennert

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

The undo and redo buttons in the digitizer (accessed via the Map Display) seem to work well for simple features, but as soon as I use tools like split line or similar, the results of undo and redo become somewhat arbitrary (at least to the innocent user).

Please try r63265 (trunk) or r63266 (relbr70).

Much better, thanks !

There still is some confusion when one goes back one or two steps, then digitizes something else.

The question is what should happen with the available redo steps if digitize something new after some undo steps. Eliminate the redo steps or insert the new changeset before the first redo step? This is handled by the wx digitizer, not the vector lib.

I've tried three different programs (LibreOffice? Writer, Inkscape and GIMP) and all discard these redo steps,i.e. when you do A, then B, then undo B, then do C, you cannot find B again.

This seems to be the most intuitive behaviour to me.

When you then undo and redo again, the stack seems to be mixed between the different paths, sometimes leading to objects left on screen even when going all the way back to the last possible undo.

It seems that a new changeset is appended after the last redo step if available, leading to a mix-up.

Yes.

Moritz

comment:5 in reply to:  4 ; Changed 5 years ago by mmetz

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

There still is some confusion when one goes back one or two steps, then digitizes something else.

The question is what should happen with the available redo steps if digitize something new after some undo steps. Eliminate the redo steps or insert the new changeset before the first redo step? This is handled by the wx digitizer, not the vector lib.

I've tried three different programs (LibreOffice? Writer, Inkscape and GIMP) and all discard these redo steps,i.e. when you do A, then B, then undo B, then do C, you cannot find B again.

This seems to be the most intuitive behaviour to me.

OK.

When you then undo and redo again, the stack seems to be mixed between the different paths, sometimes leading to objects left on screen even when going all the way back to the last possible undo.

It seems that a new changeset is appended after the last redo step if available, leading to a mix-up.

Yes.

Fixed in trunk r63341, please test.

comment:6 in reply to:  5 ; Changed 5 years ago by mlennert

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

There still is some confusion when one goes back one or two steps, then digitizes something else.

The question is what should happen with the available redo steps if digitize something new after some undo steps. Eliminate the redo steps or insert the new changeset before the first redo step? This is handled by the wx digitizer, not the vector lib.

I've tried three different programs (LibreOffice? Writer, Inkscape and GIMP) and all discard these redo steps,i.e. when you do A, then B, then undo B, then do C, you cannot find B again.

This seems to be the most intuitive behaviour to me.

OK.

When you then undo and redo again, the stack seems to be mixed between the different paths, sometimes leading to objects left on screen even when going all the way back to the last possible undo.

It seems that a new changeset is appended after the last redo step if available, leading to a mix-up.

Yes.

Fixed in trunk r63341, please test.

Much better !

There is still one issue I've come upon: when features are automatically modified from the form they are digitized in because of overlaps, the second original feature causing the overlap seems to be erased from the undo stack, meaning that it remains, even if you undo all the way to origin or if you close without saving.

To reproduce, digitize a line and then a second line that crosses that line. The lines are correctly split at the intersection. If you then undo the second line remains in its original (unsplit) form. The same is true for two overlapping polygons or a line crossing a polygon.

comment:7 in reply to:  6 ; Changed 5 years ago by mmetz

Replying to mlennert:

There is still one issue I've come upon: when features are automatically modified from the form they are digitized in because of overlaps, the second original feature causing the overlap seems to be erased from the undo stack, meaning that it remains, even if you undo all the way to origin or if you close without saving.

To reproduce, digitize a line and then a second line that crosses that line. The lines are correctly split at the intersection. If you then undo the second line remains in its original (unsplit) form. The same is true for two overlapping polygons or a line crossing a polygon.

The list of updated lines as returned by the vector lib was incomplete. Fixed in r63349,50 (trunk, relbr70), please test.

comment:8 in reply to:  7 ; Changed 5 years ago by mlennert

Replying to mmetz:

Replying to mlennert:

There is still one issue I've come upon: when features are automatically modified from the form they are digitized in because of overlaps, the second original feature causing the overlap seems to be erased from the undo stack, meaning that it remains, even if you undo all the way to origin or if you close without saving.

To reproduce, digitize a line and then a second line that crosses that line. The lines are correctly split at the intersection. If you then undo the second line remains in its original (unsplit) form. The same is true for two overlapping polygons or a line crossing a polygon.

The list of updated lines as returned by the vector lib was incomplete. Fixed in r63349,50 (trunk, relbr70), please test.

Still not quite: http://tomahawk.ulb.ac.be/moritz/wxdigit_undo_redo4.ogv.

If you need more explanation, I can write some, but right now I have to go.

Moritz

comment:9 in reply to:  8 ; Changed 5 years ago by mmetz

Replying to mlennert:

Replying to mmetz:

The list of updated lines as returned by the vector lib was incomplete. Fixed in r63349,50 (trunk, relbr70), please test.

Still not quite: http://tomahawk.ulb.ac.be/moritz/wxdigit_undo_redo4.ogv.

If you need more explanation, I can write some, but right now I have to go.

Got it. This bug (yet another one) should be fixed in r63364,5 (trunk only).

comment:10 in reply to:  9 ; Changed 5 years ago by mlennert

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

The list of updated lines as returned by the vector lib was incomplete. Fixed in r63349,50 (trunk, relbr70), please test.

Still not quite: http://tomahawk.ulb.ac.be/moritz/wxdigit_undo_redo4.ogv.

If you need more explanation, I can write some, but right now I have to go.

Got it. This bug (yet another one) should be fixed in r63364,5 (trunk only).

Wow, great detective work there ! As of now I haven't been able to find any other bugs linked to undo/redo. This fix should be backported to grass7release and then I think we can close this bug for now.

Thanks a lot for the fixes !

Moritz

comment:11 in reply to:  10 ; Changed 5 years ago by mmetz

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

The list of updated lines as returned by the vector lib was incomplete. Fixed in r63349,50 (trunk, relbr70), please test.

Still not quite: http://tomahawk.ulb.ac.be/moritz/wxdigit_undo_redo4.ogv.

If you need more explanation, I can write some, but right now I have to go.

Got it. This bug (yet another one) should be fixed in r63364,5 (trunk only).

Wow, great detective work there ! As of now I haven't been able to find any other bugs linked to undo/redo. This fix should be backported to grass7release and then I think we can close this bug for now.

I do not fully understand 1) why the fix is needed, 2) why the fix is working. The GRASS vector library usually employs Copy On Write (COW) when a feature is modified. Sometimes a feature is modified in place, overwriting the previous version. The digitizer's undo/redo mechanism relies on COW, but the move tool seems to replace an older version of the feature, thus undo/redo should not work with the move tool (and maybe other tools, too).

comment:12 in reply to:  11 ; Changed 5 years ago by mmetz

Resolution: fixed
Status: newclosed

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

The list of updated lines as returned by the vector lib was incomplete. Fixed in r63349,50 (trunk, relbr70), please test.

Still not quite: http://tomahawk.ulb.ac.be/moritz/wxdigit_undo_redo4.ogv.

If you need more explanation, I can write some, but right now I have to go.

Got it. This bug (yet another one) should be fixed in r63364,5 (trunk only).

Wow, great detective work there ! As of now I haven't been able to find any other bugs linked to undo/redo. This fix should be backported to grass7release and then I think we can close this bug for now.

I do not fully understand 1) why the fix is needed, 2) why the fix is working.

The fix is working because V2_rewrite_line_nat() does not work as expected, it does not rewrite, it always deletes the line and writes out a new line (COW). All fixes related to this ticket have been backported to relbr70 in r63397,8 after testing.

comment:13 in reply to:  12 ; Changed 5 years ago by mlennert

Replying to mmetz:

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

Replying to mmetz:

The list of updated lines as returned by the vector lib was incomplete. Fixed in r63349,50 (trunk, relbr70), please test.

Still not quite: http://tomahawk.ulb.ac.be/moritz/wxdigit_undo_redo4.ogv.

If you need more explanation, I can write some, but right now I have to go.

Got it. This bug (yet another one) should be fixed in r63364,5 (trunk only).

Wow, great detective work there ! As of now I haven't been able to find any other bugs linked to undo/redo. This fix should be backported to grass7release and then I think we can close this bug for now.

I do not fully understand 1) why the fix is needed, 2) why the fix is working.

The fix is working because V2_rewrite_line_nat() does not work as expected, it does not rewrite, it always deletes the line and writes out a new line (COW). All fixes related to this ticket have been backported to relbr70 in r63397,8 after testing.

You just signficantly improved the use of the digitizer, thanks a lot !

Just one question concerning r63398: shouldn't the code just be deleted instead of using 'if 0' ?

Moritz

comment:14 in reply to:  13 Changed 5 years ago by mmetz

Replying to mlennert:

Just one question concerning r63398: shouldn't the code just be deleted instead of using 'if 0' ?

I am not sure if the new PostGIS interface needs this, Martin would know more about this, therefore I deactivated the code instead of deleting the code. The same applies to the list of updated nodes (not used by the digitizer, but by the PostGIS functions in the vector lib, I think).

Markus

comment:15 Changed 5 years ago by martinl

Cc: martinl added

comment:16 Changed 5 years ago by mlennert

Martin,

Any opinion on the question concerning the ifdef'ed out code ?

For the rest we can close this ticket.

comment:17 Changed 5 years ago by mlennert

Using current trunk, any redo operation in wxdigit makes the GUI crash. Don't know if this is related to this ticket or whether I should open a new one. Can anyone confirm the behaviour ?

comment:18 in reply to:  17 Changed 5 years ago by annakrat

Replying to mlennert:

Using current trunk, any redo operation in wxdigit makes the GUI crash. Don't know if this is related to this ticket or whether I should open a new one. Can anyone confirm the behaviour ?

Yes, confirmed here (I have Ubuntu).

Note: See TracTickets for help on using tickets.