Like with vector editing, we should add a mid-layer where changes are written to, rather than writing directly into the original data.
Specifically for raster data, this could just be another GeoRasterLayer with the same size, initially filled with nodata, to which only the edited regions are added over time. When loading raster data, this dataset should be added onto the original data. When saving, that dataset should be merged into the original one and cleared (filled with nodata again).
This not only makes editing less error-prone, but should also drastically improve performance (while slightly reducing performance of raster loading when the data has been edited - but that's rare)
Like with vector editing, we should add a mid-layer where changes are written to, rather than writing directly into the original data.
Specifically for raster data, this could just be another GeoRasterLayer with the same size, initially filled with nodata, to which only the edited regions are added over time. When loading raster data, this dataset should be added onto the original data. When saving, that dataset should be merged into the original one and cleared (filled with nodata again).
This not only makes editing less error-prone, but should also drastically improve performance (while slightly reducing performance of raster loading when the data has been edited - but that's rare)