개정판 dd835b7b
add copy between drawings
Change-Id: Ie3f281104f1d45008a9cec866ee74add39bab96f
DTI_PID/DTI_PID/QtImageViewerScene.py | ||
---|---|---|
137 | 137 |
if text.find('<DWG>') != -1 and text.find('</DWG>') != -1: |
138 | 138 |
from xml.etree import ElementTree |
139 | 139 |
|
140 |
root = ElementTree.fromstring(text) |
|
141 |
|
|
142 |
fromDrawing = root.find('DWGNAME').text |
|
143 |
fixedPosition = False |
|
144 |
if app_doc_data.activeDrawing.name.replace('.png', '') != fromDrawing: |
|
145 |
fixedPosition = True |
|
146 |
|
|
140 | 147 |
origin = self.views()[0].mapFromGlobal(QCursor.pos()) |
141 | 148 |
origin = self.views()[0].mapToScene(origin) |
142 | 149 |
|
143 |
delta = None |
|
144 |
root = ElementTree.fromstring(text) |
|
150 |
delta = QPointF(0, 0) |
|
145 | 151 |
for symbol in root.find('SYMBOLS').iter('SYMBOL'): |
146 | 152 |
item = SymbolSvgItem.fromXml(symbol) |
147 | 153 |
svg = QtImageViewer.createSymbolObject(item.name) |
148 |
if not delta: |
|
154 |
if not delta and not fixedPosition:
|
|
149 | 155 |
delta = origin - QPointF(item.origin[0], item.origin[1]) |
150 | 156 |
|
151 | 157 |
if type(svg) is QEngineeringSpecBreakItem: |
... | ... | |
183 | 189 |
angle = float(text.find('ANGLE').text) |
184 | 190 |
tokens = text.find('LOCATION').text.split(',') |
185 | 191 |
loc = QPointF(float(tokens[0]), float(tokens[1])) |
186 |
if not delta: |
|
192 |
if not delta and not fixedPosition:
|
|
187 | 193 |
delta = origin - loc |
188 | 194 |
pos = loc + delta |
189 | 195 |
textInfo = TextInfo(text.find('VALUE').text, pos.x(), pos.y(), width, height, angle) |
... | ... | |
194 | 200 |
startPoint = [float(x) for x in node.find('STARTPOINT').text.split(',')] |
195 | 201 |
endPoint = [float(x) for x in node.find('ENDPOINT').text.split(',')] |
196 | 202 |
loc = QPointF(startPoint[0], startPoint[1]) |
197 |
if not delta: |
|
203 |
if not delta and not fixedPosition:
|
|
198 | 204 |
delta = origin - loc |
199 | 205 |
line = QEngineeringLineItem(vertices=[[startPoint[0] + delta.x(), startPoint[1] + delta.y()], |
200 | 206 |
[endPoint[0] + delta.x(), endPoint[1] + delta.y()]]) #.fromXml(node) |
내보내기 Unified diff