프로젝트

일반

사용자정보

개정판 4ff25dbf

ID4ff25dbf6e5c38fe6b3f6a334c03cb9d101dc287
상위 0243b725
하위 d345d01d

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

issue #1061: revised create connector when creating stream line

Change-Id: Ic4fc96d336598ccf66fe715488c6d84587514a5b

차이점 보기:

HYTOS/HYTOS/Commands/PlaceStreamlineCommand.py
59 59
        if 'mousePressEvent' == param[0] and event.button() == Qt.LeftButton:
60 60
            selected = self.imageViewer.scene.itemAt(param[2], QTransform())
61 61

  
62
            if self._streamline is None:                
62
            if self._streamline is None: 
63 63
                if selected is not None and type(selected) is QEngineeringConnectorItem:
64 64
                    self._streamline = QEngineeringStreamlineItem()
65 65
                    self._streamline._vertices.append(selected.center())
......
68 68

  
69 69
                    self.connectorItems.append(selected)
70 70
            else:
71
                try:                
71
                try: 
72 72
                    if selected is not None and type(selected) is QEngineeringConnectorItem:
73 73
                        self.connectorItems.append(selected)
74
                        self._streamline._vertices[-1] = selected.center()
74 75

  
75
                    #self.buildConnectors(self.connectorItems) 
76

  
77
                    QGraphicsView.mouseReleaseEvent(self.imageViewer, event)
76
                    #QGraphicsView.mouseReleaseEvent(self.imageViewer, event)
77
                    self._streamline.build_connectors(self.connectorItems)
78 78
                    self._streamline.update()
79
                    self.buildConnectors(self.connectorItems) 
80 79
                    self.onSuccess.emit()
81 80
                    self.connectorItems.clear()
82 81
                finally:
......
94 93
        pass
95 94

  
96 95
    def redo(self):
97
        pass
98

  
99
    def buildConnectors(self, connectorItems):
100
        from EngineeringConnectorItem import QEngineeringConnectorItem 
101

  
102
        index = 0
103
        for vertex in [self._streamline._vertices[0],self._streamline._vertices[-1]]:
104
            connector = QEngineeringConnectorItem(parent=self._streamline, index=index+1)
105
            connector.setPos(vertex)
106
            connector.setParentItem(self._streamline)
107
            # connector의 connectPoint, sceneConnectPoint를 vertex로 함 추후 좀 알아봐서 수정 필요
108
            connector.connectPoint = vertex
109
            connector.sceneConnectPoint = vertex
110

  
111
            # add connector move ables
112
            connector.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable)
113
            connector.setAcceptTouchEvents(True)
114
            #connector.transfer.onPosChanged.connect(self.onConnectorPosChaned)
115

  
116
            connector.setZValue(self._streamline.zValue() + 1)
117
            self._streamline.connectors.append(connector)
118
            if len(connectorItems) > index:
119
                connector.connectedItem = connectorItems[index]
120

  
121
            index = index + 1
122

  
123
        if len(connectorItems) > 1:
124
            connectorItems[0].connectedItem = self._streamline.connectors[0]
125
            connectorItems[1].connectedItem = self._streamline.connectors[1]
126
        else:
127
            connectorItems[0].connectedItem = self._streamline.connectors[0]
96
        pass

내보내기 Unified diff

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