프로젝트

일반

사용자정보

개정판 07441dd5

ID07441dd57e93e2f271913722fe5ec99832f2fb74
상위 43acb030
하위 b7354ec1

백흠경이(가) 약 5년 전에 추가함

issue #640: check 'Attr At' value when create a attribute for symbol

Change-Id: I28b8fbe65751d1487f9a3dd872742e9e96b40e11

차이점 보기:

DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py
78 78
                    connector = QEngineeringConnectorItem(parent=self, index=index + 1)
79 79
                    connector.setPos(vertex)
80 80
                    connector.setParentItem(self)
81
                    # connector의 connectPoint, sceneConnectPoint를 vertex로 함 추후 좀 알아봐서 수정 필요
82 81
                    connector.connectPoint = vertex
83
                    connector.sceneConnectPoint = vertex
82
                    connector.recognized_pt = vertex    # 좌표 위치 저장
84 83

  
85 84
                    # add connector move able
86 85
                    connector.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsFocusable)
......
549 548
                        break
550 549
        else:
551 550
            if len(item.connectors) == 2:
552
                connector1Point = item.connectors[0].sceneConnectPoint
553
                connector2Point = item.connectors[1].sceneConnectPoint
551
                connector1Point = item.connectors[0].center()
552
                connector2Point = item.connectors[1].center()
554 553

  
555 554
                # startPoint와 같은 connPts 찾음
556 555
                if startPoint[0] == connector1Point[0] and startPoint[1] == connector1Point[1]:
......
678 677
        try:
679 678
            if issubclass(type(obj), SymbolSvgItem):
680 679
                for i in range(len(obj.connectors)):
681
                    pt = obj.connectors[i].sceneConnectPoint
682
                    if (Point(startPt[0], startPt[1]).distance(Point(pt[0], pt[1])) < toler):
680
                    pt = obj.connectors[i].center()
681
                    if Point(startPt[0], startPt[1]).distance(Point(pt[0], pt[1])) < toler:
683 682
                        if self.connectors[0].connectedItem is None and obj.connectors[i].connectedItem is None:
684 683
                            self.connectors[0].connect(obj)
685 684
                            obj.connectors[i].connect(self)
686 685
                            # line, start, end
687 686
                            res.append(obj)
688
                            res.append(obj.connectors[i].sceneConnectPoint)
687
                            res.append(obj.connectors[i].center())
689 688
                            res.append(endPt)
690
                    elif (Point(endPt[0], endPt[1]).distance(Point(pt[0], pt[1])) < toler):
689
                    elif Point(endPt[0], endPt[1]).distance(Point(pt[0], pt[1])) < toler:
691 690
                        if self.connectors[1].connectedItem is None and obj.connectors[i].connectedItem is None:
692 691
                            self.connectors[1].connect(obj)
693 692
                            obj.connectors[i].connect(self)
694 693
                            # line, start, end
695 694
                            res.append(obj)
696 695
                            res.append(startPt)
697
                            res.append(obj.connectors[i].sceneConnectPoint)
696
                            res.append(obj.connectors[i].center())
698 697
            elif type(obj) is QEngineeringLineItem:
699 698
                _startPt = obj.startPoint()
700 699
                _endPt = obj.endPoint()
......
929 928
                rotatedPt = affinity.rotate(Point(symbol.connectors[i].connectPoint[0] - symbol.symbolOrigin[0],
930 929
                                                  symbol.connectors[i].connectPoint[1] - symbol.symbolOrigin[1]),
931 930
                                            -angle, Point(0, 0), use_radians=True)
932
                symbol.connectors[i].sceneConnectPoint = (origin.x + rotatedPt.x, origin.y + rotatedPt.y)
931
                #symbol.connectors[i].sceneConnectPoint = (origin.x + rotatedPt.x, origin.y + rotatedPt.y)
933 932

  
934
            dx1 = symbol.connectors[0].sceneConnectPoint[0] - self.startPoint()[0]
935
            dy1 = symbol.connectors[0].sceneConnectPoint[1] - self.startPoint()[1]
