HS: Fix hs section set and display.

scenarios
Pierre-Antoine 2025-08-28 15:23:33 +02:00
parent fc7d732e0a
commit a072a28929
5 changed files with 10 additions and 8 deletions

View File

@ -355,13 +355,15 @@ class HydraulicStructure(SQLSubModel):
def input_rk(self): def input_rk(self):
if self._input_section is None: if self._input_section is None:
return None return None
return self._input_section.rk
return self._input_section
@property @property
def output_rk(self): def output_rk(self):
if self._output_section is None: if self._output_section is None:
return None return None
return self._output_section.rk
return self._output_section
@property @property
def input_section(self): def input_section(self):

View File

@ -299,7 +299,7 @@ class PlotRKZ(PamhyrPlot):
for hs in lhs: for hs in lhs:
if not hs.enabled: if not hs.enabled:
continue continue
x = hs.input_rk x = hs.input_section.rk
if x is not None: if x is not None:
z_min = reach.get_z_min() z_min = reach.get_z_min()
z_max = reach.get_z_max() z_max = reach.get_z_max()

View File

@ -142,7 +142,7 @@ class PlotRKC(PamhyrPlot):
hs_color.append("red") hs_color.append("red")
else: else:
hs_color.append("darkgrey") hs_color.append("darkgrey")
x = hs.input_rk x = hs.input_section.rk
if x is not None: if x is not None:
a = self.canvas.axes.annotate( a = self.canvas.axes.annotate(
" > " + hs.name, " > " + hs.name,

View File

@ -103,7 +103,7 @@ class ComboBoxDelegate(QItemDelegate):
) )
) )
value = profiles[0].rk if len(profiles) > 0 else None value = profiles[0] if len(profiles) > 0 else None
else: else:
value = text value = text

View File

@ -297,11 +297,11 @@ class HydraulicStructuresWindow(PamhyrWindow):
self.plot_rkc.set_reach(reach) self.plot_rkc.set_reach(reach)
self.plot_ac.set_reach(reach) self.plot_ac.set_reach(reach)
profile_rk = self._hs_lst.get(rows[0]).input_rk profile = self._hs_lst.get(rows[0]).input_section
if profile_rk is not None: if profile is not None:
profiles = reach.reach\ profiles = reach.reach\
.get_profiles_from_rk( .get_profiles_from_rk(
float(profile_rk) float(profile.rk)
) )
if len(profiles) != 0 and profiles is not None: if len(profiles) != 0 and profiles is not None: