mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Profiles: Fix shift methode.
parent
3a3b5ea2dd
commit
64d2b2678a
|
|
@ -338,6 +338,13 @@ class PointXYZ(Point):
|
||||||
self._z = float(value)
|
self._z = float(value)
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
|
def shift(self, x, y, z):
|
||||||
|
self.x += x
|
||||||
|
self.y += y
|
||||||
|
self.z += z
|
||||||
|
|
||||||
|
self.modified()
|
||||||
|
|
||||||
def get_coordinate(self):
|
def get_coordinate(self):
|
||||||
return (self._x, self._y, self._z)
|
return (self._x, self._y, self._z)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ from typing import List
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from tools import timer, flatten
|
from tools import trace, timer, flatten
|
||||||
from shapely import geometry
|
from shapely import geometry
|
||||||
|
|
||||||
from Model.Tools.PamhyrDB import SQLSubModel
|
from Model.Tools.PamhyrDB import SQLSubModel
|
||||||
|
|
@ -1073,16 +1073,10 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
|
|
||||||
def shift(self, x, y, z):
|
def shift(self, x, y, z):
|
||||||
for p in self._points:
|
for p in self._points:
|
||||||
p.x = p.x + x
|
p.shift(x, y, z)
|
||||||
p.y = p.y + y
|
|
||||||
p.z = p.z + z
|
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
def modified(self):
|
|
||||||
self.tab_up_to_date = False
|
|
||||||
self.station_up_to_date = False
|
|
||||||
|
|
||||||
def add_npoints(self, npoints):
|
def add_npoints(self, npoints):
|
||||||
# add npoints in a profile
|
# add npoints in a profile
|
||||||
for k in range(npoints):
|
for k in range(npoints):
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ from functools import reduce
|
||||||
from SQL import SQL
|
from SQL import SQL
|
||||||
from Model.Except import NotImplementedMethodeError
|
from Model.Except import NotImplementedMethodeError
|
||||||
|
|
||||||
|
from tools import trace
|
||||||
|
|
||||||
from Model.Tools.PamhyrID import PamhyrID
|
from Model.Tools.PamhyrID import PamhyrID
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def meshing(self, mesher, data, tableView):
|
def meshing(self, mesher, data, tableView):
|
||||||
|
|
||||||
new_profiles = mesher.meshing(
|
new_profiles = mesher.meshing(
|
||||||
self._data,
|
self._data,
|
||||||
**data
|
**data
|
||||||
|
|
@ -287,7 +286,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def purge(self, np_purge):
|
def purge(self, np_purge):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PurgeCommand(
|
PurgeCommand(
|
||||||
self._data, np_purge
|
self._data, np_purge
|
||||||
|
|
@ -296,7 +294,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def shift(self, rows, dx, dy, dz):
|
def shift(self, rows, dx, dy, dz):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
ShiftCommand(
|
ShiftCommand(
|
||||||
self._data, rows, dx, dy, dz
|
self._data, rows, dx, dy, dz
|
||||||
|
|
@ -305,7 +302,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def change_reach(self, new_reach, parent):
|
def change_reach(self, new_reach, parent):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
ChangeReachCommand(
|
ChangeReachCommand(
|
||||||
new_reach,
|
new_reach,
|
||||||
|
|
|
||||||
|
|
@ -411,13 +411,13 @@ class ShiftCommand(QUndoCommand):
|
||||||
def undo(self):
|
def undo(self):
|
||||||
for i in self._rows:
|
for i in self._rows:
|
||||||
profile = self._reach.profiles[i]
|
profile = self._reach.profiles[i]
|
||||||
self._reach.profiles[i].shift(
|
profile.shift(
|
||||||
-self._dx, -self._dy, -self._dz
|
-self._dx, -self._dy, -self._dz
|
||||||
)
|
)
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
for i in self._rows:
|
for i in self._rows:
|
||||||
profile = self._reach.profiles[i]
|
profile = self._reach.profiles[i]
|
||||||
self._reach.profiles[i].shift(
|
profile.shift(
|
||||||
self._dx, self._dy, self._dz
|
self._dx, self._dy, self._dz
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue