mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
3 Commits
7774d2d7af
...
e0cee0fbef
| Author | SHA1 | Date |
|---|---|---|
|
|
e0cee0fbef | |
|
|
f9a8512477 | |
|
|
1457db721b |
|
|
@ -343,7 +343,9 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
logger.info("Waiting ...")
|
||||||
proc.waitForFinished()
|
proc.waitForFinished()
|
||||||
|
logger.info(f"Waiting ... Done (status : {proc.exitCode()})")
|
||||||
|
|
||||||
if proc.exitCode() != 0:
|
if proc.exitCode() != 0:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
@ -352,7 +354,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
f"{logger_color_reset()}"
|
f"{logger_color_reset()}"
|
||||||
)
|
)
|
||||||
outputs = proc.readAllStandardOutput()
|
outputs = proc.readAllStandardOutput()
|
||||||
logger.debug(outputs)
|
logger.warning(outputs)
|
||||||
|
|
||||||
errors = proc.readAllStandardError()
|
errors = proc.readAllStandardError()
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
@ -418,7 +420,9 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
logger.debug("Waiting ...")
|
||||||
proc.waitForFinished()
|
proc.waitForFinished()
|
||||||
|
logger.debug(f"Waiting ... Done (status : {proc.exitCode()})")
|
||||||
|
|
||||||
if proc.exitCode() != 0:
|
if proc.exitCode() != 0:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
@ -427,7 +431,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
f"{logger_color_reset()}"
|
f"{logger_color_reset()}"
|
||||||
)
|
)
|
||||||
outputs = proc.readAllStandardOutput()
|
outputs = proc.readAllStandardOutput()
|
||||||
logger.debug(outputs)
|
logger.warning(outputs)
|
||||||
|
|
||||||
errors = proc.readAllStandardError()
|
errors = proc.readAllStandardError()
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,11 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from Model.Tools.PamhyrDB import SQLSubModel
|
||||||
from Model.Except import NotImplementedMethodeError
|
from Model.Except import NotImplementedMethodeError
|
||||||
|
|
||||||
|
|
||||||
class Point(object):
|
class Point(SQLSubModel):
|
||||||
def __init__(self, id: int = -1, name: str = "",
|
def __init__(self, id: int = -1, name: str = "",
|
||||||
profile=None, status=None,
|
profile=None, status=None,
|
||||||
owner_scenario=-1):
|
owner_scenario=-1):
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ from Model.Geometry.Point import Point
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class PointXYZ(Point, SQLSubModel):
|
class PointXYZ(Point):
|
||||||
_sub_classes = []
|
_sub_classes = []
|
||||||
|
|
||||||
def __init__(self, id: int = -1,
|
def __init__(self, id: int = -1,
|
||||||
|
|
@ -302,6 +302,9 @@ class PointXYZ(Point, SQLSubModel):
|
||||||
self._z = float(value)
|
self._z = float(value)
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
|
def get_coordinate(self):
|
||||||
|
return (self._x, self._y, self._z)
|
||||||
|
|
||||||
def is_nan(self):
|
def is_nan(self):
|
||||||
"""
|
"""
|
||||||
Returns:
|
Returns:
|
||||||
|
|
|
||||||
|
|
@ -396,6 +396,12 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
def modified(self):
|
||||||
|
super(ProfileXYZ, self).modified()
|
||||||
|
|
||||||
|
self.tab_up_to_date = False
|
||||||
|
self.station_up_to_date = False
|
||||||
|
|
||||||
def x(self):
|
def x(self):
|
||||||
return [point.x for point in self.points]
|
return [point.x for point in self.points]
|
||||||
|
|
||||||
|
|
@ -436,12 +442,17 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
Nothing.
|
Nothing.
|
||||||
"""
|
"""
|
||||||
for point in list_points:
|
for point in list_points:
|
||||||
pt = PointXYZ(*point, profile=self, status=self._status)
|
named_args = {
|
||||||
self.points.append(pt)
|
"x": point[0],
|
||||||
|
"y": point[1],
|
||||||
|
"z": point[2],
|
||||||
|
"name": point[3],
|
||||||
|
}
|
||||||
|
|
||||||
|
pt = PointXYZ(id=-1, **named_args, profile=self, status=self._status)
|
||||||
|
self._points.append(pt)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
self.tab_up_to_date = False
|
|
||||||
self.station_up_to_date = False
|
|
||||||
|
|
||||||
def get_point_i(self, index: int) -> PointXYZ:
|
def get_point_i(self, index: int) -> PointXYZ:
|
||||||
"""Get point at index.
|
"""Get point at index.
|
||||||
|
|
@ -500,12 +511,10 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
Returns:
|
Returns:
|
||||||
Nothing.
|
Nothing.
|
||||||
"""
|
"""
|
||||||
point_xyz = PointXYZ(0., 0., 0., profile=self, status=self._status)
|
point_xyz = PointXYZ(x=0., y=0., z=0., profile=self, status=self._status)
|
||||||
self.points.append(point_xyz)
|
self.points.append(point_xyz)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
self.tab_up_to_date = False
|
|
||||||
self.station_up_to_date = False
|
|
||||||
|
|
||||||
def insert(self, index: int):
|
def insert(self, index: int):
|
||||||
"""Insert a new point at index.
|
"""Insert a new point at index.
|
||||||
|
|
@ -516,12 +525,15 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
Returns:
|
Returns:
|
||||||
The new point.
|
The new point.
|
||||||
"""
|
"""
|
||||||
point = PointXYZ(0., 0., 0., profile=self, status=self._status)
|
x, y, z = (0., 0., 0.)
|
||||||
self.points.insert(index, point)
|
|
||||||
|
if len(self._points) >= index:
|
||||||
|
x, y, z = self._points[index - 1].get_coordinate()
|
||||||
|
|
||||||
|
point = PointXYZ(x=x, y=y, z=z, profile=self, status=self._status)
|
||||||
|
self._points.insert(index, point)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
self.tab_up_to_date = False
|
|
||||||
self.station_up_to_date = False
|
|
||||||
|
|
||||||
return point
|
return point
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -617,6 +617,8 @@ class Reach(SQLSubModel):
|
||||||
"""
|
"""
|
||||||
imported_profiles = []
|
imported_profiles = []
|
||||||
|
|
||||||
|
logger.info(f"import reach from {file_path_name}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
list_profile, list_header = self.read_file_st(str(file_path_name))
|
list_profile, list_header = self.read_file_st(str(file_path_name))
|
||||||
profile_header = ["num", "code1", "code2",
|
profile_header = ["num", "code1", "code2",
|
||||||
|
|
@ -629,7 +631,10 @@ class Reach(SQLSubModel):
|
||||||
d[profile_header[i]] = data
|
d[profile_header[i]] = data
|
||||||
|
|
||||||
prof = ProfileXYZ(
|
prof = ProfileXYZ(
|
||||||
**d, reach=self, status=self._status
|
id=-1,
|
||||||
|
**d,
|
||||||
|
reach=self,
|
||||||
|
status=self._status
|
||||||
)
|
)
|
||||||
prof.import_points(profile)
|
prof.import_points(profile)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,6 @@ class Plot(PamhyrPlot):
|
||||||
return event.ydata
|
return event.ydata
|
||||||
|
|
||||||
def rect_select_callback(self, eclick, erelease):
|
def rect_select_callback(self, eclick, erelease):
|
||||||
|
|
||||||
hyd = self.highlight
|
hyd = self.highlight
|
||||||
x1, y1 = eclick.xdata, eclick.ydata
|
x1, y1 = eclick.xdata, eclick.ydata
|
||||||
x2, y2 = erelease.xdata, erelease.ydata
|
x2, y2 = erelease.xdata, erelease.ydata
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
||||||
SetXCommand(
|
SetXCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
self._data.point(row).x,
|
self._data.point(row).x,
|
||||||
value
|
value.replace(",", ".")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif column == 1:
|
elif column == 1:
|
||||||
|
|
@ -115,7 +115,7 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
||||||
SetYCommand(
|
SetYCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
self._data.point(row).y,
|
self._data.point(row).y,
|
||||||
value
|
value.replace(",", ".")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif column == 2:
|
elif column == 2:
|
||||||
|
|
@ -123,7 +123,7 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
||||||
SetZCommand(
|
SetZCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
self._data.point(row).z,
|
self._data.point(row).z,
|
||||||
value
|
value.replace(",", ".")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif column == 3:
|
elif column == 3:
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from tools import trace, timer
|
from tools import trace, timer
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
|
|
@ -24,6 +26,8 @@ from PyQt5.QtWidgets import (
|
||||||
|
|
||||||
from Model.Geometry.Profile import Profile
|
from Model.Geometry.Profile import Profile
|
||||||
|
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class SetDataCommand(QUndoCommand):
|
class SetDataCommand(QUndoCommand):
|
||||||
def __init__(self, profile, index, old_value, new_value):
|
def __init__(self, profile, index, old_value, new_value):
|
||||||
|
|
@ -107,6 +111,7 @@ class AddCommand(QUndoCommand):
|
||||||
self._point = self._profile.insert(self._index)
|
self._point = self._profile.insert(self._index)
|
||||||
else:
|
else:
|
||||||
self._profile.insert_point(self._index, self._point)
|
self._profile.insert_point(self._index, self._point)
|
||||||
|
|
||||||
self._profile.modified()
|
self._profile.modified()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,11 +201,13 @@ class ProfileWindow(PamhyrWindow):
|
||||||
|
|
||||||
def add(self):
|
def add(self):
|
||||||
table = self.find(QTableView, "tableView")
|
table = self.find(QTableView, "tableView")
|
||||||
|
|
||||||
if len(table.selectedIndexes()) == 0:
|
if len(table.selectedIndexes()) == 0:
|
||||||
self._tablemodel.insert_row(self._tablemodel.rowCount())
|
self._tablemodel.insert_row(self._tablemodel.rowCount())
|
||||||
else:
|
else:
|
||||||
row = self.index_selected_row()
|
row = self.index_selected_row()
|
||||||
self._tablemodel.insert_row(row + 1)
|
self._tablemodel.insert_row(row + 1)
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue