개정판 e57e94c3
issue #538: line assistant test
Change-Id: I2d5d66a7b7a80822ed95553b8c16916cbe6c83d7
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
623 | 623 |
if len(items) > 0 and type(items[0]) is QEngineeringConnectorItem: |
624 | 624 |
scenePos = QPointF(items[0].center()[0], items[0].center()[1]) |
625 | 625 |
connectors = [connector for connector in items if issubclass(type(connector.parentItem()), SymbolSvgItem)] |
626 |
if not connectors: |
|
627 |
connectors = [connector for connector in items if type(connector.parentItem()) is QEngineeringLineItem] |
|
626 | 628 |
|
627 | 629 |
matches = [item for item in self.scene().items() if |
628 | 630 |
(type(item) is QEngineeringLineItem) and (item.distanceTo((scenePos.x(), scenePos.y())) < 20)] |
... | ... | |
636 | 638 |
length = math.sqrt(xl * xl + yl * yl) |
637 | 639 |
ddx = (connectors[0].sceneBoundingRect().center().x() - connectors[0].parentItem().origin[0]) / length |
638 | 640 |
ddy = (connectors[0].sceneBoundingRect().center().y() - connectors[0].parentItem().origin[1]) / length |
639 |
dx, dy = abs(svg.connectors[0].connectPoint[0] - svg.symbolOrigin[0]), abs(
|
|
640 |
svg.connectors[0].connectPoint[1] - svg.symbolOrigin[1])
|
|
641 |
dx, dy = abs(svg.connectors[1].connectPoint[0] - svg.symbolOrigin[0]), abs(
|
|
642 |
svg.connectors[1].connectPoint[1] - svg.symbolOrigin[1])
|
|
641 | 643 |
length = math.sqrt(dx * dx + dy * dy) |
642 | 644 |
dx, dy = length * ddx, length * ddy |
643 | 645 |
|
... | ... | |
647 | 649 |
# dx, dy = ddx * dx, ddy * dy |
648 | 650 |
|
649 | 651 |
flip = connectors[0].parentItem().flip |
650 |
angle = connectors[0].parentItem().angle |
|
652 |
if issubclass(type(connectors[0].parentItem()), SymbolSvgItem): |
|
653 |
angle = connectors[0].parentItem().angle |
|
654 |
else : |
|
655 |
if connectors[0].parentItem().isVertical(): |
|
656 |
angle = 3.141592653589793 |
|
657 |
else: |
|
658 |
angle = 0 |
|
651 | 659 |
|
652 | 660 |
rAngle = math.atan2(yl, xl) if flip == 0 else math.atan2(yl, -xl) |
653 | 661 |
rAngle = abs(rAngle) if rAngle < 0 + allowed_error else 2 * math.pi - rAngle |
내보내기 Unified diff