프로젝트

일반

사용자정보

개정판 fce468df

IDfce468df711674f4bb86f81263a2a5f3d5d042d1
상위 4253757a
하위 e649698e, 374d7347

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

cad spec on going

Change-Id: I953c02a082a5df68572ed359daaa79bc598d180d

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
795 795
        lines_short = []#[item for item in self.graphicsView.scene().items() if type(item) is QEngineeringLineItem if item.length() <= 50]
796 796
        unknowns = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringUnknownItem]
797 797
        end_breaks = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringEndBreakItem]
798
        symbols = [item for item in self.graphicsView.scene().items() if issubclass(type(item), SymbolSvgItem) and item not in end_breaks]
798
        spec_breaks = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringSpecBreakItem]
799
        symbols = [item for item in self.graphicsView.scene().items() if issubclass(type(item), SymbolSvgItem) and item not in end_breaks and item not in spec_breaks]
799 800

  
800 801
        for item in lines_short + unknowns:
801 802
            item.transfer.onRemoved.emit(item)
......
922 923
                    usedItemPairs.append([ownerItem, connectedItem])
923 924
            # up to here
924 925

  
926
            # connect spec break
927
            usedItemPairs = []
928
            for spec_break in spec_breaks:
929
                up = [attr.AssocItem for attr in spec_break if attr.Attribute == 'UpStream']
930
                down = [attr.AssocItem for attr in spec_break if attr.Attribute == 'DownStream']
931
                if spec_break.prop('Freeze') or up or down:
932
                    usedItemPairs.append([up, down])
933

  
934
            for spec_break in spec_breaks:
935
                up = [attr.AssocItem for attr in spec_break if attr.Attribute == 'UpStream']
936
                down = [attr.AssocItem for attr in spec_break if attr.Attribute == 'DownStream']
937
                if spec_break.prop('Freeze') or up or down:
938
                    continue
939

  
940
                originPoint = Point(spec_break.origin[0], spec_break.origin[1])
941
                minD = sys.maxsize
942
                upItem = None
943
                downItem = None
944

  
945
                for symbol in symbols:
946
                    for conn in symbol.connectors:
947
                        dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1]))
948
                        if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \
949
                            [pair for pair in usedItemPairs if symbol in pair and conn.connectedItem in pair] or dist > 2.5 * toler or dist > minD:
950
                            continue
951

  
952
                        minD = dist
953
                        upItem = symbol
954
                        downItem = conn.connectedItem
955

  
956
                for line in lines:
957
                    for conn in line.connectors:
958
                        dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1]))
959
                        if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \
960
                            conn._connected_at != QEngineeringAbstractItem.CONNECTED_AT_BODY  or \
961
                            [pair for pair in usedItemPairs if line in pair and conn.connectedItem in pair] or dist > 2.5 * toler or dist > minD:
962
                            continue
963

  
964
                        minD = dist
965
                        upItem = line
966
                        downItem = conn.connectedItem
967

  
968
                if upItem and downItem:
969
                    attrs = spec_break.getAttributes()
970
                    for key in attrs.keys():
971
                        if key.Attribute == 'UpStream':
972
                            attrs[key] = str(upItem)
973
                            spec_break.add_assoc_item(upItem, key.AttrAt, force=True)
974
                            key.AssocItem = upItem
975
                        elif key.Attribute == 'DownStream':
976
                            attrs[key] = str(downItem)
977
                            spec_break.add_assoc_item(downItem, key.AttrAt, force=True)
978
                            key.AssocItem = downItem
979

  
980
                    usedItemPairs.append([upItem, downItem])
981
            # up to here
982

  
925 983
        QMessageBox.information(self, self.tr('Information'), self.tr('Connecting between symbols and lines is complete'))
926 984

  
927 985
    def on_recognize_line(self):

내보내기 Unified diff

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