mirror of https://gitlab.com/pamhyr/pamhyr2
Translate: Retranslate draft to height.
parent
dc78998bf6
commit
1e8d5c8f4f
|
|
@ -19,7 +19,7 @@ class Data(object):
|
|||
self._flow = 0.0
|
||||
self._speed = 0.0
|
||||
self._elevation = 0.0
|
||||
self._draft = 0.0
|
||||
self._height = 0.0
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
@ -40,8 +40,8 @@ class Data(object):
|
|||
val = self._flow
|
||||
elif key == "elevation":
|
||||
val = self._elevation
|
||||
elif key == "draft":
|
||||
val = self._draft
|
||||
elif key == "height":
|
||||
val = self._height
|
||||
|
||||
return val
|
||||
|
||||
|
|
@ -56,15 +56,15 @@ class Data(object):
|
|||
|
||||
def _update_from_kp(self):
|
||||
min = self._update_get_min()
|
||||
self._elevation = min - self._draft
|
||||
self._elevation = min - self._height
|
||||
|
||||
def _update_from_elevation(self):
|
||||
min = self._update_get_min()
|
||||
self._draft = self._elevation - min
|
||||
self._height = self._elevation - min
|
||||
|
||||
def _update_from_draft(self):
|
||||
def _update_from_height(self):
|
||||
min = self._update_get_min()
|
||||
self._elevation = self._draft + min
|
||||
self._elevation = self._height + min
|
||||
|
||||
def _update_from_flow(self):
|
||||
min = self._update_get_min()
|
||||
|
|
@ -87,9 +87,9 @@ class Data(object):
|
|||
elif key == "elevation":
|
||||
self._elevation = float(value)
|
||||
self._update_from_elevation()
|
||||
elif key == "draft":
|
||||
self._draft = float(value)
|
||||
self._update_from_draft()
|
||||
elif key == "height":
|
||||
self._height = float(value)
|
||||
self._update_from_height()
|
||||
|
||||
self._status.modified()
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ class InitialConditions(object):
|
|||
key = lambda p: p.kp
|
||||
)
|
||||
|
||||
def generate_growing_constante_draft(self, draft:float):
|
||||
def generate_growing_constante_height(self, height:float):
|
||||
self._data = []
|
||||
|
||||
profiles = self._reach.reach.profiles
|
||||
|
|
@ -208,10 +208,10 @@ class InitialConditions(object):
|
|||
new["kp"] = profile.kp
|
||||
|
||||
if prev is None:
|
||||
new["elevation"] = profile.z_min() + draft
|
||||
new["elevation"] = profile.z_min() + height
|
||||
else:
|
||||
new["elevation"] = max(
|
||||
profile.z_min() + draft,
|
||||
profile.z_min() + height,
|
||||
prev["elevation"]
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ from PyQt5.QtWidgets import (
|
|||
QDoubleSpinBox,
|
||||
)
|
||||
|
||||
class DraftDialog(ASubWindow, ListedSubWindow):
|
||||
def __init__(self, title="Draft", parent=None):
|
||||
super(DraftDialog, self).__init__(
|
||||
name=title, ui="InitialConditions_Dialog_Generator_Draft", parent=parent
|
||||
class HeightDialog(ASubWindow, ListedSubWindow):
|
||||
def __init__(self, title="Height", parent=None):
|
||||
super(HeightDialog, self).__init__(
|
||||
name=title, ui="InitialConditions_Dialog_Generator_Height", parent=parent
|
||||
)
|
||||
|
||||
self.value = None
|
||||
|
|
@ -161,6 +161,6 @@ class GenerateCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
if self._generator == "growing":
|
||||
self._ics.generate_growing_constante_draft(self._param)
|
||||
self._ics.generate_growing_constante_height(self._param)
|
||||
elif self._generator == "discharge":
|
||||
self._ics.generate_discharge(self._param)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ from View.Plot.MplCanvas import MplCanvas
|
|||
from View.InitialConditions.PlotDKP import PlotDKP
|
||||
from View.InitialConditions.PlotFlow import PlotFlow
|
||||
from View.InitialConditions.translate import *
|
||||
from View.InitialConditions.DialogDraft import DraftDialog
|
||||
from View.InitialConditions.DialogHeight import HeightDialog
|
||||
from View.InitialConditions.DialogDischarge import DischargeDialog
|
||||
|
||||
_translate = QCoreApplication.translate
|
||||
|
|
@ -129,7 +129,7 @@ class InitialConditionsWindow(ASubMainWindow, ListedSubWindow):
|
|||
self.find(QAction, "action_sort").triggered.connect(self.sort)
|
||||
|
||||
self.find(QPushButton, "pushButton_generate_1").clicked.connect(
|
||||
self.generate_growing_constante_draft
|
||||
self.generate_growing_constante_height
|
||||
)
|
||||
|
||||
self.find(QPushButton, "pushButton_generate_2").clicked.connect(
|
||||
|
|
@ -212,8 +212,8 @@ class InitialConditionsWindow(ASubMainWindow, ListedSubWindow):
|
|||
self._table.redo()
|
||||
self._update_plot()
|
||||
|
||||
def generate_growing_constante_draft(self):
|
||||
dlg = DraftDialog(parent=self)
|
||||
def generate_growing_constante_height(self):
|
||||
dlg = HeightDialog(parent=self)
|
||||
if dlg.exec():
|
||||
value = dlg.value
|
||||
self._table.generate("growing", value)
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ table_headers = {
|
|||
"speed": _translate("LateralContribution", "Speed (m/s)"),
|
||||
"flow": _translate("LateralContribution", "Flow (m³/s)"),
|
||||
"elevation": _translate("LateralContribution", "Elevation (m)"),
|
||||
"draft": _translate("LateralContribution", "Draft (m)")
|
||||
"height": _translate("LateralContribution", "Height (m)")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue