프로젝트

일반

사용자정보

개정판 a98f2100

IDa98f21002988cbfdc5e51245c6d1616efaec2dc3
상위 1940bca9
하위 7485d23d

gaqhf 이(가) 6년 이상 전에 추가함

dev issue #563: edit spec break logic

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
21 21
    '''
22 22
        @history    2018.04.26 Jeongwoo Variable name changed (texts → lineNos)
23 23
    '''
24
    def __init__(self, symbols, lines, lineNos):
24
    def __init__(self, symbols, lines, lineNos, specBreak):
25 25
        try:
26 26
            self._symbols = symbols
27 27
            for symbol in self._symbols: symbol.owner = None
28 28
            self._lines = lines
29 29
            for line in self._lines: line.owner = None
30 30
            self._lineNos = lineNos
31
            self._specBreak = specBreak
32
            self._specBreakUID = []
33
            
34
            for spec in self._specBreak:
35
                for attr in spec.attrs:
36
                    if type(attr) is tuple and attr[1] != '':
37
                        self._specBreakUID.append(attr[1])
38

  
31 39
        except Exception as ex:
32 40
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
33 41

  
......
191 199
            if type(obj) is QEngineeringLineItem:
192 200
                symbolMatches = [x for x in self._symbols if (x.owner is None) and (x not in visited) and len(obj.connectIfPossible(x, toler)) > 0]
193 201
                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)]
202

  
194 203
            elif issubclass(type(obj), SymbolSvgItem):
195 204
                lineMatches = [x for x in self._lines if (x.owner is None) and (x not in visited) and len(obj.connectIfPossible(x, toler)) > 0]
196 205
                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)]
......
200 209
            matches.extend(symbolMatches)
201 210
            matches.extend(lineMatches)
202 211

  
212
            # specBreak 확인
213
            isContainSpecBreak = False
214
            for uid in self._specBreakUID:
215
                if obj.uid == uid:
216
                    isContainSpecBreak = True
217
                for item in matches:
218
                    if item.uid == uid:
219
                        isContainSpecBreak = True
220
                        
221
                if isContainSpecBreak:
222
                    break;
223

  
224
            # specBreak 포함시
225
            if isContainSpecBreak:
226
                isConnSpecBreak = obj.isConnectSpecBreak(self._specBreak)
227
                if isConnSpecBreak[0]:
228
                    connector = isConnSpecBreak[1]
229
                    removeList = []
230
                    if connector.connectedItem is not None:
231
                        for item in matches:
232
                            if item == connector.connectedItem:
233
                                removeList.append(connector.connectedItem)
234
                
235
                    # connectedItem 제거
236
                    if connector.connectedItem is not None:
237
                        connector.connectedItem.disconnectedItemAtConnector(connector)
238
                    obj.disconnectedItemAtConnector(connector)
239
                
240
                    for item in removeList:
241
                        matches.remove(item)
242
            
243
            
244

  
203 245
            if sign == 0 and len(matches) > 1:
204 246
                mid = int(len(matches)*0.5)
205 247
                lhs = matches[0:mid]
......
236 278
        symbols = []
237 279
        lines = []
238 280
        lineNos = []
281
        specBreak = []
239 282
        for item in worker.graphicsView.scene.items():
240
            if issubclass(type(item), SymbolSvgItem):
283
            if issubclass(type(item), SymbolSvgItem) and item.type != 'Segment Breaks':
241 284
                symbols.append(item)
285
            if issubclass(type(item), SymbolSvgItem) and item.type == 'Segment Breaks':
286
                specBreak.append(item)
242 287
            elif type(item) is QEngineeringLineNoTextItem:
243 288
                lineNos.append(item)
244 289
            elif type(item) is QEngineeringLineItem:
245 290
                lines.append(item)
246 291

  
247 292
        # trace line no
248
        tracer = LineNoTracer(symbols, lines, lineNos)
293
        tracer = LineNoTracer(symbols, lines, lineNos, specBreak)
249 294
        tracer.execute(worker.displayMessage, worker.updateProgress)
250 295
        # up to here
251 296

  

내보내기 Unified diff