mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
River: Add reach split methods.
This commit is contained in:
1 parent
f516db0e48
commit
926cade437
4 files changed
+98
No files matched your search
@@ -892,3 +892,20 @@ class Reach(SQLSubModel):
|
||||
|
||||
profile.rk = previous.rk + dist
|
||||
previous = profile
|
||||
|
||||
def _split(self, profile, reach1, reach2):
|
||||
if profile is None:
|
||||
return
|
||||
|
||||
nr1 = Reach(status=self._status, parent=reach1)
|
||||
nr2 = Reach(status=self._status, parent=reach2)
|
||||
|
||||
ind = self.profiles.index(profile)
|
||||
|
||||
nr1_profiles = self.profiles[:ind+1]
|
||||
nr2_profiles = self.profiles[ind:]
|
||||
|
||||
nr1._profiles = list(map(lambda p: p.cloned_for(nr1), nr1_profiles))
|
||||
nr2._profiles = list(map(lambda p: p.cloned_for(nr2), nr2_profiles))
|
||||
|
||||
return nr1, nr2
|
||||
Reference in new issue
Block a user