개정판 0ebafb60
dev issue #538: edit rotate, standard point move logic
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
693 | 693 |
@author kyouho |
694 | 694 |
@date 2018.07.25 |
695 | 695 |
''' |
696 |
def reDrawLine(self, symbol, changedConnPoint1, changedConnPoint2): |
|
697 |
# startPoint에 symbol |
|
698 |
if self.connectors[0].connectedItem == symbol: |
|
699 |
if self.startPoint()[0] == symbol.connectors[0].sceneConnectPoint[0] and self.startPoint()[1] == symbol.connectors[0].sceneConnectPoint[1]: |
|
700 |
line = QLineF(QPointF(changedConnPoint1[0], changedConnPoint1[1]), self.line().p2()) |
|
701 |
self.setLine(line) |
|
702 |
else: |
|
703 |
line = QLineF(QPointF(changedConnPoint2[0], changedConnPoint2[1]), self.line().p2()) |
|
704 |
self.setLine(line) |
|
705 |
# endPoint에 symbol |
|
706 |
elif self.connectors[1].connectedItem == symbol: |
|
707 |
if self.endPoint()[0] == symbol.connectors[0].sceneConnectPoint[0] and self.endPoint()[1] == symbol.connectors[0].sceneConnectPoint[1]: |
|
708 |
line = QLineF(self.line().p1(), QPointF(changedConnPoint1[0], changedConnPoint1[1])) |
|
709 |
self.setLine(line) |
|
710 |
else: |
|
711 |
line = QLineF(self.line().p1(), QPointF(changedConnPoint2[0], changedConnPoint2[1])) |
|
712 |
self.setLine(line) |
|
696 |
def reDrawLine(self, symbol, point): |
|
697 |
for index in range(len(self.connectors)): |
|
698 |
if self.connectors[index].connectedItem == symbol: |
|
699 |
#startPoint |
|
700 |
if index == 0: |
|
701 |
line = QLineF(QPointF(point[0], point[1]), self.line().p2()) |
|
702 |
self.setLine(line) |
|
703 |
#endpoint |
|
704 |
else: |
|
705 |
line = QLineF(self.line().p1(), QPointF(point[0], point[1])) |
|
706 |
self.setLine(line) |
|
707 |
|
|
708 |
|
|
709 |
|
|
710 |
## startPoint에 symbol |
|
711 |
#if self.connectors[0].connectedItem == symbol: |
|
712 |
# if self.startPoint()[0] == symbol.connectors[0].sceneConnectPoint[0] and self.startPoint()[1] == symbol.connectors[0].sceneConnectPoint[1]: |
|
713 |
# line = QLineF(QPointF(changedConnPoint1[0], changedConnPoint1[1]), self.line().p2()) |
|
714 |
# self.setLine(line) |
|
715 |
# else: |
|
716 |
# line = QLineF(QPointF(changedConnPoint2[0], changedConnPoint2[1]), self.line().p2()) |
|
717 |
# self.setLine(line) |
|
718 |
## endPoint에 symbol |
|
719 |
#elif self.connectors[1].connectedItem == symbol: |
|
720 |
# if self.endPoint()[0] == symbol.connectors[0].sceneConnectPoint[0] and self.endPoint()[1] == symbol.connectors[0].sceneConnectPoint[1]: |
|
721 |
# line = QLineF(self.line().p1(), QPointF(changedConnPoint1[0], changedConnPoint1[1])) |
|
722 |
# self.setLine(line) |
|
723 |
# else: |
|
724 |
# line = QLineF(self.line().p1(), QPointF(changedConnPoint2[0], changedConnPoint2[1])) |
|
725 |
# self.setLine(line) |
|
713 | 726 |
|
714 | 727 |
self.update() |
715 | 728 |
|
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
930 | 930 |
|
931 | 931 |
self.setTransform(transform) |
932 | 932 |
|
933 |
# redrawLine |
|
934 |
if len(self.connectors) == 2 and self.connectors[0].connectedItem is not None and self.connectors[1].connectedItem is not None: |
|
935 |
line1 = self.connectors[0].connectedItem |
|
936 |
line2 = self.connectors[1].connectedItem |
|
937 |
if line1 is not None and line2 is not None : |
|
938 |
|
|
939 |
changedConnPoint1 = transform.map(QPointF(self.connectors[0].connectPoint[0], self.connectors[0].connectPoint[1])) |
|
940 |
changedConnPoint1 = (changedConnPoint1.x(), changedConnPoint1.y()) |
|
941 |
changedConnPoint2 = transform.map(QPointF(self.connectors[1].connectPoint[0], self.connectors[1].connectPoint[1])) |
|
942 |
changedConnPoint2 = (changedConnPoint2.x(), changedConnPoint2.y()) |
|
943 |
|
|
944 |
line1.reDrawLine(self, changedConnPoint1, changedConnPoint2) |
|
945 |
line2.reDrawLine(self, changedConnPoint1, changedConnPoint2) |
|
933 |
from EngineeringLineItem import QEngineeringLineItem |
|
934 |
for connector in self.connectors: |
|
935 |
if connector.connectedItem is not None and type(connector.connectedItem) == QEngineeringLineItem: |
|
936 |
line = connector.connectedItem |
|
937 |
line.reDrawLine(self, connector.center()) |
|
946 | 938 |
|
947 |
self.connectors[0].sceneConnectPoint = changedConnPoint1 |
|
948 |
self.connectors[1].sceneConnectPoint = changedConnPoint2 |
|
949 | 939 |
|
950 | 940 |
''' |
951 | 941 |
@brief change Conn point |
... | ... | |
953 | 943 |
@date 2018.07.25 |
954 | 944 |
''' |
955 | 945 |
def changeConnPoint(self): |
956 |
if len(self.connectors) == 2 and self.connectors[0].connectedItem is not None and self.connectors[1].connectedItem is not None: |
|
957 |
line1 = self.connectors[0].connectedItem |
|
958 |
line2 = self.connectors[1].connectedItem |
|
959 |
if line1 is not None and line2 is not None : |
|
960 |
# line1의 startPoint |
|
961 |
# line2의 endPoint |
|
962 |
if line1.connectors[0] == self: |
|
963 |
temp = line1.startPoint() |
|
964 |
line1.reDrawLine(self, line2.endPoint(), line2.endPoint()) |
|
965 |
line2.reDrawLine(self, temp, temp) |
|
966 |
# line1의 endPoint |
|
967 |
# line2의 startPoint |
|
968 |
else: |
|
969 |
temp = line1.endPoint() |
|
970 |
line1.reDrawLine(self, line2.startPoint(), line2.startPoint()) |
|
971 |
line2.reDrawLine(self, temp, temp) |
|
946 |
if len(self.connectors) == 2: |
|
947 |
|
|
948 |
conn1Item = self.connectors[0].connectedItem |
|
949 |
conn2Item = self.connectors[1].connectedItem |
|
950 |
self.connectors[0].connectedItem = conn2Item |
|
951 |
self.connectors[1].connectedItem = conn1Item |
|
952 |
|
|
953 |
currentPoint = self.getCurrentPoint() |
|
954 |
self.reSettingSymbol(currentPoint, self.angle) |
|
972 | 955 |
|
973 | 956 |
''' |
974 | 957 |
@brief change standard point |
내보내기 Unified diff