개정판 e1556005
issue #1052: Streamline 태그 위치 보정
Change-Id: I2a396113b58a00c365075ab0388d4b4fb4bad0fb
HYTOS/HYTOS/QtImageViewer.py | ||
---|---|---|
572 | 572 |
return svg |
573 | 573 |
|
574 | 574 |
''' |
575 |
@brief match symbol to line |
|
576 |
@author kyouho |
|
577 |
@date 2018.07.27 |
|
578 |
@history humkyung 2018.08.23 change scenePos to connector's center when symbol is placed on connector |
|
579 |
''' |
|
580 |
def matchSymbolToLine(self, svg, scenePos): |
|
581 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
|
582 |
|
|
583 |
items = [item for item in self.scene.items(scenePos) if type(item) is not QGraphicsPixmapItem] |
|
584 |
if len(items) > 0 and type(items[0]) is QEngineeringConnectorItem: |
|
585 |
scenePos = QPointF(items[0].center()[0], items[0].center()[1]) |
|
586 |
|
|
587 |
transform = QTransform() |
|
588 |
transform.translate(scenePos.x() - svg.symbolOrigin[0], scenePos.y() - svg.symbolOrigin[1]) |
|
589 |
svg.setTransform(transform) |
|
590 |
svg.loc = [round(scenePos.x() - svg.symbolOrigin[0], 1), round(scenePos.y() - svg.symbolOrigin[1], 1)] |
|
591 |
svg.size = [svg.boundingRect().width(), svg.boundingRect().height()] |
|
592 |
svg.origin = [round(scenePos.x(), 1), round(scenePos.y(), 1)] |
|
593 |
self.scene.addItem(svg) |
|
594 |
|
|
595 |
svg.transfer.onRemoved.connect(self.mainWindow.on_item_removed) |
|
596 |
|
|
597 |
for conn in svg.connectors: |
|
598 |
conn.sceneConnectPoint = (conn.sceneBoundingRect().center().x(), conn.sceneBoundingRect().center().y()) |
|
599 |
|
|
600 |
self.scene.clearFocus() |
|
601 |
for item in self.scene.selectedItems(): |
|
602 |
item.setSelected(False) |
|
603 |
|
|
604 |
#self.setFocus() |
|
605 |
#svg.setSelected(True) |
|
606 |
#self.scene.setFocusItem(svg) |
|
607 |
|
|
608 |
''' |
|
609 | 575 |
@brief find item by uid (SymbolSvgItem 기반, QEngineeringConnectorItem 제외, QEngineeringLineItem 포함) |
610 | 576 |
@author kyouho |
611 | 577 |
@date 2018.07.31 |
내보내기 Unified diff