프로젝트

일반

사용자정보

개정판 e4d9acb3

IDe4d9acb3441ff64d5bc74876abd4e81a5e86d294
상위 e7a4ce08
하위 83c14cff

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

issue #000: equipment has tagno text item as owner

Change-Id: Icb49c0d5bcad43574242fe31f3f82a4575312aad

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
455 455
    from QEngineeringSizeTextItem import QEngineeringSizeTextItem
456 456
    from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem
457 457
    from QEngineeringTrimLineNoTextItem import QEngineeringTrimLineNoTextItem
458
    from QEngineeringTagNoTextItem import QEngineeringTagNoTextItem
458 459

  
459 460
    try:
460 461
        docdata = AppDocData.instance()
......
536 537
        texts = [item for item in worker.graphicsView.scene.items() if type(item) is QEngineeringReservedWordTextItem]
537 538
        for text in texts:
538 539
            text.findOwner(lines)
539
        texts = [item for item in worker.graphicsView.scene.items() if type(item) is QEngineeringSizeTextItem or type(item) is QEngineeringSizeTextItem or type(item) is QEngineeringValveOperCodeTextItem]            
540
        texts = [item for item in worker.graphicsView.scene.items() if type(item) is QEngineeringSizeTextItem or type(item) is QEngineeringSizeTextItem or type(item) is QEngineeringValveOperCodeTextItem or type(item) is QEngineeringTagNoTextItem]            
540 541
        for text in texts:
541 542
            text.findOwner(symbols)
542 543

  
DTI_PID/DTI_PID/Shapes/QEngineeringTagNoTextItem.py
20 20
import OcrResultDialog
21 21
from AppDocData import AppDocData,MessageType
22 22
from EngineeringTextItem import QEngineeringTextItem
23
from EngineeringEquipmentItem import QEngineeringEquipmentItem
23 24

  
24 25
class QEngineeringTagNoTextItem(QEngineeringTextItem):
25 26
    """ This is engineering tag no text item class """
......
30 31
        QEngineeringTextItem.__init__(self, parent)
31 32
        self.type = 'TAG NO'
32 33

  
33
    def hoverEnterEvent(self, event):
34
        pass
34
    def findOwner(self, symbols):
35
        import math
35 36

  
36
    def hoverLeaveEvent(self, event):
37
        pass
37
        try:
38
            minDist = None
39
            selected = None
38 40

  
39
    def hoverMoveEvent(self, event):
40
        pass
41
            configs = AppDocData.instance().getConfigs('Range', 'Detection Ratio')
42
            ratio = float(configs[0].value) if 1 == len(configs) else 1.5
43

  
44
            dist = (self.sceneBoundingRect().height() + self.sceneBoundingRect().width()) * ratio
45
            center = self.sceneBoundingRect().center()
46

  
47
            for symbol in symbols:
48
                if type(symbol) is QEngineeringEquipmentItem:
49
                    if symbol.includes([self.sceneBoundingRect().center().x(), self.sceneBoundingRect().center().y()]):
50
                        selected = symbol
51
                        break
52

  
53
            if selected is None:
54
                for symbol in symbols:
55
                    if type(symbol) is QEngineeringEquipmentItem:
56
                        dx = symbol.center().x() - center.x()
57
                        dy = symbol.center().y() - center.y()
58
                        length = math.sqrt(dx*dx + dy*dy)
59
                        if (length < dist) and (minDist is None or length < minDist):
60
                            minDist = length
61
                            selected = symbol
62

  
63
            if selected is not None:
64
                self.owner = selected
65
                selected.owner = self.owner
66

  
67
        except Exception as ex:
68
            from App import App 
69
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
70
            App.mainWnd().addMessage.emit(MessageType.Error, message)

내보내기 Unified diff

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