mirror of https://gitlab.com/pamhyr/pamhyr2
geometry: Minor change and delete dead code.
parent
2708e81ebb
commit
5683adef2e
|
|
@ -192,6 +192,9 @@ class ProfileXYZ(Profile):
|
|||
index_first_named_point = None
|
||||
last_named_point = None
|
||||
|
||||
first_point_not_nan = self._first_point_not_nan()
|
||||
last_point_not_nan = self._last_point_not_nan()
|
||||
|
||||
for index, point in enumerate(self.points):
|
||||
if point.point_is_named():
|
||||
index_first_named_point = index
|
||||
|
|
@ -213,8 +216,8 @@ class ProfileXYZ(Profile):
|
|||
vector = Vector1d(first_named_point, last_named_point)
|
||||
normalized_direction_vec = vector.normalized_direction_vector()
|
||||
else:
|
||||
vector = Vector1d(_first_point_not_nan(profile),
|
||||
_last_point_not_nan(profile))
|
||||
vector = Vector1d(first_point_not_nan,
|
||||
last_point_not_nan)
|
||||
normalized_direction_vec = vector.normalized_direction_vector()
|
||||
|
||||
for point in self._points:
|
||||
|
|
@ -228,13 +231,13 @@ class ProfileXYZ(Profile):
|
|||
|
||||
constant = station[index_first_named_point]
|
||||
elif first_named_point is None:
|
||||
vector = Vector1d(_first_point_not_nan(profile),
|
||||
_last_point_not_nan(profile))
|
||||
vector = Vector1d(first_point_not_nan,
|
||||
last_point_not_nan)
|
||||
normalized_direction_vec = vector.normalized_direction_vector()
|
||||
|
||||
for point in self._points:
|
||||
xi = point.x - _first_point_not_nan(profile).x
|
||||
yi = point.y - _first_point_not_nan(profile).y
|
||||
xi = point.x - first_point_not_nan.x
|
||||
yi = point.y - first_point_not_nan.y
|
||||
station_i = (normalized_direction_vec[0] * xi +
|
||||
normalized_direction_vec[1] * yi)
|
||||
station.append(station_i)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class GeometryWindow(QMainWindow, WindowToolKit):
|
|||
self.setup_window()
|
||||
self.setup_model()
|
||||
self.setup_connections()
|
||||
self.setup_plot()
|
||||
|
||||
def setup_window(self):
|
||||
self.setWindowTitle(f"{self.ui.mainwindow_title} - {self._reach.name}")
|
||||
|
|
@ -53,6 +54,11 @@ class GeometryWindow(QMainWindow, WindowToolKit):
|
|||
self.tableView.setModel(self.model)
|
||||
self.tableView.setItemDelegate(qtableview_reach.Delegate())
|
||||
|
||||
def setup_plot(self):
|
||||
self.graphic_1()
|
||||
self.graphic_2()
|
||||
self.graphic_3()
|
||||
|
||||
def setup_connections(self):
|
||||
self.ui.btn_open.clicked.connect(self.open_file_dialog)
|
||||
self.ui.btn_sort_asc.clicked.connect(self.sort_ascending)
|
||||
|
|
@ -874,13 +880,3 @@ class GeometryWindow(QMainWindow, WindowToolKit):
|
|||
self.model = qtableview_reach.PandasModelEditable(buf)
|
||||
self.tableView.setModel(self.model)
|
||||
filename = ''
|
||||
|
||||
def get_lignes_directrices(self):
|
||||
liste_lignes_directrices = [
|
||||
data[1].iloc[:, 3].tolist() for data in self.model._data
|
||||
]
|
||||
return liste_lignes_directrices
|
||||
|
||||
@property
|
||||
def model_data(self):
|
||||
return self.model.model_data()
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ class PandasModelEditable(QAbstractTableModel):
|
|||
self.profile = profile
|
||||
|
||||
data = pd.DataFrame({
|
||||
self.header[0]: profile.x,
|
||||
self.header[1]: profile.y,
|
||||
self.header[2]: profile.z,
|
||||
self.header[3]: profile.ld,
|
||||
self.header[4]: projection_pointXYZ.get_station(profile)
|
||||
self.header[0]: profile.x(),
|
||||
self.header[1]: profile.y(),
|
||||
self.header[2]: profile.z(),
|
||||
self.header[3]: profile.name(),
|
||||
self.header[4]: profile.get_station()
|
||||
})
|
||||
self._data = data
|
||||
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ class PandasModelEditable(QAbstractTableModel):
|
|||
|
||||
if role == Qt.ForegroundRole and index.column() == 0:
|
||||
name = self._reach.profile(index.row()).name\
|
||||
.strip()\
|
||||
.lower()
|
||||
.strip()\
|
||||
.lower()
|
||||
if (name == "upstream" or name == "up" or
|
||||
name == _translate("Geometry", "upstream")):
|
||||
return QtGui.QColor("Green")
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class View(QMainWindow):
|
|||
self.model.remove_rows(rows)
|
||||
|
||||
try:
|
||||
self.graph() # mise à jour du graphique
|
||||
self.graph()
|
||||
except:
|
||||
print("TODO")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue