개정판 a99ba45c
issue #563: fix LineNoTracer and add opc flow auto sort
Change-Id: I4c3e1a9fac36d5db8089855de77ca79b33e3308a
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
172 | 172 |
startLine = line |
173 | 173 |
if (startLine is not None) and (minDist < toler): |
174 | 174 |
lineno.conns.append(startLine) |
175 |
if _from is None or _to is None: |
|
176 |
startLine.owner = lineno |
|
175 | 177 |
|
176 | 178 |
if _from and _to and (type(_from) is QEngineeringLineItem or issubclass(type(_from), SymbolSvgItem)) and (type(_to) is QEngineeringLineItem or issubclass(type(_to), SymbolSvgItem)): |
177 | 179 |
_from.owner = lineno |
178 | 180 |
_to.owner = lineno |
179 |
continue |
|
180 | 181 |
else: |
181 | 182 |
lineno.set_property('From', None) |
182 | 183 |
lineno.set_property('To', None) |
... | ... | |
212 | 213 |
|
213 | 214 |
if updateProgress: updateProgress.emit(maxValue) |
214 | 215 |
|
215 |
### make trim lines
|
|
216 |
# make trim lines |
|
216 | 217 |
updateProgress.emit(-1) # reset progressbar |
217 | 218 |
displayMessage.emit('Unknown line Topology Construction') |
218 | 219 |
orphanLines = [line for line in self._lines if line.owner is None] |
... | ... | |
241 | 242 |
|
242 | 243 |
docData.tracerLineNos.append(trimLineNo) |
243 | 244 |
|
244 |
''' |
|
245 |
# check second run flow |
|
246 |
for lineNo in [lineNo for lineNo in self._lineNos + docData.tracerLineNos if len(lineNo.runs) > 1]: |
|
247 |
for run in lineNo.runs[1:]: |
|
248 |
if run.items[0] in |
|
249 |
''' |
|
250 |
|
|
251 | 245 |
if updateProgress: updateProgress.emit(maxValue) |
252 | 246 |
except Exception as ex: |
253 | 247 |
from App import App |
... | ... | |
270 | 264 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
271 | 265 |
from SymbolSvgItem import SymbolSvgItem |
272 | 266 |
|
273 |
if start.owner is not None: |
|
274 |
return [] |
|
267 |
#if start.owner is not None:
|
|
268 |
# return []
|
|
275 | 269 |
visited = [start] |
276 | 270 |
|
277 | 271 |
try: |
... | ... | |
696 | 690 |
position = int(configs[0].value) if 1 == len(configs) else 100 |
697 | 691 |
configs = docdata.getConfigs('Flow Mark', 'Length') |
698 | 692 |
length = int(configs[0].value) if 1 == len(configs) else 200 |
699 |
for lineNo in lineNos + docdata.tracerLineNos:
|
|
693 |
for lineNo in docdata.tracerLineNos: |
|
700 | 694 |
lineNo.update_flow_mark(position, length) |
701 | 695 |
|
702 | 696 |
# sort run flow order |
697 |
fixed_run = [] |
|
698 |
waiting_run = [] |
|
699 |
runs = [] |
|
700 |
for lineNo in [lineNo for lineNo in docdata.tracerLineNos if len(lineNo.runs) > 0]: |
|
701 |
not_trim = True if type(lineNo) is QEngineeringLineNoTextItem else False |
|
702 |
run_index = 0 |
|
703 |
for run in lineNo.runs: |
|
704 |
not_secondary = True if run_index is 0 else False |
|
705 |
# runs can know flow directly |
|
706 |
if len(run.items) > 1 and (type(run.items[0]) is QEngineeringOPCItem or type(run.items[-1]) is QEngineeringOPCItem): |
|
707 |
if type(run.items[0]) is QEngineeringOPCItem and run.items[0].connectors[0].connectedItem: |
|
708 |
if not_trim and not_secondary: |
|
709 |
lineNo.reverse() |
|
710 |
else: |
|
711 |
run.reverse() |
|
712 |
elif type(run.items[-1]) is QEngineeringOPCItem and run.items[-1].connectors[1].connectedItem: |
|
713 |
if not_trim and not_secondary: |
|
714 |
lineNo.reverse() |
|
715 |
else: |
|
716 |
run.reverse() |
|
717 |
fixed_run.append([run, lineNo, not_trim, not_secondary]) |
|
718 |
|
|
719 |
# only symbol runs doesn't need flow |
|
720 |
elif (len(run.items) is 1 and issubclass(type(run.items[0]), SymbolSvgItem)) or \ |
|
721 |
len([not_symbol for not_symbol in run.items if not issubclass(type(item), SymbolSvgItem)]) is 0: |
|
722 |
runs.append([run, lineNo, not_trim, not_secondary]) |
|
723 |
# runs can't know flow directly |
|
724 |
else: |
|
725 |
waiting_run.append([run, lineNo, not_trim, not_secondary]) |
|
726 |
run_index += 1 |
|
703 | 727 |
|
704 | 728 |
# trace special item |
705 | 729 |
worker.displayMessage.emit('Find line for special item...') |
내보내기 Unified diff