개정판 bc085959
fixed issue #482:
- Reducer의 Size를 출력해야 함
- Angle Valve의 경우 심볼의 원점까지 선을 연장해서 그려야 함
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
249 | 249 |
tracer.execute(worker.displayMessage, worker.updateProgress) |
250 | 250 |
# up to here |
251 | 251 |
|
252 |
|
|
253 | 252 |
findSymbols = [symbol for symbol in worker.graphicsView.scene.items() if type(symbol) is SymbolSvgItem and symbol.hasInstrumentLabel == 1] |
254 | 253 |
for symbol in findSymbols: |
255 | 254 |
symbol.getConnectedLabel(worker) |
DTI_PID/DTI_PID/ResultPropertyTableWidget.py | ||
---|---|---|
177 | 177 |
def initTitleCell(self, item): |
178 | 178 |
try: |
179 | 179 |
if issubclass(type(item), SymbolSvgItem) or type(item) is SymbolSvgItem: |
180 |
self.setRowCount(3)
|
|
180 |
self.setRowCount(4)
|
|
181 | 181 |
|
182 |
widgetItem = QTableWidgetItem("심볼명") |
|
183 |
self.setItem(0, 0, widgetItem) |
|
184 |
widgetItem = QTableWidgetItem("타입") |
|
185 |
self.setItem(1, 0, widgetItem) |
|
186 |
widgetItem = QTableWidgetItem("각도") |
|
187 |
self.setItem(2, 0, widgetItem) |
|
182 |
self.setItem(0, 0, QTableWidgetItem("심볼명")) |
|
183 |
self.setItem(1, 0, QTableWidgetItem("타입")) |
|
184 |
self.setItem(2, 0, QTableWidgetItem("각도")) |
|
185 |
self.setItem(3, 0, QTableWidgetItem("원점")) |
|
188 | 186 |
elif type(item) is QEngineeringNoteItem: |
189 | 187 |
self.setRowCount(1) |
190 | 188 |
|
... | ... | |
227 | 225 |
from QEngineeringInstrumentItem import QEngineeringInstrumentItem |
228 | 226 |
|
229 | 227 |
if self.symData is not None: |
230 |
self.setRowCount(3 + len(self.symData.getAttributes()) + len(self.symData.conns))
|
|
228 |
self.setRowCount(self.rowCount() + len(self.symData.getAttributes()) + len(self.symData.conns))
|
|
231 | 229 |
|
232 | 230 |
self.setItem(0, 1, QTableWidgetItem(self.symData.name)) |
233 | 231 |
self.setItem(1, 1, QTableWidgetItem(self.symData.type)) |
234 | 232 |
self.setItem(2, 1, QTableWidgetItem(str(round(math.degrees(self.symData.angle))))) |
233 |
self.setItem(3, 1, QTableWidgetItem(str(self.symData.origin))) |
|
235 | 234 |
|
236 |
row = 3
|
|
235 |
row = 4
|
|
237 | 236 |
# display attributes of symbol |
238 | 237 |
attrs = self.symData.getAttributes() |
239 | 238 |
if attrs is not None: |
DTI_PID/DTI_PID/Shapes/QEngineeringNozzleItem.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
|
|
3 |
import sys |
|
4 |
import os |
|
5 |
import math |
|
6 |
from PyQt5.QtGui import * |
|
7 |
from PyQt5.QtCore import * |
|
8 |
from PyQt5.QtSvg import * |
|
9 |
from PyQt5.QtWidgets import (QApplication, QGraphicsItem) |
|
10 |
|
|
11 |
from SymbolSvgItem import SymbolSvgItem |
|
12 |
from QEngineeringConnectorItem import QEngineeringConnectorItem |
|
13 |
|
|
14 |
class QEngineeringNozzleItem(SymbolSvgItem): |
|
15 |
clicked = pyqtSignal(QGraphicsSvgItem) |
|
16 |
removed = pyqtSignal(QGraphicsItem) |
|
17 |
|
|
18 |
''' |
|
19 |
''' |
|
20 |
def __init__(self, path): |
|
21 |
import uuid |
|
22 |
|
|
23 |
SymbolSvgItem.__init__(self, path) |
|
24 |
|
|
25 |
''' |
|
26 |
@brief connect attribute |
|
27 |
@author humkyung |
|
28 |
@date 2018.07.19 |
|
29 |
''' |
|
30 |
def connectAttribute(self, attributes): |
|
31 |
from QEngineeringTagNoTextItem import QEngineeringTagNoTextItem |
|
32 |
|
|
33 |
self.attrs.clear() |
|
34 |
|
|
35 |
super(QEngineeringNozzleItem, self).connectAttribute(attributes) |
|
36 |
|
|
37 |
rect = self.sceneBoundingRect() |
|
38 |
attrs = [attr for attr in attributes if type(attr) is QEngineeringTagNoTextItem] |
|
39 |
# check if text locates inside equipment |
|
40 |
for attr in attrs: |
|
41 |
if rect.contains(attr.center()): |
|
42 |
self.attrs.append(attr) |
|
43 |
attrs.remove(attr) |
|
44 |
break |
|
45 |
|
|
46 |
if not self.attrs: |
|
47 |
minDist = None |
|
48 |
selected = None |
|
49 |
# get nearest text from equipment |
|
50 |
for attr in attrs: |
|
51 |
dx = attr.center().x() - rect.center().x() |
|
52 |
dy = attr.center().y() - rect.center().y() |
|
53 |
dist = math.sqrt(dx*dx + dy*dy) |
|
54 |
if (minDist is None) or (dist < minDist): |
|
55 |
minDist = dist |
|
56 |
selected = attr |
|
57 |
|
|
58 |
if selected is not None: self.attrs.append(selected) |
|
59 |
|
|
60 |
''' |
|
61 |
@brief generate xml code for nozzle |
|
62 |
@author humkyung |
|
63 |
@date 2018.07.19 |
|
64 |
''' |
|
65 |
def toXml(self): |
|
66 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree |
|
67 |
|
|
68 |
try: |
|
69 |
node = SymbolSvgItem.toXml(self) |
|
70 |
self.toXmlAsAttribute(node) |
|
71 |
except Exception as ex: |
|
72 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
73 |
|
|
74 |
return node |
|
75 |
|
|
76 |
''' |
|
77 |
@brief generate xml code for attribute |
|
78 |
@author humkyung |
|
79 |
@date 2018.07.19 |
|
80 |
''' |
|
81 |
def toXmlAsAttribute(self, parentNode): |
|
82 |
for attr in self.attrs: |
|
83 |
parentNode.append(attr.toXml(self, None)) |
DTI_PID/DTI_PID/Shapes/QEngineeringRunItem.py | ||
---|---|---|
114 | 114 |
groupItems = [item for item in connectedLines if line.isExtendable(item)] if flag else [] |
115 | 115 |
|
116 | 116 |
pts = [] |
117 |
pts.append(line.startPoint()) |
|
118 |
pts.append(line.endPoint()) |
|
117 |
# extend line to origin of symbol if symbol is 'Angle Valve' |
|
118 |
if line.conns[0] is not None and issubclass(type(line.conns[0]), SymbolSvgItem) and line.conns[0].parentSymbol == 'Angle Valve': |
|
119 |
pts.append(line.conns[0].origin) |
|
120 |
else: |
|
121 |
pts.append(line.startPoint()) |
|
122 |
|
|
123 |
if line.conns[1] is not None and issubclass(type(line.conns[1]), SymbolSvgItem) and line.conns[1].parentSymbol == 'Angle Valve': |
|
124 |
pts.append(line.conns[1].origin) |
|
125 |
else: |
|
126 |
pts.append(line.endPoint()) |
|
127 |
|
|
119 | 128 |
for item in groupItems: |
120 |
pts.append(item.startPoint()) |
|
121 |
pts.append(item.endPoint()) |
|
129 |
if item.conns[0] is not None and issubclass(type(item.conns[0]), SymbolSvgItem) and item.conns[0].parentSymbol == 'Angle Valve': |
|
130 |
pts.append(item.conns[0].origin) |
|
131 |
else: |
|
132 |
pts.append(item.startPoint()) |
|
133 |
|
|
134 |
if item.conns[1] is not None and issubclass(type(item.conns[1]), SymbolSvgItem) and item.conns[1].parentSymbol == 'Angle Valve': |
|
135 |
pts.append(item.conns[1].origin) |
|
136 |
else: |
|
137 |
pts.append(item.endPoint()) |
|
138 |
# up to here |
|
122 | 139 |
|
123 | 140 |
longestPoints = self.getLongestTwoPoints(pts) |
124 | 141 |
if 2 == len(longestPoints): |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
571 | 571 |
@date 2018.05.02 |
572 | 572 |
@history 2018.05.08 Jeongwoo Change type name (Piping OPC''S → Piping OPC's) |
573 | 573 |
humkyung 2018.05.10 change symbol's color to blue |
574 |
humkyung 2018.07.19 create nozzle instance if type is 'Nozzles' |
|
574 | 575 |
''' |
575 | 576 |
@staticmethod |
576 | 577 |
def createItem(type, path): |
577 | 578 |
from QEngineeringOPCItem import QEngineeringOPCItem |
578 | 579 |
from QEngineeringEquipmentItem import QEngineeringEquipmentItem |
579 | 580 |
from QEngineeringInstrumentItem import QEngineeringInstrumentItem |
581 |
from QEngineeringNozzleItem import QEngineeringNozzleItem |
|
580 | 582 |
from AppDocData import AppDocData |
581 | 583 |
|
582 | 584 |
docData = AppDocData.instance() |
... | ... | |
589 | 591 |
item = QEngineeringEquipmentItem(path) |
590 | 592 |
elif cateogry == 'Instrumentation': |
591 | 593 |
item = QEngineeringInstrumentItem(path) |
594 |
elif type == 'Nozzles': |
|
595 |
item = QEngineeringNozzleItem(path) |
|
592 | 596 |
else: |
593 | 597 |
item = SymbolSvgItem(path) |
594 | 598 |
|
내보내기 Unified diff