프로젝트

일반

사용자정보

개정판 18fb962a

ID18fb962aa6ae98ff4da2d7512f266d36ee914476
상위 1a9c928a
하위 87c34040, 0ec70368

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

issue #000: improve attr link

Change-Id: I6293a083526c1f1fca29be74b7ca621631b1b1e2

차이점 보기:

DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1085 1085

  
1086 1086
            minDist = None
1087 1087
            selected = None
1088

  
1089
            contain_texts = []
1088 1090
            for attr in attributes:
1089 1091
                # size text and operation code text will find owner themselves in findowner method
1090 1092
                if False:  # type(attr) is QEngineeringSizeTextItem or type(attr) is QEngineeringValveOperCodeTextItem:
......
1103 1105
                                attr.owner = self
1104 1106
                elif issubclass(type(attr), QEngineeringTextItem):
1105 1107
                    if rect.contains(attr.center()):
1106
                        if self.add_assoc_item(attr):
1107
                            attr.owner = self  # set owner of text
1108
                        dx = attr.center().x() - center.x()
1109
                        dy = attr.center().y() - center.y()
1110
                        length = math.sqrt(dx * dx + dy * dy)
1111
                        contain_texts.append([length, attr])
1108 1112
                elif type(attr) is QEngineeringLineItem:
1109 1113
                    length = attr.distanceTo([center.x(), center.y()])
1110 1114
                    if (length < dist) and (minDist is None or length < minDist):
1111 1115
                        minDist = length
1112 1116
                        selected = attr
1113 1117

  
1118
            if contain_texts:
1119
                num = len([_attr for _attr in self.getAttributes(findOwner=True) if _attr.AttributeType == 'Text Item'])
1120
                contain_texts = sorted(contain_texts, key=lambda param: param[0])
1121
                index = 0
1122
                for _, attr in contain_texts:
1123
                    if index >= num:
1124
                        break
1125
                    if self.add_assoc_item(attr):
1126
                        attr.owner = self  # set owner of text
1127
                    index += 1
1128

  
1114 1129
            if selected is not None:
1115 1130
                self.add_assoc_item(selected)
1116 1131

  

내보내기 Unified diff

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