개정판 12fbbf9a
issue #486: improve auto connection
Change-Id: I03e2aad7480096dc5a2a6f029f7a971c0e91feef
DTI_PID/DTI_PID/LineDetector.py | ||
---|---|---|
9 | 9 |
try: |
10 | 10 |
thresh = 127 |
11 | 11 |
self._image = image |
12 |
self.width, self.height = self._image.shape[::-1] if self._image else [None, None] |
|
13 |
self.Result = np.zeros((self.width, self.height, 3), np.uint8) if self._image else None |
|
12 |
self.width = self._image.shape[::-1][0] if self._image is not None else None |
|
13 |
self.height = self._image.shape[::-1][1] if self._image is not None else None |
|
14 |
self.Result = np.zeros((self.width, self.height, 3), np.uint8) if self._image is not None else None |
|
14 | 15 |
except Exception as ex: |
15 | 16 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
16 | 17 |
|
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1575 | 1575 |
selected = [item for item in self.graphicsView.scene.items(QPointF(pt[0], pt[1])) if |
1576 | 1576 |
type(item) is QEngineeringConnectorItem or type(item) is QEngineeringLineItem] |
1577 | 1577 |
if selected: |
1578 |
detector.connectLineToLine(lineItem, selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0], 5)
|
|
1578 |
detector.connectLineToLine(selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0], lineItem, 5)
|
|
1579 | 1579 |
|
1580 | 1580 |
items.append(lineItem) |
1581 | 1581 |
self.graphicsView.scene.addItem(lineItem) |
... | ... | |
1584 | 1584 |
selected = [item for item in self.graphicsView.scene.items(QPointF(pt[0], pt[1])) if |
1585 | 1585 |
(type(item) is QEngineeringConnectorItem and item.parent is not items[-1]) or type(item) is QEngineeringLineItem] |
1586 | 1586 |
if selected: |
1587 |
detector.connectLineToLine(items[-1], selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0], 5)
|
|
1587 |
detector.connectLineToLine(selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0], items[-1], 5)
|
|
1588 | 1588 |
|
1589 | 1589 |
finally: |
1590 | 1590 |
self.graphicsView.scene.removeItem(self.actionLine.tag._polyline) |
내보내기 Unified diff