프로젝트

일반

사용자정보

개정판 d36f8b79

IDd36f8b7968c224a74ef3c839b7704921da16661c
상위 8db9399f
하위 16e18322, 188b6fce

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

cad spec

Change-Id: Ieaef841739b98c5a4919ba688d312fa13a14240a

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
779 779
        """connect line to symbol"""
780 780
        from LineDetector import LineDetector
781 781
        from shapely.geometry import Point
782
        from CodeTables import CodeTable
782 783
        #from RecognitionDialog import Worker
783 784

  
784 785
        if not self.graphicsView.hasImage():
......
797 798
        end_breaks = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringEndBreakItem]
798 799
        spec_breaks = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringSpecBreakItem]
799 800
        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]
801
        texts = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringTextItem]
800 802

  
801 803
        for item in lines_short + unknowns:
802 804
            item.transfer.onRemoved.emit(item)
......
924 926
            # up to here
925 927

  
926 928
            # connect spec break
929
            usedTexts = []
930
            attribute_table_item_list = []
931
            dist_range = None
932
            specBreakAttrsFull = [attr for attr in app_doc_data.getSymbolAttribute('Segment Breaks') if \
933
                attr.Target == 'ALL' and (attr.AttributeType == 'Spec' or attr.AttributeType == 'String')]
934

  
935
            for attr in specBreakAttrsFull:
936
                if attr.AttributeType != 'Spec' or attr.Attribute == 'NominalDiameter':
937
                    continue
938

  
939
                table = CodeTable.instance(attr.Attribute)
940
                items = []
941
                for text in texts:
942
                    if text not in usedTexts and table.find_match_exactly(text.text()):
943
                        usedTexts.append(text)
944
                        items.append(text)
945

  
946
                if len(items) >= 2:
947
                    attribute_table_item_list.append([attr.Attribute, items])
948

  
927 949
            usedItemPairs = []
928 950
            for spec_break in spec_breaks:
951
                if not dist_range:
952
                    dist_range = max(spec_break.sceneBoundingRect().height(), spec_break.sceneBoundingRect().width())
953

  
929 954
                attrs = spec_break.getAttributes()
930 955
                up = [attr.AssocItem for attr in attrs if attr.Attribute == 'UpStream']
931 956
                down = [attr.AssocItem for attr in attrs if attr.Attribute == 'DownStream']
......
960 985
                        dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1]))
961 986
                        if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \
962 987
                            conn._connected_at != QEngineeringAbstractItem.CONNECTED_AT_BODY  or \
963
                            [pair for pair in usedItemPairs if line in pair and conn.connectedItem in pair] or dist > 5 * toler or dist > minD:
988
                            [pair for pair in usedItemPairs if line in pair and conn.connectedItem in pair] or dist > 5 * toler or dist > minD + 1:
964 989
                            continue
965 990

  
966 991
                        minD = dist
......
984 1009
                    spec_break.set_property('Show', True)
985 1010

  
986 1011
                    usedItemPairs.append([upItem, downItem])
1012

  
1013
                    for attribute_table_item in attribute_table_item_list:
1014
                        for text in attribute_table_item[1]:
1015
                            attribute_table_item[1].sort(key=lambda x: originPoint.distance(Point(x.center().x(), x.center().Y())))
1016
                            if originPoint.distance(Point(attribute_table_item[1][1].center().x(), attribute_table_item[1][1].center().Y())) < dist_range:
1017
                                if issubclass(type(upItem), SymbolSvgItem):
1018
                                    pass
1019
                                elif issubclass(type(downItem), SymbolSvgItem):
1020
                                    pass
1021
                                else:
1022
                                    pass
1023

  
987 1024
            # up to here
988 1025

  
989 1026
        QMessageBox.information(self, self.tr('Information'), self.tr('Connecting between symbols and lines is complete'))

내보내기 Unified diff

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