프로젝트

일반

사용자정보

개정판 c4649406

IDc464940616297158c8ba6d99769f06277e4217ac
상위 712fe927
하위 68ffb222

함의성이(가) 약 6년 전에 추가함

issue #000: LineNoTracer update code and add comment

Change-Id: I3a3a9084c565e10faddf81efadf701d8c31c4fce

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
360 360
                """ end loop if obj is to """
361 361
                if to is not None and str(obj.uid) == str(to.uid): break
362 362

  
363
                # nextmatches list always has one item
363 364
                if type(obj) is QEngineeringLineItem:
364 365
                    symbolMatches = [x for x in self._symbols if (x.owner is None or x.owner == start.owner) and (x not in visited) and obj.is_connected(x)]
365 366
                    lineMatches = [x for x in self._lines if (x.owner is None or x.owner == start.owner) and (x is not obj) and (x not in visited) and obj.is_connected(x)]
367
                    nextMatches = symbolMatches + lineMatches
366 368

  
367 369
                elif issubclass(type(obj), SymbolSvgItem):
370
                    # symbol can be connected with line and another symbol at the same time
368 371
                    lineMatches = [x for x in self._lines if (x.owner is None or x.owner == start.owner) and (x not in visited) and obj.is_connected(x)]
369 372
                    symbolMatches = [x for x in self._symbols if (x.owner is None or x.owner == start.owner) and (x is not obj) and (x not in visited) and obj.is_connected(x, None)]
373
                    nextMatches = symbolMatches + lineMatches
370 374

  
371
                    if len(lineMatches + symbolMatches) > 1: # choose one if connected lines are more than 2
375
                    if len(nextMatches) > 1: # choose one if connected items are more than 2
372 376
                        matches = [x for x in visited if obj.is_connected(x)]
373 377
                        if matches:
374
                            #print(matches[0])
375
                            next_connected = [x for x in lineMatches + symbolMatches if obj.next_connected(x, matches[0])]
376
                            #print(next_connected)
378
                            next_connected = [x for x in nextMatches if obj.next_connected(x, matches[0])]
379

  
377 380
                            if next_connected:
378
                                lineMatches = next_connected
381
                                nextMatches = next_connected
379 382
                            else:
380
                                lineMatches = [lineMatches[0]]
381

  
382
                    #print(visited)
383
                    #for s in self._symbols:
384
                    #    print(s)
385
                    #    print(s.owner)
383
                                nextMatches = [lineMatches[0]]
386 384
                
387 385
                # order connected objects
388 386
                matches = []
389
                matches.extend(symbolMatches)
390
                matches.extend(lineMatches)
387
                matches.extend(nextMatches)
391 388

  
392 389
                if sign == 0 and len(matches) > 1:
393 390
                    mid = int(len(matches)*0.5)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)