프로젝트

일반

사용자정보

개정판 85ee49aa

ID85ee49aa93e8ea5838dc93c12a148b0c5239c35f
상위 ec39ff34
하위 086883da, 3085e773

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

issue #538: fix symbol add assistant angle

Change-Id: I73f854f405bbd42f0e6b7d118445b6eab5ab13a3

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
2098 2098
                if old_symbol and svg:
2099 2099
                    from ReplaceCommand import ReplaceCommand
2100 2100

  
2101
                    app_doc_data = AppDocData.instance()
2102

  
2103
                    cmd = ReplaceCommand(app_doc_data.scene, old_symbol, svg)
2101
                    cmd = ReplaceCommand(self.graphicsView.scene(), old_symbol, svg)
2104 2102
                    self._scene.undo_stack.push(cmd)
2105 2103
                    return
2106 2104
            elif event.key() == Qt.Key_J:
DTI_PID/DTI_PID/QtImageViewer.py
651 651
                # else:
652 652
                #    dx, dy = ddx * dx, ddy * dy
653 653

  
654
                flip = connectors[0].parentItem().flip
655
                if issubclass(type(connectors[0].parentItem()), SymbolSvgItem):
656
                    angle = connectors[0].parentItem().angle
657
                else :
658
                    if connectors[0].parentItem().isVertical():
659
                        angle = 3.141592653589793
660
                    else:
661
                        angle = 0
662

  
663
                rAngle = math.atan2(yl, xl) if flip == 0 else math.atan2(yl, -xl)
654
                xxl = connectors[0].parentItem().origin[0] - connectors[0].center()[0]
655
                yyl = connectors[0].parentItem().origin[1] - connectors[0].center()[1]
656
                rAngle = -math.atan2(yyl, xxl)# if flip == 0 else math.atan2(yl, xl)
664 657
                rAngle = abs(rAngle) if rAngle < 0 + allowed_error else 2 * math.pi - rAngle
665
                svg.angle = angle + rAngle if angle + rAngle < 2 * math.pi else angle + rAngle - 2 * math.pi
666

  
667
                '''
668
                if connectors[0].parentItem().connectors.index(connectors[0]) == 0:
669
                    if flip == 0:
670
                        svg.angle = angle
671
                    else:
672
                        if angle == 0:
673
                            svg.angle = 3.14
674
                        elif angle == 3.14:
675
                            svg.angle = 0.0
676
                        elif angle == 1.57:
677
                            svg.angle = 4.71
678
                        elif angle == 4.71:
679
                            svg.angle = 1.57
680
                        else:
681
                            svg.angle = angle + math.pi if angle + math.pi < 2 * math.pi - allowed_error else angle - math.pi
682
                else:
683
                    if (angle == 0 and flip == 0) or (angle == 3.14 and flip == 1):
684
                        svg.angle = 3.14
685
                    elif (angle == 3.14 and flip == 0) or (angle == 0 and flip == 1):
686
                        svg.angle = 0.0
687
                    elif (angle == 1.57 and flip == 0) or (angle == 4.71 and flip == 1):
688
                        svg.angle = 4.71
689
                    elif (angle == 4.71 and flip == 0) or (angle == 1.57 and flip == 1):
690
                        svg.angle = 1.57
691
                    elif flip == 0:
692
                        svg.angle = angle + math.pi if angle + math.pi < 2 * math.pi - allowed_error else angle - math.pi
693
                    else:
694
                        svg.angle = angle
695
                '''
658
                svg.angle = rAngle
696 659

  
697 660
                x, y = connectors[0].sceneBoundingRect().center().x() + dx, \
698 661
                    connectors[0].sceneBoundingRect().center().y() + dy
......
735 698
                    connectors = [connector for connector in connectors if connector.parentItem() is not svg and not connector.connectedItem]
736 699

  
737 700
                    if len(connectors) == 1:
738
                        xl = connectors[0].parentItem().symbolOrigin[0] - connectors[0].connectPoint[0]
739
                        yl = connectors[0].parentItem().symbolOrigin[1] - connectors[0].connectPoint[1]
740

  
741
                        flip = connectors[0].parentItem().flip
742
                        if issubclass(type(connectors[0].parentItem()), SymbolSvgItem):
743
                            angle = connectors[0].parentItem().angle
744
                        else :
745
                            if connectors[0].parentItem().isVertical():
746
                                angle = 3.141592653589793
747
                            else:
748
                                angle = 0
749

  
750
                        rAngle = math.atan2(yl, xl) if flip != 0 else math.atan2(yl, -xl)
701
                        xxl = connectors[0].parentItem().origin[0] - connectors[0].center()[0]
702
                        yyl = connectors[0].parentItem().origin[1] - connectors[0].center()[1]
703
                        rAngle = -math.atan2(yyl, xxl)
751 704
                        rAngle = abs(rAngle) if rAngle < 0 + allowed_error else 2 * math.pi - rAngle
752
                        svg.angle = angle + rAngle if angle + rAngle < 2 * math.pi else angle + rAngle - 2 * math.pi
705
                        rAngle = rAngle + math.pi if rAngle + math.pi < 2 * math.pi else rAngle - math.pi
706
                        svg.angle = rAngle
707

  
753 708

  
754 709
                        svg.connectors[0].connect(connectors[0].parentItem())
755 710
                        #svg.connectors[0].highlight(False)
DTI_PID/DTI_PID/RecognitionDialog.py
873 873
                if worker.isSymbolChecked:
874 874
                    worker.displayTitle.emit(worker.tr('Detecting symbols...'))
875 875

  
876
                    configs = app_doc_data.getConfigs('Engine', 'Text Area')
876
                    configs = app_doc_data.getConfigs('Engine', 'Symbol')
877 877
                    if (configs and int(configs[0].value) is 1) or not configs:
878 878
                    # get symbol original way
879 879
            

내보내기 Unified diff