Skip to content
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

[Bug] Undo split and undo georeferencing can leave messy artifacts #170

Open
mradamcox opened this issue Feb 7, 2024 · 0 comments
Open
Labels
app: georeference bug Something isn't working

Comments

@mradamcox
Copy link
Collaborator

Describe the problem
I found an example last night as follows: A sheet had been split into four pieces, but two were undesirable artifacts from the process (due to a messy cut-line). To fix this I un-georeferenced the two good pieces that had been georeferenced, and then un-prepared the parent sheet. This all seemed to go as desired. When I re-prepared the sheet, now splitting into 2 different pieces, this also seemed to work, at first. However, viewing one of the detail pages for the new pieces, the preview was distorted, and, similarly, the left side of the georeferencing interface was distorted. The problem seemed to be that the old dimensions for the previously split piece were somehow cached and being applied to the newly created piece. Especially puzzling was the fact that the actual file on disk for this piece wasn't distorted, it was fine, so it was just the image size that was stored in document.image_size (a @cached_property attribute) was not properly updated. This was especially confusing because these new pieces were completely new database objects, and, seemingly, the files had been properly regenerated.

Ultimately, with a lot of mucking around, I think I figured out that the old file pieces were still around in the file system, and they were causing problems. Also, the entries for the georeferenced layers in the MultiMask and in the "sorted_layers" key on the volume had not been removed (causing other issues).

Expected behavior
Undoing a preparation or georeferencing session should properly clean up ALL remnants of the old files.

To Reproduce
Steps to reproduce the behavior:

  1. Split a document into multiple pieces
  2. Georeference one of them
  3. Trim the layer in the MultiMask
  4. Undo all steps
  5. Re-split the document into a smaller number of pieces
  6. The image preview for the new pieces should look wrong, they should be expecting a file of the wrong dimensions.

Additional context

It would be good, especially to help with debugging and corrective measures, to change document.image_size from a cached property to a normal attribute on the model (I was never able to tell why exactly the old size was being reported, but this would just be a good thing to do). image_size should be set every time the document is saved (I don't think this would impact performance, because they aren't modified/saved especially often).

Additionally, the following must be addressed:

  • Ensure that undoing a split session fully removes the files from the system
  • Ensure that undoing a georeferencing session fully removes the files from the system (including .vrt files)
  • Ensure that undoing a georeferencing session removes all entries in the sorted_layers property
  • Ensure that undoing a georeferencing session removes all entries from MultiMask
@mradamcox mradamcox added bug Something isn't working app: georeference labels Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app: georeference bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant