개정판 e57e94c3
issue #538: line assistant test
Change-Id: I2d5d66a7b7a80822ed95553b8c16916cbe6c83d7
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1568 | 1568 |
cursor.execute(sql) |
1569 | 1569 |
rows = cursor.fetchall() |
1570 | 1570 |
for row in rows: |
1571 |
symbolNametList.append(row[4]) # Name String
|
|
1571 |
symbolNametList.append(row['Name']) # Name String
|
|
1572 | 1572 |
except Exception as ex: |
1573 | 1573 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
1574 | 1574 |
sys.exc_info()[-1].tb_lineno)) |
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 |
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
219 | 219 |
''' |
220 | 220 |
|
221 | 221 |
def setPos(self, pos): |
222 |
self.connectPoint = [pos.x(), pos.y()] if type(pos) is QPointF else [pos[0], pos[1]] |
|
222 | 223 |
self._loc = [pos.x(), pos.y()] if type(pos) is QPointF else [pos[0], pos[1]] |
223 | 224 |
self.setRect(self._loc[0] - round(self.SMALL_SIZE * 0.5), self._loc[1] - round(self.SMALL_SIZE * 0.5), |
224 | 225 |
self.SMALL_SIZE, self.SMALL_SIZE) |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
117 | 117 |
return None |
118 | 118 |
|
119 | 119 |
@property |
120 |
def symbolOrigin(self): |
|
121 |
# return center point like symbol |
|
122 |
return [self.sceneBoundingRect().center().x(), self.sceneBoundingRect().center().y()] |
|
123 |
|
|
124 |
@property |
|
125 |
def origin(self): |
|
126 |
# return center point like symbol |
|
127 |
return [self.sceneBoundingRect().center().x(), self.sceneBoundingRect().center().y()] |
|
128 |
|
|
129 |
@property |
|
130 |
def flip(self): |
|
131 |
# return 0 |
|
132 |
return 0 |
|
133 |
|
|
134 |
@property |
|
120 | 135 |
def EvaluatedSize(self): |
121 | 136 |
from EngineeringReducerItem import QEngineeringReducerItem |
122 | 137 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
내보내기 Unified diff