개정판 14c1c940
Feature: 다중 붙여 넣기 기능 개선
Change-Id: Ibdd03b1a7309e219e95bcf307e8fe928a2b74341
DTI_PID/DTI_PID/QtImageViewerScene.py | ||
---|---|---|
137 | 137 |
origin = self.views()[0].mapFromGlobal(QCursor.pos()) |
138 | 138 |
origin = self.views()[0].mapToScene(origin) |
139 | 139 |
|
140 |
delta = None |
|
140 | 141 |
root = ElementTree.fromstring(text) |
141 | 142 |
for symbol in root.find('SYMBOLS').iter('SYMBOL'): |
142 | 143 |
item = SymbolSvgItem.fromXml(symbol) |
143 | 144 |
svg = QtImageViewer.createSymbolObject(item.name) |
144 |
QtImageViewer.matchSymbolToLine(self, svg, origin) |
|
145 |
if not delta: |
|
146 |
delta = origin - QPointF(item.origin[0], item.origin[1]) |
|
147 |
QtImageViewer.matchSymbolToLine(self, svg, QPointF(item.origin[0], item.origin[1]) + delta, item.angle) |
|
145 | 148 |
''' |
146 | 149 |
# uid 새로 할당 |
147 | 150 |
item.uid = uuid.uuid4() |
... | ... | |
156 | 159 |
width = float(text.find('WIDTH').text) |
157 | 160 |
height = float(text.find('HEIGHT').text) |
158 | 161 |
angle = float(text.find('ANGLE').text) |
159 |
textInfo = TextInfo(text.find('VALUE').text, origin.x(), origin.y(), width, height, angle) |
|
162 |
tokens = text.find('LOCATION').text.split(',') |
|
163 |
loc = QPointF(float(tokens[0]), float(tokens[1])) |
|
164 |
if not delta: |
|
165 |
delta = origin - loc |
|
166 |
pos = loc + delta |
|
167 |
textInfo = TextInfo(text.find('VALUE').text, pos.x(), pos.y(), width, height, angle) |
|
160 | 168 |
item = QEngineeringTextItem.create_text_with(self, textInfo) |
161 | 169 |
item.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
162 | 170 |
|
171 |
for node in root.find('LINEINFOS').iter('LINE'): |
|
172 |
startPoint = [float(x) for x in node.find('STARTPOINT').text.split(',')] |
|
173 |
endPoint = [float(x) for x in node.find('ENDPOINT').text.split(',')] |
|
174 |
loc = QPointF(startPoint[0], startPoint[1]) |
|
175 |
if not delta: |
|
176 |
delta = origin - loc |
|
177 |
line = QEngineeringLineItem(vertices=[[startPoint[0] + delta.x(), startPoint[1] + delta.y()], |
|
178 |
[endPoint[0] + delta.x(), endPoint[1] + delta.y()]]) #.fromXml(node) |
|
179 |
if line: |
|
180 |
'''lineF = line.line() |
|
181 |
loc = QPointF(lineF.x1(), lineF.y1()) |
|
182 |
if not anchor: |
|
183 |
anchor = loc |
|
184 |
delta = origin - loc - anchor |
|
185 |
lineF.translate(delta) |
|
186 |
line.setLine(lineF) |
|
187 |
line.setVisible(True)''' |
|
188 |
self.addItem(line) |
|
189 |
|
|
163 | 190 |
elif event.key() == Qt.Key_Z and event.modifiers() & Qt.ControlModifier: |
164 | 191 |
#self._undo_stack.undo() |
165 | 192 |
pass |
내보내기 Unified diff