개정판 6d011c3c
issue #563: owner find fix
Change-Id: I056ab0780a57691fb32a135c8b05fc10918799c9
DTI_PID/DTI_PID/Shapes/EngineeringInstrumentItem.py | ||
---|---|---|
187 | 187 |
ratio = float(configs[0].value) if 1 == len(configs) else 1.5 |
188 | 188 |
|
189 | 189 |
dist = (self.sceneBoundingRect().height() + self.sceneBoundingRect().width()) * ratio / 2 |
190 |
center = self.sceneBoundingRect().center()
|
|
190 |
center = [self.origin[0], self.origin[1]]
|
|
191 | 191 |
|
192 | 192 |
for attr in attributes: |
193 | 193 |
if issubclass(type(attr), QEngineeringTextItem): |
... | ... | |
196 | 196 |
attr.owner = self # set owner of text |
197 | 197 |
|
198 | 198 |
elif issubclass(type(attr), SymbolSvgItem) and attr is not self: |
199 |
dx = attr.center().x() - center.x()
|
|
200 |
dy = attr.center().y() - center.y()
|
|
199 |
dx = attr.origin[0] - center[0]
|
|
200 |
dy = attr.origin[1] - center[1]
|
|
201 | 201 |
|
202 |
offset = (attr.sceneBoundingRect().width() + attr.sceneBoundingRect().height()) / 4 |
|
203 |
length = math.sqrt(dx * dx + dy * dy) - offset |
|
202 |
length = math.sqrt(dx * dx + dy * dy) |
|
204 | 203 |
|
205 | 204 |
if (length < dist) and (minDist is None or length < minDist): |
206 | 205 |
minDist = length |
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
737 | 737 |
dx = symbol.origin[0] - center.x() |
738 | 738 |
dy = symbol.origin[1] - center.y() |
739 | 739 |
|
740 |
offset = (symbol.sceneBoundingRect().width() + symbol.sceneBoundingRect().height()) / 4 |
|
741 |
length = math.sqrt(dx * dx + dy * dy) - offset |
|
740 |
#offset = (symbol.sceneBoundingRect().width() + symbol.sceneBoundingRect().height()) / 4
|
|
741 |
length = math.sqrt(dx * dx + dy * dy)# - offset
|
|
742 | 742 |
|
743 | 743 |
if (length < dist) and (minDist is None or length < minDist): |
744 | 744 |
minDist = length |
DTI_PID/DTI_PID/Shapes/EngineeringValveOperCodeTextItem.py | ||
---|---|---|
50 | 50 |
|
51 | 51 |
for symbol in symbols: |
52 | 52 |
if type(symbol) is SymbolSvgItem or type(symbol) is QEngineeringInstrumentItem: |
53 |
dx = symbol.center().x() - center.x()
|
|
54 |
dy = symbol.center().y() - center.y()
|
|
53 |
dx = symbol.origin[0] - center.x()
|
|
54 |
dy = symbol.origin[1] - center.y()
|
|
55 | 55 |
|
56 |
offset = (symbol.sceneBoundingRect().width() + symbol.sceneBoundingRect().height()) / 4 |
|
57 |
length = math.sqrt(dx*dx + dy*dy) - offset |
|
56 |
#offset = (symbol.sceneBoundingRect().width() + symbol.sceneBoundingRect().height()) / 4
|
|
57 |
length = math.sqrt(dx*dx + dy*dy)# - offset
|
|
58 | 58 |
|
59 | 59 |
if (length < dist) and (minDist is None or length < minDist): |
60 | 60 |
minDist = length |
내보내기 Unified diff