개정판 0c1a4747
issue #000: LineNoTracer now run can be made without line
Change-Id: I8db5464da46eb28ea3a986e884d4672a9c62d02b
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
95 | 95 |
@brief find secondary lines |
96 | 96 |
@author humkyung |
97 | 97 |
''' |
98 |
def find_secondary_lines(self, lines): |
|
98 |
def find_secondary_lines(self, lines_and_symbols):
|
|
99 | 99 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
100 | 100 |
from EngineeringLineItem import QEngineeringLineItem |
101 | 101 |
from EngineeringRunItem import QEngineeringRunItem |
... | ... | |
105 | 105 |
while foundCount: |
106 | 106 |
foundCount = 0 |
107 | 107 |
notMatches = [] |
108 |
for line in lines: |
|
108 |
for line in lines_and_symbols:
|
|
109 | 109 |
if line.owner is not None: continue |
110 | 110 |
|
111 | 111 |
line_matches = [x for x in self._lines if x.owner and line.is_connected(x, QEngineeringAbstractItem.CONNECTED_AT_BODY)] |
... | ... | |
126 | 126 |
owner.runs.append(line_run) |
127 | 127 |
else: |
128 | 128 |
notMatches.append(line) |
129 |
lines = notMatches
|
|
129 |
#lines_and_symbols = notMatches
|
|
130 | 130 |
except Exception as ex: |
131 | 131 |
from App import App |
132 | 132 |
|
... | ... | |
192 | 192 |
if updateProgress: updateProgress.emit(maxValue) |
193 | 193 |
|
194 | 194 |
# find secondary lines |
195 |
lines = self._lines
|
|
196 |
self.find_secondary_lines(lines) |
|
195 |
lines_and_symbols = self._lines + self._symbols
|
|
196 |
self.find_secondary_lines(lines_and_symbols)
|
|
197 | 197 |
|
198 | 198 |
# double check conn line cuz startLine may need first |
199 | 199 |
for lineno in self._lineNos: |
... | ... | |
213 | 213 |
### make trim lines |
214 | 214 |
updateProgress.emit(-1) # reset progressbar |
215 | 215 |
displayMessage.emit('Unknown line Topology Construction') |
216 |
orphanLines = [line for line in self._lines if line.owner is None] |
|
217 |
if orphanLines: |
|
216 |
orphanLines = [line for line in self._lines if line.owner is None] |
|
217 |
orphanSymbols = [symbol for symbol in self._symbols if symbol.owner is None] |
|
218 |
if orphanLines + orphanSymbols: |
|
218 | 219 |
maxValue = len(orphanLines) |
219 | 220 |
orphanLines = sorted(orphanLines, key=lambda param:param.length(), reverse=True) |
220 |
while len(orphanLines) > 0: |
|
221 |
orphans = orphanLines + orphanSymbols |
|
222 |
while len(orphans) > 0: |
|
221 | 223 |
trimLineNo = QEngineeringTrimLineNoTextItem() |
222 |
trimLineNo.conns.append(orphanLines[0])
|
|
223 |
orphanLines[0].owner = trimLineNo
|
|
224 |
trimLineNo.conns.append(orphans[0]) |
|
225 |
orphans[0].owner = trimLineNo |
|
224 | 226 |
#orphanLines[0].linkedItem = trimLineNo |
225 | 227 |
|
226 | 228 |
connectedItems = self.find_primary_lines(trimLineNo) |
... | ... | |
229 | 231 |
orphanLines.remove(item) |
230 | 232 |
updateProgress.emit(maxValue) |
231 | 233 |
|
232 |
self.find_secondary_lines(orphanLines)
|
|
233 |
for item in orphanLines[:]:
|
|
234 |
self.find_secondary_lines(orphans) |
|
235 |
for item in orphans[:]: |
|
234 | 236 |
if item.owner is not None: |
235 |
orphanLines.remove(item)
|
|
237 |
orphans.remove(item) |
|
236 | 238 |
updateProgress.emit(maxValue) |
237 | 239 |
|
238 | 240 |
docData.tracerLineNos.append(trimLineNo) |
내보내기 Unified diff