프로젝트

일반

사용자정보

개정판 e57bdb6e

IDe57bdb6ea307ea5d85444d8e661362205e15303c
상위 8d2b3c9c
하위 5397f65f

백흠경이(가) 5년 이상 전에 추가함

issue #1061: 드래그, 드랍 심볼 생성 오류 수정

Change-Id: Id67d5fd435844e87ca2f84f9c3e9e271f4b9af58

차이점 보기:

HYTOS/HYTOS/QtImageViewer.py
525 525
            scenePos = self.mapToScene(event.pos())
526 526
            uid = event.mimeData().text()
527 527
            svg = self.createSymbolObject(uid)
528
            self.matchSymbolToLine(svg, scenePos)
529

  
530
            #if type(svg) is QEngineeringSpecBreakItem:
531
            #   self.command.specBreak_startPoint = [scenePos.x(), scenePos.y()]
532
            #    self.command.isCopy = True
533
            #    self.command.isSpecBreak = True
534
            #    self.command.symbol = svg
535
            #    while 0 != svg.angle:
536
            #        svg.rotateSymbol()
528
            if svg:
529
                self.place_symbol(svg, scenePos)
537 530

  
538 531
            event.acceptProposedAction()
539 532
        except Exception as ex:
......
543 536
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
544 537
                                                           sys.exc_info()[-1].tb_lineno)
545 538
            App.mainWnd().addMessage.emit(MessageType.Error, message)
546
        '''
539

  
540
    '''
547 541
        @brief  drop create Symbol
548 542
        @author kyouho
549 543
        @date   2018.07.27
......
570 564
        svg.buildItem(svgFileName, svgType, svgAngle, svgScale, None, svgOrigin, connPts, uid)
571 565
        
572 566
        return svg
573
        
567

  
568
    '''
569
        @brief      match symbol to line
570
        @author     kyouho
571
        @date       2018.07.27
572
        @history    humkyung 2018.08.23 change scenePos to connector's center when symbol is placed on connector
573
    '''
574

  
575
    def place_symbol(self, svg, scenePos):
576
        from EngineeringConnectorItem import QEngineeringConnectorItem
577

  
578
        items = [item for item in self.scene.items(scenePos) if type(item) is not QGraphicsPixmapItem]
579
        if len(items) > 0 and type(items[0]) is QEngineeringConnectorItem:
580
            scenePos = QPointF(items[0].center()[0], items[0].center()[1])
581

  
582
        transform = QTransform()
583
        transform.translate(scenePos.x() - svg.symbolOrigin[0], scenePos.y() - svg.symbolOrigin[1])
584
        svg.setTransform(transform)
585
        svg.loc = [round(scenePos.x() - svg.symbolOrigin[0], 1), round(scenePos.y() - svg.symbolOrigin[1], 1)]
586
        svg.size = [svg.boundingRect().width(), svg.boundingRect().height()]
587
        svg.origin = [round(scenePos.x(), 1), round(scenePos.y(), 1)]
588
        self.scene.addItem(svg)
589

  
590
        svg.transfer.onRemoved.connect(self.mainWindow.on_item_removed)
591

  
592
        self.scene.clearFocus()
593
        for item in self.scene.selectedItems():
594
            item.setSelected(False)
595

  
574 596
    '''
575 597
        @brief  find item by uid (SymbolSvgItem 기반, QEngineeringConnectorItem 제외, QEngineeringLineItem 포함)
576 598
        @author kyouho

내보내기 Unified diff

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