프로젝트

일반

사용자정보

개정판 1caee0eb

ID1caee0eb8966a75f329d9b5e25e23fa5f16b1774
상위 cf24199a
하위 b8562da7

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

issue #000: size * fix

Change-Id: If06c7a1876991df3b57f4c0d6112af735507a849

차이점 보기:

DTI_PID/DTI_PID/Drawing.py
191 191
                    self._image = cv2.morphologyEx(self._image, cv2.MORPH_CLOSE, kernel)
192 192
                    self._image = cv2.morphologyEx(self._image, cv2.MORPH_OPEN, kernel)
193 193

  
194
                """
195
                # fill white noise
196
                for k in range(1):
197
                    for i in range(1, self._image.shape[0]-1):
198
                        for j in range(1, self._image.shape[1]-1):
199
                            if self._image[i][j] == 255 and self._image[i][j+1] == 0 and self._image[i][j-1] == 0 and \
200
                                self._image[i+1][j] == 0 and self._image[i-1][j] == 0:
201
                                self._image[i][j] = 0
202
                """
203

  
194 204
                self._image_origin = self._image.copy()
195 205
                self.height, self.width = self._image.shape
196 206
        except Exception as ex:
DTI_PID/DTI_PID/NominalPipeSize.py
2 2
""" This is NominalPipeSize module """
3 3

  
4 4
from SingletonInstance import SingletonInstance
5
import sys
5 6

  
6 7

  
7 8
class NominalPipeSizeTable(SingletonInstance):
......
67 68
    def find(self, value, size_unit='Inch'):
68 69
        import re
69 70

  
70
        if size_unit.upper() == 'INCH' or size_unit.upper() == 'IMPERIAL':
71
            
72
            # code
73
            if value == self.inchStr:
74
                return self.inchStr
75

  
76
            # allowable
77
            matches = [x for x in self.allowable_inch_str.split(',') if x and value == x]
78
            if matches:
79
                return self.inchStr
80
            
81
            # code
82
            match = re.search(self.inchStr, value, re.DOTALL)
83
            if match and match.start() is 0 and match.end() is len(value):
84
                return value
85

  
86
            # allowable    
87
            if self.allowable_inch_str.split(',')[0]:
88
                match = re.search(self.allowable_inch_str.split(',')[0], value, re.DOTALL)
89
                if match and match.start() is 0 and match.end() is len(value):
71
        try:
72
            if size_unit.upper() == 'INCH' or size_unit.upper() == 'IMPERIAL':
73
                
74
                # code
75
                if value == self.inchStr:
90 76
                    return self.inchStr
91 77

  
92
        elif size_unit.upper() == 'METRIC':
93
            # code
94
            if value == self.metricStr:
95
                return self.metricStr
78
                # allowable
79
                matches = [x for x in self.allowable_inch_str.split(',') if x and value == x]
80
                if matches:
81
                    return self.inchStr
82
                
83
                # code
84
                if self.inchStr == '*':
85
                    match = re.search('\*', value, re.DOTALL)
86
                else:
87
                    match = re.search(self.inchStr, value, re.DOTALL)
88
                if match and match.start() is 0 and match.end() is len(value):
89
                    return value
96 90

  
97
            # allowable
98
            matches = [x for x in self.allowable_metric_str.split(',') if x and value == x]
99
            if matches:
100
                return self.metricStr
91
                # allowable    
92
                if self.allowable_inch_str.split(',')[0]:
93
                    match = re.search(self.allowable_inch_str.split(',')[0], value, re.DOTALL)
94
                    if match and match.start() is 0 and match.end() is len(value):
95
                        return self.inchStr
101 96

  
102
            # code
103
            match = re.search(self.metricStr, value, re.DOTALL)
104
            if match and match.start() is 0 and match.end() is len(value):
105
                return value
97
            elif size_unit.upper() == 'METRIC':
98
                # code
99
                if value == self.metricStr:
100
                    return self.metricStr
106 101

  
107
            # allowable
108
            if self.allowable_metric_str.split(',')[0]:
109
                match = re.search(self.allowable_metric_str.split(',')[0], value, re.DOTALL)
102
                # allowable
103
                matches = [x for x in self.allowable_metric_str.split(',') if x and value == x]
104
                if matches:
105
                    return self.metricStr
106

  
107
                # code
108
                if self.metricStr == '*':
109
                    match = re.search('\*', value, re.DOTALL)
110
                else:
111
                    match = re.search(self.metricStr, value, re.DOTALL)
110 112
                if match and match.start() is 0 and match.end() is len(value):
113
                    return value
114

  
115
                # allowable
116
                if self.allowable_metric_str.split(',')[0]:
117
                    match = re.search(self.allowable_metric_str.split(',')[0], value, re.DOTALL)
118
                    if match and match.start() is 0 and match.end() is len(value):
119
                        return self.metricStr
120

  
121
            else:
122
                if (self.inchStr == value) or (value in self.allowable_inch_str.split(',')):
123
                    return self.inchStr
124
                if (self.metricStr == value) or (value in self.allowable_metric_str.split(',')):
111 125
                    return self.metricStr
126
            return False
112 127

  
113
        else:
114
            if (self.inchStr == value) or (value in self.allowable_inch_str.split(',')):
115
                return self.inchStr
116
            if (self.metricStr == value) or (value in self.allowable_metric_str.split(',')):
117
                return self.metricStr
118
        return False
128
        except Exception as ex:
129
            from App import App
130
            from AppDocData import MessageType
131
            
132
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
133
                                                          sys.exc_info()[-1].tb_lineno)
134
            App.mainWnd().addMessage.emit(MessageType.Error, message)
135
            return False
119 136

  
120 137
    def find_starts_with(self, value, size_unit='Inch'):
121 138
        """ find text start with """
......
192 209

  
193 210
            return None, None
194 211
        except Exception as ex:
195
            import sys
196 212
            from App import App
197 213
            from AppDocData import MessageType
198 214

  

내보내기 Unified diff

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