Compare commits

...

2 Commits

Author SHA1 Message Date
Pierre-Antoine ec2a1da6b6 HS: Basic: Fix display. 2025-08-28 16:58:54 +02:00
Pierre-Antoine a072a28929 HS: Fix hs section set and display. 2025-08-28 15:23:33 +02:00
7 changed files with 16 additions and 14 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

@ -558,12 +558,12 @@ class Mage(CommandLineSolver):
if not hs.enabled: if not hs.enabled:
continue continue
if hs.input_rk is None: if hs.input_section is None:
continue continue
f.write( f.write(
'* ouvrage au pk ' + '* ouvrage au pk ' +
f"{float(hs.input_rk):>12.1f}" + ' ' + f"{float(hs.input_section.rk):>12.1f}" + ' ' +
hs.name + '\n' hs.name + '\n'
) )
@ -590,7 +590,7 @@ class Mage(CommandLineSolver):
f.write( f.write(
f"{sin_dict[bhs._type]} " + f"{sin_dict[bhs._type]} " +
f"{reach_id} {float(hs.input_rk):>12.3f} " + f"{reach_id} {float(hs.input_section.rk):>12.3f} " +
f"{param_str} {name}\n" f"{param_str} {name}\n"
) )

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

@ -160,9 +160,9 @@ class BasicHydraulicStructuresWindow(PamhyrWindow):
self.plot_layout.addWidget(self.canvas) self.plot_layout.addWidget(self.canvas)
reach = self._hs.input_reach reach = self._hs.input_reach
profile_rk = self._hs.input_rk profile = self._hs.input_section
if profile_rk is not None: if profile is not None:
profiles = reach.reach.get_profiles_from_rk(float(profile_rk)) profiles = reach.reach.get_profiles_from_rk(float(profile.rk))
else: else:
profiles = None profiles = None

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: