프로젝트

일반

사용자정보

개정판 f4130ef7

IDf4130ef7b449ce9677a30d5217997f145c856195
상위 da22c648
하위 9bdd733e

김정우 이(가) 6년 이상 전에 추가함

중간파일(xml)에 LineNoTextItem 추가 및 해당 xml 로드 시 Scene에 LineNoTextItem 추가되도록 변경

차이점 보기:

DTI_PID/DTI_PID/DTI_PID.py
197 197
            splitRoiList.append((roiSp, roiEp, srcPid[roiSp[1]:roiEp[1], roiSp[0]:roiEp[0]]))
198 198
    return splitRoiList
199 199

  
200
'''
201
    @history    2018.06.12  Jeongwoo    Type changed (int → float)
202
'''
200 203
def getCalculatedOriginalPoint(additionalSymbol, symbolOriginalPoint, symbolRotatedAngle, rotateSymbolWidth, rotateSymbolHeight, originalSymbolWidth, originalSymbolHeight):
201 204
    originalPoint = ''
202 205
    if additionalSymbol is None and symbolOriginalPoint is None:
203 206
        originalPoint = str(rotateSymbolWidth//2)+','+str(rotateSymbolHeight//2)
204 207
    else:
205
        opx = int(symbolOriginalPoint.split(',')[0])
206
        opy = int(symbolOriginalPoint.split(',')[1])
208
        opx = float(symbolOriginalPoint.split(',')[0])
209
        opy = float(symbolOriginalPoint.split(',')[1])
207 210
        rPt = getCoordOnRotatedImage(symbolRotatedAngle, opx, opy, originalSymbolWidth, originalSymbolHeight)
208
        originalPoint = str(int(rPt[0])) + ',' + str(int(rPt[1]))
211
        originalPoint = str(float(rPt[0])) + ',' + str(float(rPt[1]))
209 212
    return originalPoint
210 213

  
214
'''
215
    @history    2018.06.12  Jeongwoo    Type changed (int → float)
216
'''
211 217
def getCalculatedConnectionPoint(symbolConnectionPointStr, symbolRotatedAngle, rotateSymbolWidth, rotateSymbolHeight, originalSymbolWidth, originalSymbolHeight):
212 218
    convertedConnectionPoint = ""
213 219
    if symbolConnectionPointStr is not None:
......
216 222
            if index != 0:
217 223
                convertedConnectionPoint = convertedConnectionPoint + "/"
218 224
            item = splitConnectionPointStr[index]
219
            cpx = int(item.split(',')[0])
220
            cpy = int(item.split(',')[1])
225
            cpx = float(item.split(',')[0])
226
            cpy = float(item.split(',')[1])
221 227
            rPt = getCoordOnRotatedImage(symbolRotatedAngle, cpx, cpy, originalSymbolWidth, originalSymbolHeight)
222
            temp = str(int(rPt[0])) + ',' + str(int(rPt[1]))
228
            temp = str(float(rPt[0])) + ',' + str(float(rPt[1]))
223 229
            convertedConnectionPoint = convertedConnectionPoint + temp
224 230
    return convertedConnectionPoint
225 231
    
DTI_PID/DTI_PID/MainWindow.py
704 704
                    Jeongwoo 2018.05.03 Change method to draw Svg Item on Scene (svg.addSvgItemToScene)
705 705
                    Jeongwoo 2018.05.29 Change method name / Change method to add item / Add Line item
706 706
                    Jeongwoo 2018.05.30 Add parameters on SymbolSvgItem.__init__() (parentSymbol, childSymbol) / Change method name / Change XML NODE NAMES
707
                    Jeongwoo 2018.06.12 Add LineNoTextItem from LINE_NO
707 708
    '''
708 709
    def loadRecognitionResultFromXml(self, xmlPath):
709 710
        from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse
......
781 782
                        item.setPlainText(value)
782 783
                        self.addTextItemToScene(item)
783 784

  
785
            for lineNo in root.iter('LINE_NO'):
786
                location = lineNo.find('LOCATION').text if lineNo.find('LOCATION') is not None else '0,0'
787
                x = float(location.split(',')[0])
788
                y = float(location.split(',')[1])
789
                width = float(lineNo.find('WIDTH').text) if lineNo.find('WIDTH') is not None else 0
790
                height = float(lineNo.find('HEIGHT').text) if lineNo.find('HEIGHT') is not None else 0
791
                angle = float(lineNo.find('ANGLE').text) if lineNo.find('ANGLE') is not None else 0
792
                text = lineNo.find('TEXT').text
793

  
794
                item = TextItemFactory.instance().createTextItem(text, delimiter, lineNoconfigs)
795
                if item is not None:
796
                    item.loc = (x, y)
797
                    item.size = (width, height)
798
                    item.angle = angle
799
                    item.setPlainText(text)
800
                    item.removed.connect(self.itemRemoved)
801
                    self.addTextItemToScene(item)
802

  
784 803
            for line in root.iter('LINE'):
785 804
                startPoint = line.find('STARTPOINT').text
786 805
                endPoint = line.find('ENDPOINT').text
DTI_PID/DTI_PID/XmlGenerator.py
64 64
LLINE_START_POINT_NODE_NAME = "STARTPOINT"
65 65
LLINE_END_POINT_NODE_NAME = "ENDPOINT"
66 66

  
67
LINE_NOS_NODE_NAME = "LINENOS"
68

  
67 69

  
68 70
'''
69 71
    @brief  
......
345 347
    @author     Jeongwoo
346 348
    @date       2018.05.30
347 349
    @history    2018.05.30  Jeongwoo    Create node by item object
350
                2018.06.12  Jeongwoo    Add if-statement for QEngineeringLineNoTextItem data node
348 351
'''
349 352
def writeXmlOnScene(pidName, pidWidth, pidHeight, scene):
350 353
    from QEngineeringNoteItem import QEngineeringNoteItem
351 354
    from QEngineeringTextItem import QEngineeringTextItem
352 355
    from QEngineeringLineItem import QEngineeringLineItem
356
    from QEngineeringLineNoTextItem import QEngineeringLineNoTextItem
353 357
    from SymbolSvgItem import SymbolSvgItem
354 358

  
355 359
    path = os.path.join(AppDocData.instance().getCurrentProject().getTempPath(), pidName + '.xml')
......
361 365
    textInfoListNode = Element(TEXT_INFO_LIST_NODE_NAME) # Text Info List Node
362 366
    noteTextInfoListNode = Element(NOTE_TEXT_INFO_LIST_NOTE_NAME)
363 367
    lineListNode = Element(LINE_INFOS_NODE_NAME)
368
    lineNoListNode = Element(LINE_NOS_NODE_NAME)
364 369
    
365 370
    try:
366 371
        items = scene.items()
......
378 383
                elif type(item) is QEngineeringLineItem:
379 384
                    lineNode = item.toXml()
380 385
                    lineListNode.append(lineNode)
386
                elif type(item) is QEngineeringLineNoTextItem:
387
                    lineNoNode = item.toXml()
388
                    lineNoListNode.append(lineNoNode)
381 389
    except Exception as ex:
382 390
        print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
383 391
    finally:
......
385 393
        xml.append(textInfoListNode)
386 394
        xml.append(noteTextInfoListNode)
387 395
        xml.append(lineListNode)
396
        xml.append(lineNoListNode)
388 397
        ElementTree(xml).write(path)
389 398

  
390 399
    return path

내보내기 Unified diff

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