개정판 226d4408
issue #563: line label test
Change-Id: I2208800401aacc0e12d64fe9c24c4bfd35f154ce
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
574 | 574 |
worker.display_message.emit(message) |
575 | 575 |
|
576 | 576 |
""" try to connect label to valve """ |
577 |
labels = [symbol for symbol in symbols if symbol.iType == 19] # Labels - General Instrument => Instrument
|
|
577 |
labels = [symbol for symbol in symbols if symbol.iType == 19] # Labels - Symbol => Instrument
|
|
578 | 578 |
valves = [symbol for symbol in symbols if |
579 | 579 |
symbol.iType == 34 or symbol.iType == 17 or symbol.iType == 22] # Specialty Components, In-Line, Relief Devices |
580 | 580 |
for label in labels: |
581 | 581 |
label.connectAttribute(valves, clear=False) |
582 | 582 |
|
583 |
# for slope, etc.., symbol to line |
|
584 |
labels = [symbol for symbol in symbols if symbol.iType == 30] # Labels - Line => Piping |
|
585 |
for label in labels: |
|
586 |
label.connectAttribute(lines, clear=False) |
|
587 |
|
|
583 | 588 |
''' |
584 |
# for alarm no more used |
|
589 |
# for alarm, symbol to symbol : no more used
|
|
585 | 590 |
labels = [symbol for symbol in symbols if symbol.iType == 29] # Labels - Piping Components => Instrument |
586 | 591 |
valves = [symbol for symbol in symbols if symbol.iType == 25] # System Functions |
587 | 592 |
for label in labels: |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
224 | 224 |
""" return symbol type of associations """ |
225 | 225 |
from SymbolSvgItem import SymbolSvgItem |
226 | 226 |
from EngineeringVendorItem import QEngineeringVendorItem |
227 |
from EngineeringLineItem import QEngineeringLineItem |
|
227 | 228 |
|
228 | 229 |
res = [] |
229 | 230 |
for symbol in [x for x in self.associations() if |
230 |
issubclass(type(x), SymbolSvgItem) or type(x) is QEngineeringVendorItem]: |
|
231 |
issubclass(type(x), SymbolSvgItem) or type(x) is QEngineeringVendorItem or type(x) is QEngineeringLineItem]:
|
|
231 | 232 |
consumed = False |
232 | 233 |
for key in list(self.attrs.keys()): |
233 | 234 |
if key.AssocItem and key.AssocItem is symbol: |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
1111 | 1111 |
from QEngineeringSizeTextItem import QEngineeringSizeTextItem |
1112 | 1112 |
from EngineeringInstrumentItem import QEngineeringInstrumentItem |
1113 | 1113 |
from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem |
1114 |
from EngineeringLineItem import QEngineeringLineItem |
|
1114 | 1115 |
|
1115 | 1116 |
try: |
1116 | 1117 |
if clear: |
... | ... | |
1146 | 1147 |
if rect.contains(attr.center()): |
1147 | 1148 |
if self.add_assoc_item(attr): |
1148 | 1149 |
attr.owner = self # set owner of text |
1150 |
elif type(attr) is QEngineeringLineItem: |
|
1151 |
length = attr.distanceTo([center.x(), center.y()]) |
|
1152 |
if (length < dist) and (minDist is None or length < minDist): |
|
1153 |
minDist = length |
|
1154 |
selected = attr |
|
1149 | 1155 |
|
1150 | 1156 |
if selected is not None: |
1151 |
if self.add_assoc_item(selected): |
|
1152 |
selected.owner = self |
|
1157 |
self.add_assoc_item(selected) |
|
1153 | 1158 |
|
1154 | 1159 |
except Exception as ex: |
1155 | 1160 |
from App import App |
내보내기 Unified diff