프로젝트

일반

사용자정보

개정판 6b290c1c

ID6b290c1c7e5b2e13ff13f3e46c5eb65096164389
상위 baa77cbf
하위 12fbbf9a

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

issue #1124: fix

Change-Id: I2d72ef21bb558985e096c29d5a24216b366a9706

차이점 보기:

DTI_PID/DTI_PID/LineDetector.py
9 9
        try:
10 10
            thresh = 127
11 11
            self._image = image
12
            self.width, self.height = self._image.shape[::-1]
13
            self.Result = np.zeros((self.width, self.height, 3), np.uint8)
12
            self.width, self.height = self._image.shape[::-1] if self._image else [None, None]
13
            self.Result = np.zeros((self.width, self.height, 3), np.uint8) if self._image else None
14 14
        except Exception as ex:
15 15
            print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
16 16

  
DTI_PID/DTI_PID/MainWindow.py
1551 1551

  
1552 1552
    def onLineCreated(self):
1553 1553
        from EngineeringConnectorItem import QEngineeringConnectorItem
1554
        from LineDetector import LineDetector
1554 1555

  
1555 1556
        try:
1556 1557
            count = len(self.actionLine.tag._polyline._vertices)
1557 1558
            if count > 1:
1558 1559
                items = []
1559 1560

  
1561
                detector = LineDetector(None)
1562

  
1560 1563
                lineType = self.lineComboBox.currentText()
1561 1564
                for index in range(count - 1):
1562 1565
                    start = self.actionLine.tag._polyline._vertices[index]
......
1572 1575
                        selected = [item for item in self.graphicsView.scene.items(QPointF(pt[0], pt[1])) if
1573 1576
                                    type(item) is QEngineeringConnectorItem or type(item) is QEngineeringLineItem]
1574 1577
                        if selected:
1575
                            lineItem.connect_if_possible(
1576
                                selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0],
1577
                                5)
1578
                            detector.connectLineToLine(lineItem, selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0], 5)
1578 1579

  
1579 1580
                    items.append(lineItem)
1580 1581
                    self.graphicsView.scene.addItem(lineItem)
1581 1582

  
1582 1583
                pt = items[-1].endPoint()
1583 1584
                selected = [item for item in self.graphicsView.scene.items(QPointF(pt[0], pt[1])) if
1584
                            type(item) is QEngineeringConnectorItem and item.parent is not items[-1]]
1585
                            (type(item) is QEngineeringConnectorItem and item.parent is not items[-1]) or type(item) is QEngineeringLineItem]
1585 1586
                if selected:
1586
                    items[-1].connect_if_possible(selected[0].parent, 5)
1587
                    detector.connectLineToLine(items[-1], selected[0].parent if type(selected[0]) is QEngineeringConnectorItem else selected[0], 5)
1587 1588

  
1588 1589
        finally:
1589 1590
            self.graphicsView.scene.removeItem(self.actionLine.tag._polyline)
......
2145 2146
                    height = textInfo.getH()
2146 2147
                    angle = round(math.radians(textInfo.getAngle()), 2)
2147 2148
                    text = textInfo.getText()
2149
                    if not text: continue
2148 2150
                    item = TextItemFactory.instance().createTextItem(textInfo)
2149 2151

  
2150 2152
                    if item is not None:
DTI_PID/DTI_PID/TextDetector.py
310 310
                for area in appDocData.getAreaList():
311 311
                    if area.name == 'Drawing': continue
312 312

  
313
                    if area.name == 'Unit':
313
                    if area.name == 'Note':
314
                        if area is not None and hasattr(area, 'img') and area.img is not None:
315
                            if len(whiteCharList) is 0:
316
                                texts = TOCR.getTextInfo(area.img, (area.x, area.y), 0, language='eng')
317
                            else:
318
                                texts = TOCR.getTextInfo(area.img, (area.x, area.y), 0, language='eng', conf=whiteCharList[0].value)
319
                            self.otherTextInfoList.append([area.name, texts])
320
                    else:
314 321
                        img = imgSrc[round(area.y):round(area.y+area.height), round(area.x):round(area.x+area.width)]
315 322
                        if len(whiteCharList) is 0:
316 323
                            texts = TOCR.getTextInfo(img, (area.x, area.y), 0, language='eng')
317 324
                        else:
318 325
                            texts = TOCR.getTextInfo(img, (area.x, area.y), 0, language='eng', conf = whiteCharList[0].value)
319 326
                        if texts is not None and len(texts) > 0:
320
                            appDocData.activeDrawing.setAttr('Unit', texts[0].getText())
321
                            self.otherTextInfoList.append([area.name, texts])
322
                    else:
323
                        if area is not None and hasattr(area, 'img') and area.img is not None:
324
                            if len(whiteCharList) is 0:
325
                                texts = TOCR.getTextInfo(area.img, (area.x, area.y), 0, language='eng')
326
                            else:
327
                                texts = TOCR.getTextInfo(area.img, (area.x, area.y), 0, language='eng', conf=whiteCharList[0].value)
327
                            if area.name == 'Unit':
328
                                appDocData.activeDrawing.setAttr('Unit', texts[0].getText())
328 329
                            self.otherTextInfoList.append([area.name, texts])
329 330

  
330 331
                titleBlockProps = appDocData.getTitleBlockProperties()

내보내기 Unified diff

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