개정판 b4415fb6
issue #663: 인식후 심볼 좌표 오류 수정
Change-Id: I3dfcd7decd0ea70cc5b8ff706b5c2795dad80ff4
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
645 | 645 |
self._class = symbolInfo.baseSymbol |
646 | 646 |
originalPoint = symbolInfo.getOriginalPoint().split(',') |
647 | 647 |
self.symbolOrigin = [float(originalPoint[0]), float(originalPoint[1])] |
648 |
self.setTransformOriginPoint(QPointF(self.symbolOrigin[0], self.symbolOrigin[1])) |
|
649 | 648 |
|
650 | 649 |
# setting connectors |
651 | 650 |
connectionPoints = symbolInfo.getConnectionPoint().split('/') |
... | ... | |
1041 | 1040 |
self.changeConnPoint() |
1042 | 1041 |
elif event.key() == Qt.Key_Return: |
1043 | 1042 |
# disable |
1044 |
dialog = QRotateSymbolDialog(None, self.angle, self.origin, self.zValue())
|
|
1043 |
dialog = QRotateSymbolDialog(None, math.radians(self.rotation()), self.origin, self.zValue())
|
|
1045 | 1044 |
(isAccept, angle, x, y, z) = dialog.showDialog() |
1046 | 1045 |
|
1047 | 1046 |
if isAccept: |
1048 |
self.rotate(math.radians(angle)) |
|
1049 |
self.scene().undo_stack.push(RotateCommand(self.scene(), [self, ], self.angle)) |
|
1047 |
_angle = self.rotation() |
|
1048 |
self.rotate(angle) |
|
1049 |
self.scene().undo_stack.push(RotateCommand(self.scene(), [self, ], _angle)) |
|
1050 | 1050 |
self.angle = angle |
1051 | 1051 |
""" |
1052 | 1052 |
self.loc = [x - self.symbolOrigin[0], y - self.symbolOrigin[1]] |
... | ... | |
1235 | 1235 |
# up to here |
1236 | 1236 |
|
1237 | 1237 |
originNode = Element('ORIGINALPOINT') |
1238 |
originNode.text = '{},{}'.format(self.origin[0], self.origin[1]) |
|
1238 |
origin = self.mapToScene(self.transformOriginPoint()) |
|
1239 |
originNode.text = f"{origin.x()},{origin.y()}" |
|
1239 | 1240 |
node.append(originNode) |
1240 | 1241 |
|
1241 | 1242 |
connectorsNode = Element('CONNECTORS') |
... | ... | |
1554 | 1555 |
if matches: |
1555 | 1556 |
item._properties[matches[0]] = matches[0].parse_value(prop_node.text) if prop_node.text else '' |
1556 | 1557 |
|
1557 |
## assign area
|
|
1558 |
# assign area |
|
1558 | 1559 |
areaNode = node.find('AREA') |
1559 | 1560 |
if areaNode is None: |
1560 | 1561 |
for area in appDocData.getAreaList(): |
... | ... | |
1563 | 1564 |
break |
1564 | 1565 |
else: |
1565 | 1566 |
item.area = areaNode.text |
1566 |
## up to here
|
|
1567 |
# up to here |
|
1567 | 1568 |
|
1568 | 1569 |
connectors = node.find('CONNECTORS') |
1569 | 1570 |
if connectors is not None: |
... | ... | |
1896 | 1897 |
|
1897 | 1898 |
def addSvgItemToScene(self, scene, undoable: bool = False) -> None: |
1898 | 1899 |
"""Add Svg Item into ImageViewer's Scene""" |
1899 |
self.setTransformOriginPoint(QPointF(self.symbolOrigin[0], self.symbolOrigin[1])) |
|
1900 |
|
|
1901 | 1900 |
if self.flip: |
1902 | 1901 |
self.flip_symbol() |
1903 | 1902 |
|
1903 |
self.setTransformOriginPoint(QPointF(self.symbolOrigin[0], self.symbolOrigin[1])) |
|
1904 |
|
|
1904 | 1905 |
self.moveBy(-self.symbolOrigin[0], -self.symbolOrigin[1]) |
1905 |
self.setRotation(math.degrees(-self.angle))
|
|
1906 |
self.moveBy(self.loc[0] + self.symbolOrigin[0], self.loc[1] + self.symbolOrigin[1])
|
|
1906 |
self.setRotation(math.degrees(self.angle)) |
|
1907 |
self.moveBy(self.origin[0], self.origin[1])
|
|
1907 | 1908 |
|
1908 | 1909 |
scene.addItem(self) |
1909 | 1910 |
self.size[0], self.size[1] = round(self.sceneBoundingRect().width()), round(self.sceneBoundingRect().height()) |
내보내기 Unified diff