프로젝트

일반

사용자정보

개정판 6d7f2097

ID6d7f2097d02ddaee4e83c16ca93f97150f0cdd30
상위 3b93962e
하위 cc4ddc30

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

issue #563: inst add line type, add attribute, expression, priority on going

Change-Id: I07c4a36eb650ca10ce866c538bff01ee411510dc

차이점 보기:

DTI_PID/DTI_PID/CodeTableDialog.py
275 275
                table.cellChanged.connect(self.cellValueChanged)
276 276
                self.checkRowAndAddRow(tableName, table)
277 277
            else:
278
                table.setColumnCount(4)
279 278
                if not self.inst:
279
                    table.setColumnCount(4)
280 280
                    table.setHorizontalHeaderLabels(['UID', 'Code', 'Desc.', 'Allowables'])
281 281
                else:
282
                    table.setHorizontalHeaderLabels(['UID', 'Code', 'Symbols', 'New Code'])
282
                    table.setColumnCount(7)
283
                    table.setHorizontalHeaderLabels(['UID', 'Code', 'Symbols', 'Attribute', 'New Code', 'Expression', 'Priority'])
283 284
                table.hideColumn(0)
284 285

  
285 286
                self.fill_codes(table, tableDatas)
DTI_PID/DTI_PID/RecognitionDialog.py
1492 1492
                contours, _ = cv2.findContours(image_line, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
1493 1493

  
1494 1494
                # skip piping line
1495
                if len(contours) < 3 or (sum([cv2.contourArea(contour) for contour in contours]) / len(contours)) > max_avg_area * 1.3:
1495
                if len(contours) < 3 or (sum([cv2.contourArea(contour) for contour in contours]) / len(contours)) > max_avg_area * 2:
1496 1496
                    max_x, max_y, min_x, min_y = 0, 0, sys.maxsize, sys.maxsize
1497 1497
                    for rect in [cv2.boundingRect(contour) for contour in contours]:
1498 1498
                        if rect[0] < min_x:
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1992 1992
        """ return new attribute code """
1993 1993
        from AppDocData import AppDocData
1994 1994
        from CodeTables import CodeTable
1995
        from LineTypeConditions import LineTypeConditions
1996
        from EngineeringLineItem import QEngineeringLineItem
1995 1997
        import re
1996 1998

  
1997 1999
        try:
......
2014 2016
                items = [item for item in items[0] if issubclass(type(item), SymbolSvgItem)]
2015 2017

  
2016 2018
            table = CodeTable.instance(code_name, inst=True)
2019
            line_types = [condition.name for condition in LineTypeConditions.items()]
2017 2020

  
2018 2021
            new_codes = []
2019 2022
            for value in table.values:
2023
                # symbol, line type
2020 2024
                if not [attr for attr in value[2] if 'attr(' in attr]:
2021
                    for item in items:
2022
                        match = re.search(value[1][0], old_code, re.DOTALL)
2023
                        if (old_code in value[1] or (match and match.start() is 0 and match.end() is len(old_code))) \
2024
                            and item.name in value[2]:
2025
                            dx = item.origin[0] - self.origin[0]
2026
                            dy = item.origin[1] - self.origin[1]
2027
                            length = math.sqrt(dx*dx + dy*dy)
2028
                            new_codes.append([length, value[3]])
2025
                    # symbol
2026
                    if not [line_type for line_type in line_types if line_type in value[2]]:
2027
                        for item in items:
2028
                            match = re.search(value[1][0], old_code, re.DOTALL)
2029
                            if (old_code in value[1] or (match and match.start() is 0 and match.end() is len(old_code))) \
2030
                                and item.name in value[2]:
2031
                                dx = item.origin[0] - self.origin[0]
2032
                                dy = item.origin[1] - self.origin[1]
2033
                                length = math.sqrt(dx*dx + dy*dy)
2034
                                new_codes.append([length, value[3]])
2035
                    # line
2036
                    else:
2037
                        types = [conn.connectedItem.lineType for conn in self.connectors if conn.connectedItem and type(conn.connectedItem) is QEngineeringLineItem]
2038
                        if [line_type for line_type in value[2] if line_type in types]:
2039
                            new_codes.append([0, value[3]])
2040

  
2041
                # self attribute
2029 2042
                elif len(value[2]) == 1:
2030 2043
                    attr_value = [attr for attr in value[2] if 'attr(' in attr][0].replace('attr(', '')[:-1]
2031 2044
                    for key, _value in self.attrs.items():
2032 2045
                        if _value == attr_value:
2033 2046
                            new_codes.append([0, value[3]])
2047

  
2048
                # symbol + attribute
2034 2049
                elif len(value[2]) == 2:
2035 2050
                    for item in items:
2036 2051
                        match = re.search(value[1][0], old_code, re.DOTALL)
......
2045 2060
                                if _value == attr_value:
2046 2061
                                    new_codes.append([length, value[3]])
2047 2062
                        
2063
            # default
2048 2064
            for value in table.values:
2049 2065
                if old_code in value[1] and len(value[2]) == 1 and value[2][0] == '':
2050 2066
                    new_codes.append([sys.maxsize, value[3]])
DTI_PID/DTI_PID/TextItemFactory.py
123 123
                docData.tracerLineNos.append(item)
124 124
            elif tagResult[0]:
125 125
                item = QEngineeringTagNoTextItem()
126
                text = ''.join(tagResult[1])
126 127
                item.setToolTip('TAG NO = {}'.format(text))
127 128
                item.setPlainText(text)
128 129
            else:

내보내기 Unified diff

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