From 7b88d955e5ec636bf4af8b741e6204e7cc73f8db Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Tue, 2 Jun 2026 16:46:30 +0200 Subject: [PATCH] Geometry: Update RK refactoring and fix modified flag. --- src/Model/Friction/Friction.py | 6 ++++++ src/Model/Geometry/Reach.py | 6 ++++++ src/View/Geometry/UndoCommand.py | 14 ++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Model/Friction/Friction.py b/src/Model/Friction/Friction.py index 80466c8b..28722255 100644 --- a/src/Model/Friction/Friction.py +++ b/src/Model/Friction/Friction.py @@ -365,3 +365,9 @@ class Friction(SQLSubModel): # self.end_strickler.medium]) return minor, medium + + def update_rks(self, begin_rk, end_rk): + self._begin_rk = begin_rk + self._end_rk = end_rk + + self.modified() diff --git a/src/Model/Geometry/Reach.py b/src/Model/Geometry/Reach.py index 668ac5bc..05b48d33 100644 --- a/src/Model/Geometry/Reach.py +++ b/src/Model/Geometry/Reach.py @@ -967,3 +967,9 @@ class Reach(SQLSubModel): break return global_index + + def update_rks(self, rks): + for rk, profile in zip(rks, self.profiles): + profile.rk = rk + + self.modified() diff --git a/src/View/Geometry/UndoCommand.py b/src/View/Geometry/UndoCommand.py index 5414f358..62c5acf6 100644 --- a/src/View/Geometry/UndoCommand.py +++ b/src/View/Geometry/UndoCommand.py @@ -247,14 +247,13 @@ class UpdateRKCommand(QUndoCommand): self._new_end_rk = None def undo(self): - for rk, profile in zip(self._rks, self._reach.profiles): - profile.rk = rk + + self._reach.update_rks(self._rks) for begin_rk, end_rk, friction in zip(self._begin_rk, self._end_rk, self._frictions): - friction.begin_rk = begin_rk - friction.end_rk = end_rk + friction.update_rks(begin_rk, end_rk) def redo(self): if self._new_rks is None: @@ -264,13 +263,12 @@ class UpdateRKCommand(QUndoCommand): **self._data ) - for rk, profile in zip(self._new_rks, self._reach.profiles): - profile.rk = rk + self._reach.update_rks(self._new_rks) + for begin_rk, end_rk, friction in zip(self._new_begin_rk, self._new_end_rk, self._frictions): - friction.begin_rk = begin_rk - friction.end_rk = end_rk + friction.update_rks(begin_rk, end_rk) class MeshingCommand(QUndoCommand):