개정판 267d4422
tag no link improve
Change-Id: I999eb14084353600f55aebef586d74e3b75f219c
DTI_PID/DTI_PID/Shapes/QEngineeringTagNoTextItem.py | ||
---|---|---|
45 | 45 |
dist = (self.sceneBoundingRect().height() + self.sceneBoundingRect().width()) * ratio |
46 | 46 |
center = self.sceneBoundingRect().center() |
47 | 47 |
|
48 |
target_symbols = [] |
|
48 | 49 |
for symbol in symbols: |
49 | 50 |
if type(symbol) is QEngineeringEquipmentItem or type(symbol) is QEngineeringVendorItem: |
50 |
if symbol.includes([center.x(), center.y()]): |
|
51 |
selected = symbol |
|
52 |
break |
|
51 |
attrs = symbol.getAttributes(findOwner=True) |
|
52 |
|
|
53 |
freeze = False |
|
54 |
for attr in attrs: |
|
55 |
if attr.Freeze: |
|
56 |
freeze = True |
|
57 |
break |
|
58 |
if freeze: continue |
|
59 |
|
|
60 |
for attr in attrs: |
|
61 |
if attr.AttributeType == 'Tag No': |
|
62 |
target_symbols.append(symbol) |
|
63 |
break |
|
64 |
|
|
65 |
for symbol in target_symbols: |
|
66 |
if symbol.includes([center.x(), center.y()]): |
|
67 |
selected = symbol |
|
68 |
break |
|
53 | 69 |
|
54 | 70 |
if selected is None: |
55 |
for symbol in symbols: |
|
56 |
if type(symbol) is QEngineeringEquipmentItem or type(symbol) is QEngineeringVendorItem: |
|
57 |
dx = symbol.center().x() - center.x() |
|
58 |
dy = symbol.center().y() - center.y() |
|
59 |
length = math.sqrt(dx*dx + dy*dy) |
|
60 |
if (length < dist) and (minDist is None or length < minDist): |
|
61 |
minDist = length |
|
62 |
selected = symbol |
|
71 |
for symbol in target_symbols: |
|
72 |
dx = symbol.center().x() - center.x() |
|
73 |
dy = symbol.center().y() - center.y() |
|
74 |
length = math.sqrt(dx*dx + dy*dy) |
|
75 |
if (length < dist) and (minDist is None or length < minDist): |
|
76 |
minDist = length |
|
77 |
selected = symbol |
|
63 | 78 |
|
64 | 79 |
if selected is not None: |
65 | 80 |
if selected.add_assoc_item(self): |
내보내기 Unified diff