개정판 61b3b744
issue #563: eq tag ongoing
Change-Id: I1503953ef392dd831557f0ce953741b060e6c5b0
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
440 | 440 |
lineNos = [] |
441 | 441 |
spec_breaks = [] |
442 | 442 |
lineIndicator = [] |
443 |
vendor_packages = [item for item in worker.graphicsView.scene.items() if type(item) is QEngineeringVendorItem and item.type == 'Vendor Package'] |
|
444 |
equip_packages = [item for item in worker.graphicsView.scene.items() if type(item) is QEngineeringVendorItem and item.type == 'Equipment Package'] |
|
443 |
vendor_packages = [item for item in worker.graphicsView.scene.items() if type(item) is QEngineeringVendorItem and item.pack_type == 'Vendor Package']
|
|
444 |
equip_packages = [item for item in worker.graphicsView.scene.items() if type(item) is QEngineeringVendorItem and item.pack_type == 'Equipment Package']
|
|
445 | 445 |
end_breaks = [] |
446 | 446 |
notes = [] |
447 | 447 |
flow_marks = [] |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
534 | 534 |
self.add_assoc_item(value, 0) |
535 | 535 |
matches = [prop for prop, _ in self._properties.items() if prop.Attribute == property] |
536 | 536 |
if matches: self._properties[matches[0]] = value |
537 |
|
|
538 |
def center(self): |
|
539 |
return self.sceneBoundingRect().center() |
DTI_PID/DTI_PID/Shapes/EngineeringEquipmentItem.py | ||
---|---|---|
31 | 31 |
self._properties = \ |
32 | 32 |
{ \ |
33 | 33 |
#SymbolProp(None, 'Desc', 'String', Expression="self.desc"): None |
34 |
SymbolProp(None, 'Name', 'Tag No', Expression='self.EvaluatedName'): None |
|
34 |
SymbolProp(None, 'Name Tag', 'Tag No', Expression='self.EvaluatedName'): None
|
|
35 | 35 |
} |
36 | 36 |
|
37 | 37 |
''' |
DTI_PID/DTI_PID/Shapes/EngineeringVendorItem.py | ||
---|---|---|
41 | 41 |
self.setColor(self._color if pack_type == 'Vendor Package' else QEngineeringVendorItem.EQUIPMENT_PACKAGE_COLOR) |
42 | 42 |
self._savedColor = None |
43 | 43 |
|
44 |
self._properties = {SymbolProp(None, 'Name', 'Tag No', Expression='self.EvaluatedName'): None} |
|
44 |
self._properties = {SymbolProp(None, 'Name Tag', 'Tag No', Expression='self.EvaluatedName'): None}
|
|
45 | 45 |
#self._properties = {} |
46 | 46 |
self._pack_type = pack_type |
47 | 47 |
|
... | ... | |
92 | 92 |
def EvaluatedName(self): |
93 | 93 |
return self.NameText |
94 | 94 |
|
95 |
def includes(self, item): |
|
96 |
rect = item.sceneBoundingRect() |
|
97 |
topLeft = QPoint(rect.x(), rect.y()) |
|
98 |
bottomRight = QPoint(rect.x() + rect.width(), rect.y() + rect.height()) |
|
99 |
if self.contains(topLeft) and self.contains(bottomRight): |
|
100 |
return True |
|
95 |
def includes(self, item, margin=0): |
|
96 |
if hasattr(item, 'sceneBoundingRect'): |
|
97 |
rect = item.sceneBoundingRect() |
|
98 |
topLeft = QPoint(rect.x(), rect.y()) |
|
99 |
bottomRight = QPoint(rect.x() + rect.width(), rect.y() + rect.height()) |
|
100 |
if self.contains(topLeft) and self.contains(bottomRight): |
|
101 |
return True |
|
102 |
else: |
|
103 |
return False |
|
104 |
|
|
101 | 105 |
else: |
102 |
return False |
|
106 |
pt = item |
|
107 |
rect = self.sceneBoundingRect() |
|
108 |
allowed_error = 0.1 |
|
109 |
|
|
110 |
if abs(rect.x() - 0) <= allowed_error and abs(rect.y() - 0) <= allowed_error: |
|
111 |
# when first recognition step, symbols are not in scene(not yet added) therefore cannot use scenebounding rect |
|
112 |
minX = self.loc[0] - margin |
|
113 |
minY = self.loc[1] - margin |
|
114 |
maxX = minX + self.size[0] + margin |
|
115 |
maxY = minY + self.size[1] + margin |
|
116 |
else: |
|
117 |
minX = rect.x() - margin |
|
118 |
minY = rect.y() - margin |
|
119 |
maxX = minX + rect.width() + margin |
|
120 |
maxY = minY + rect.height() + margin |
|
121 |
|
|
122 |
return True if (pt[0] >= minX and pt[0] <= maxX and pt[1] >= minY and pt[1] <= maxY) else False |
|
103 | 123 |
|
104 | 124 |
def insert_conn_after(self, conn): |
105 | 125 |
"""insert new point after given connector""" |
DTI_PID/DTI_PID/Shapes/QEngineeringTagNoTextItem.py | ||
---|---|---|
21 | 21 |
from AppDocData import AppDocData,MessageType |
22 | 22 |
from EngineeringTextItem import QEngineeringTextItem |
23 | 23 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
24 |
from EngineeringVendorItem import QEngineeringVendorItem |
|
24 | 25 |
|
25 | 26 |
class QEngineeringTagNoTextItem(QEngineeringTextItem): |
26 | 27 |
""" This is engineering tag no text item class """ |
... | ... | |
45 | 46 |
center = self.sceneBoundingRect().center() |
46 | 47 |
|
47 | 48 |
for symbol in symbols: |
48 |
if type(symbol) is QEngineeringEquipmentItem: |
|
49 |
if symbol.includes([self.sceneBoundingRect().center().x(), self.sceneBoundingRect().center().y()]):
|
|
49 |
if type(symbol) is QEngineeringEquipmentItem or type(symbol) is QEngineeringVendorItem:
|
|
50 |
if symbol.includes([center.x(), center.y()]):
|
|
50 | 51 |
selected = symbol |
51 | 52 |
break |
52 | 53 |
|
53 | 54 |
if selected is None: |
54 | 55 |
for symbol in symbols: |
55 |
if type(symbol) is QEngineeringEquipmentItem: |
|
56 |
if type(symbol) is QEngineeringEquipmentItem or type(symbol) is QEngineeringVendorItem:
|
|
56 | 57 |
dx = symbol.center().x() - center.x() |
57 | 58 |
dy = symbol.center().y() - center.y() |
58 | 59 |
length = math.sqrt(dx*dx + dy*dy) |
내보내기 Unified diff