프로젝트

일반

사용자정보

개정판 811c7c26

ID811c7c26a372c98fe1a1ca420d79351dbf64bf7c
상위 b811793e
하위 7d49ffed

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

issue #538: line end break remain xml save, load, manual edit

Change-Id: I7d5fa9f19515b0674b9b1702f15ceea0695a42d4

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
494 494
                end_breaks.pop(index)
495 495

  
496 496
            for end_break in end_breaks:
497
                worker.graphicsView.scene.addItem(end_break)
497
                end_break.addSvgItemToScene(worker.graphicsView.scene)
498 498

  
499 499
    except Exception as ex:
500 500
        from App import App 
DTI_PID/DTI_PID/Shapes/EngineeringEndBreakItem.py
12 12
from PyQt5.QtWidgets import *
13 13

  
14 14
from SymbolSvgItem import SymbolSvgItem
15
from EngineeringLineItem import QEngineeringLineItem
16
from EngineeringConnectorItem import QEngineeringConnectorItem
17
from EngineeringTextItem import QEngineeringTextItem
18
from UserInputAttribute import UserInputAttribute
15
from SymbolAttr import SymbolAttr
19 16

  
20 17
class QEngineeringEndBreakItem(SymbolSvgItem):
21 18
    """
......
31 28
        self.setZValue(QEngineeringEndBreakItem.ZVALUE)
32 29
        self.connected_lines = []
33 30

  
31
        attr = SymbolAttr()
32
        attr.Attribute = 'End Break Line 1'
33
        attr.AttributeType = 'Line Item'
34
        self.attrs[attr] = None
35
        attr = SymbolAttr()
36
        attr.Attribute = 'End Break Line 2'
37
        attr.AttributeType = 'Line Item'
38
        self.attrs[attr] = None
39

  
40
    '''
34 41
    def setPosition(self, loc, origin):
35 42
        transform = QTransform()
36 43
        transform.translate(loc[0] - origin[0], loc[1] - origin[1])
37 44
        self.origin = origin
38 45
        self.loc = loc
39 46
        self.setTransform(transform)
47
    '''
48
    def getAttributes(self):
49
        """
50
            attributes MUST have End Break Line 1, End Break Line 2 attribute
51
        """
52
        return self.attrs
40 53

  
41 54
    def keyPressEvent(self, event): 
42 55
        if self.isSelected() and event.key() == Qt.Key_Delete:
43 56
            self.scene().removeItem(self)
44 57

  
58
    def toXml(self):
59
        '''is not finished, check later in svgitem toxml and item table widget'''
60
        return None
61
    '''
45 62
    @staticmethod 
46 63
    def fromXml(node):
47 64
        import uuid
......
116 133

  
117 134
            return None
118 135

  
119
        return node 
136
        return node
137
    '''
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py
359 359
            line_from = self.get_property('From')
360 360
            line_to = self.get_property('To')
361 361

  
362
            end_break_names = docdata.getSymbolListByType('type', 'End Break')
363
            if len(end_break_names) is 0:
364
                return end_breaks
365
                
366
            svgFileName = end_break_names[0].sName
367
            symbol = AppDocData.instance().getSymbolByQuery('name', svgFileName)
368
            svgFilePath = os.path.join(AppDocData.instance().getCurrentProject().getSvgFilePath(), symbol.getType(), svgFileName+'.svg')
369

  
362 370
            if type(line_from) is QEngineeringLineItem and line_from.connectors[0].connectedItem is not None and type(line_from.connectors[0].connectedItem) is QEngineeringLineItem:
363
                end_break = SymbolSvgItem.createItem('End Break', dataPath)
364
                end_break.setPosition(line_from.connectors[0].center(), origin)
365
                #end_break.parent = self
371
                end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath)
372
                pt = [line_from.connectors[0].center()[0] - float(symbol.getOriginalPoint().split(',')[0]), line_from.connectors[0].center()[1] - float(symbol.getOriginalPoint().split(',')[1])]
373
                origin = [0,0]
374
                if 2 == len(symbol.getOriginalPoint().split(',')):
375
                    tokens = symbol.getOriginalPoint().split(',')
376
                    origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])]
377
                end_break.buildItem(svgFileName, symbol.getType(), 5.7, pt, [end_break.boundingRect().width(), end_break.boundingRect().height()], origin, [], symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getHasInstrumentLabel())
366 378
                end_break.connected_lines = [line_from.uid, line_from.connectors[0].connectedItem.uid]
367 379
                end_break.setToolTip(str(end_break.connected_lines))
368 380
                end_break.area = 'Drawing'
369
                end_break.name = 'End Break'
370 381
                end_breaks.append(end_break)
371 382

  
372 383
            if type(line_to) is QEngineeringLineItem and line_to.connectors[1].connectedItem is not None and type(line_to.connectors[1].connectedItem) is QEngineeringLineItem:
384
                end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath)
385
                pt = [line_to.connectors[1].center()[0] - float(symbol.getOriginalPoint().split(',')[0]), line_to.connectors[1].center()[1] - float(symbol.getOriginalPoint().split(',')[1])]
386
                origin = [0,0]
387
                #print(symbol.getOriginalPoint())
388
                if 2 == len(symbol.getOriginalPoint().split(',')):
389
                    tokens = symbol.getOriginalPoint().split(',')
390
                    origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])]
391
                end_break.buildItem(svgFileName, symbol.getType(), 5.7, pt, [end_break.boundingRect().width(), end_break.boundingRect().height()], origin, [], symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getHasInstrumentLabel())
392
                end_break.connected_lines = [line_to.uid, line_to.connectors[1].connectedItem.uid]
393
                end_break.setToolTip(str(end_break.connected_lines))
394
                end_break.area = 'Drawing'
395
                end_breaks.append(end_break)
396
                '''
373 397
                end_break = SymbolSvgItem.createItem('End Break', dataPath)
374 398
                end_break.setPosition(line_to.connectors[1].center(), origin)
375 399
                #end_break.parent = self
......
378 402
                end_break.area = 'Drawing'
379 403
                end_break.name = 'End Break'
380 404
                end_breaks.append(end_break)
405
                '''
381 406

  
382 407
        except Exception as ex:
383 408
            from App import App 
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
900 900
            svgFilePath = os.path.join(project.getSvgFilePath(), _type, name + '.svg')
901 901
            if os.path.isfile(svgFilePath):
902 902
                item[0] = SymbolSvgItem.createItem(_type, svgFilePath, uid, flip=flipLabel)
903
                item[0].setVisible(False)
903
                #item[0].setVisible(False)
904 904
                item[0].buildItem(name, _type, angle, pt, size, origin, connPts, baseSymbol, childSymbol, hasInstrumentLabel)
905 905

  
906 906
                for prop_node in node.iter('PROPERTY'):
......
1194 1194
        self.setTransform(transform)
1195 1195
        scene.addItem(self)
1196 1196

  
1197

  
1198 1197
    '''
1199 1198
        @brief      
1200 1199
        @author     humkyung

내보내기 Unified diff

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