개정판 d361c8fc
build issue #482: owner 초기화 수정
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
20 | 20 |
def __init__(self, symbols, lines, lineNos, specBreak): |
21 | 21 |
try: |
22 | 22 |
self._symbols = symbols |
23 |
for symbol in self._symbols: symbol.owner = None |
|
23 |
#for symbol in self._symbols: symbol.owner = None
|
|
24 | 24 |
self._lines = lines |
25 |
for line in self._lines: line.owner = None |
|
25 |
#for line in self._lines: line.owner = None
|
|
26 | 26 |
self._lineNos = lineNos |
27 | 27 |
self._specBreak = specBreak |
28 | 28 |
self._specBreakUID = [] |
... | ... | |
46 | 46 |
connectedItems = [] |
47 | 47 |
if 1 == len(lineno.conns): |
48 | 48 |
connectedItems = self.findConnectedObjects(lineno.conns[0], toler=10) |
49 |
for item in connectedItems: item.owner = lineno # set item's owner |
|
49 |
for item in connectedItems: |
|
50 |
item.owner = lineno # set item's owner |
|
51 |
item.linkedItem = lineno |
|
50 | 52 |
|
51 | 53 |
pipeRun = QEngineeringRunItem() |
52 | 54 |
pipeRun.items = connectedItems |
... | ... | |
68 | 70 |
foundCount = 0 |
69 | 71 |
notMatches = [] |
70 | 72 |
for line in lines: |
71 |
if line.owner is not None: continue
|
|
73 |
if line.linkedItem is not None: continue
|
|
72 | 74 |
|
73 |
matches = [x for x in self._lines if x.owner is not None and x.isConnectable(line)]
|
|
75 |
matches = [x for x in self._lines if x.linkedItem is not None and x.isConnectable(line)]
|
|
74 | 76 |
if matches: |
75 | 77 |
foundCount += 1 |
76 | 78 |
connectedItems = self.findConnectedObjects(line, toler=10) |
... | ... | |
78 | 80 |
for idx in range(len(line.connectors)): |
79 | 81 |
if line.connectors[idx].connectedItem is None: line.connectors[idx].connectedItem = matches[0] |
80 | 82 |
# up to here |
81 |
for item in connectedItems: item.owner = matches[0].owner # set item's owner |
|
83 |
for item in connectedItems: |
|
84 |
item.owner = matches[0].owner # set item's owner |
|
85 |
item.linkedItem = matches[0].owner |
|
82 | 86 |
|
83 | 87 |
pipeRun = QEngineeringRunItem() |
84 | 88 |
pipeRun.items = connectedItems |
... | ... | |
142 | 146 |
|
143 | 147 |
# set start line's owner |
144 | 148 |
for lineno in docData.lineNos: |
145 |
if lineno.conns: lineno.conns[0].owner = lineno |
|
149 |
if lineno.conns: |
|
150 |
lineno.conns[0].owner = lineno |
|
151 |
lineno.conns[0].linkedItem = lineno |
|
146 | 152 |
|
147 | 153 |
maxValue = len(self._lineNos) + 1 ## line no's count + secondary line |
148 | 154 |
|
... | ... | |
160 | 166 |
### make trim lines |
161 | 167 |
updateProgress.emit(-1) # reset progressbar |
162 | 168 |
displayMessage.emit('TrimLine 토폴로지 구성') |
163 |
orphanLines = [line for line in self._lines if line.owner is None]
|
|
169 |
orphanLines = [line for line in self._lines if line.linkedItem is None]
|
|
164 | 170 |
if orphanLines: |
165 | 171 |
maxValue = len(orphanLines) |
166 | 172 |
orphanLines = sorted(orphanLines, key=lambda param:param.length(), reverse=True) |
... | ... | |
168 | 174 |
trimLineNo = QEngineeringTrimLineNoTextItem() |
169 | 175 |
trimLineNo.conns.append(orphanLines[0]) |
170 | 176 |
orphanLines[0].owner = trimLineNo |
177 |
orphanLines[0].linkedItem = trimLineNo |
|
178 |
|
|
171 | 179 |
connectedItems = self.findPrimaryLines(trimLineNo) |
172 | 180 |
for item in connectedItems: |
173 | 181 |
if item in orphanLines: |
... | ... | |
176 | 184 |
|
177 | 185 |
self.findSecondaryLines(orphanLines) |
178 | 186 |
for item in orphanLines[:]: |
179 |
if item.owner is not None:
|
|
187 |
if item.linkedItem is not None:
|
|
180 | 188 |
orphanLines.remove(item) |
181 | 189 |
updateProgress.emit(maxValue) |
182 | 190 |
|
... | ... | |
208 | 216 |
while len(pool) > 0: |
209 | 217 |
sign, obj = pool.pop() |
210 | 218 |
if type(obj) is QEngineeringLineItem: |
211 |
symbolMatches = [x for x in self._symbols if (x.owner is None) and (x not in visited) and len(obj.connectIfPossible(x, toler)) > 0]
|
|
212 |
lineMatches = [x for x in self._lines if (x.owner is None) and (x is not obj) and (x not in visited) and (len(obj.connectIfPossible(x, toler)) > 0)]
|
|
219 |
symbolMatches = [x for x in self._symbols if (x.linkedItem is None) and (x not in visited) and len(obj.connectIfPossible(x, toler)) > 0]
|
|
220 |
lineMatches = [x for x in self._lines if (x.linkedItem is None) and (x is not obj) and (x not in visited) and (len(obj.connectIfPossible(x, toler)) > 0)]
|
|
213 | 221 |
|
214 | 222 |
elif issubclass(type(obj), SymbolSvgItem): |
215 |
lineMatches = [x for x in self._lines if (x.owner is None) and (x not in visited) and len(obj.connectIfPossible(x, toler)) > 0]
|
|
216 |
symbolMatches = [x for x in self._symbols if (x.owner is None) and (x is not obj) and (x not in visited) and (len(obj.connectIfPossible(x, toler)) > 0)]
|
|
223 |
lineMatches = [x for x in self._lines if (x.linkedItem is None) and (x not in visited) and len(obj.connectIfPossible(x, toler)) > 0]
|
|
224 |
symbolMatches = [x for x in self._symbols if (x.linkedItem is None) and (x is not obj) and (x not in visited) and (len(obj.connectIfPossible(x, toler)) > 0)]
|
|
217 | 225 |
|
218 | 226 |
# order connected objects |
219 | 227 |
matches = [] |
... | ... | |
299 | 307 |
if type(item) is QEngineeringSpecBreakItem: |
300 | 308 |
specBreak.append(item) |
301 | 309 |
elif issubclass(type(item), SymbolSvgItem): |
302 |
item.owner = None |
|
310 |
#item.owner = None |
|
311 |
item.linkedItem = None |
|
303 | 312 |
symbols.append(item) |
304 | 313 |
elif type(item) is QEngineeringLineNoTextItem: |
305 |
item.owner = None |
|
314 |
#item.owner = None |
|
315 |
item.linkedItem = None |
|
306 | 316 |
item.runs.clear() |
307 | 317 |
lineNos.append(item) |
308 | 318 |
elif type(item) is QEngineeringLineItem: |
309 |
item.owner = None |
|
319 |
#item.owner = None |
|
320 |
item.linkedItem = None |
|
310 | 321 |
lines.append(item) |
311 | 322 |
|
312 | 323 |
# trace line no |
내보내기 Unified diff