933
            dx1 = symbol.connectors[0].center()[0] - self.startPoint()[0]
934
            dy1 = symbol.connectors[0].center()[1] - self.startPoint()[1]
936 935
            length1 = math.sqrt(dx1 * dx1 + dy1 * dy1)
937
            dx2 = symbol.connectors[1].sceneConnectPoint[0] - self.startPoint()[0]
938
            dy2 = symbol.connectors[1].sceneConnectPoint[1] - self.startPoint()[1]
936
            dx2 = symbol.connectors[1].center()[0] - self.startPoint()[0]
937
            dy2 = symbol.connectors[1].center()[1] - self.startPoint()[1]
939 938
            length2 = math.sqrt(dx2 * dx2 + dy2 * dy2)
940 939

  
941 940
            if length1 < length2:
942
                processLine = QEngineeringLineItem([symbol.connectors[1].sceneConnectPoint, self.endPoint()])
941
                processLine = QEngineeringLineItem([symbol.connectors[1].center(), self.endPoint()])
943 942
                processLine.connectors[0].connectedItem = symbol
944 943
                processLine.connectors[1].connectedItem = self.connectors[1].connectedItem
945 944
                self.scene().addItem(processLine)
946 945

  
947
                line = QLineF(self.line().p1(), QPointF(symbol.connectors[0].sceneConnectPoint[0],
948
                                                        symbol.connectors[0].sceneConnectPoint[1]))
946
                line = QLineF(self.line().p1(), QPointF(symbol.connectors[0].center()[0],
947
                                                        symbol.connectors[0].center()[1]))
949 948
                self.setLine(line)
950 949
                self.connectors[1].connectedItem = symbol
951 950

  
952 951
                symbol.connectors[0].connectedItem = self
953 952
                symbol.connectors[1].connectedItem = processLine
954 953
            else:
955
                processLine = QEngineeringLineItem([symbol.connectors[0].sceneConnectPoint, self.endPoint()])
954
                processLine = QEngineeringLineItem([symbol.connectors[0].center(), self.endPoint()])
956 955
                processLine.connectors[0].connectedItem = symbol
957 956
                processLine.connectors[1].connectedItem = self.connectors[1].connectedItem
958 957
                self.scene().addItem(processLine)
959 958

  
960
                line = QLineF(self.line().p1(), QPointF(symbol.connectors[1].sceneConnectPoint[0],
961
                                                        symbol.connectors[1].sceneConnectPoint[1]))
959
                line = QLineF(self.line().p1(), QPointF(symbol.connectors[1].center()[0],
960
                                                        symbol.connectors[1].center()[1]))
962 961
                self.setLine(line)
963 962
                self.connectors[1].connectedItem = symbol
964 963

  
......
1355 1354
                    item.connectors[iterIndex].parse_record(connector)
1356 1355
                    iterIndex += 1
1357 1356

  
1358
            # get associations 
1357
            # get associations
1359 1358
            associations = app_doc_data.get_component_associations(uid)
1360 1359
            if associations:
1361 1360
                for assoc in associations:
......
1424 1423
                    item.connectors[iterIndex].parse_xml(connector)
1425 1424
                    iterIndex += 1
1426 1425

  
1427
            # get associations 
1426
            # get associations
1428 1427
            attributeValue = node.find('ASSOCIATIONS')
1429 1428
            if attributeValue is not None:
1430 1429
                for assoc in attributeValue.iter('ASSOCIATION'):
......
1565 1564
        index = 1
1566 1565
        for connector in self.connectors:
1567 1566
            params.append((  # str(connector.uid),
1568
                str(self.uid), index, connector.sceneConnectPoint[0], connector.sceneConnectPoint[1], \
1567
                str(self.uid), index, connector.center()[0], connector.center()[1], \
1569 1568
                str(connector.connectedItem.uid) if connector.connectedItem else None, \
1570 1569
                str(connector._connected_at)))
1571 1570
            index += 1

내보내기 Unified diff

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