개정판 d83a9c6a
fix cad text size
Change-Id: I7673d3eef4dd2e64a48aa1dfee1fa6a5d0188731
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
1480 | 1480 |
angle += math.pi |
1481 | 1481 |
angle = angle - math.pi * 2 if angle > math.pi * 2 else angle |
1482 | 1482 |
|
1483 |
_height = round(float(text_node.attrib['Height']) * self.scales[1]) |
|
1484 |
loc[1] -= _height |
|
1485 |
_width = round(_height * len(text) * self.text_scale) |
|
1486 |
#_width = round(float(text_node.attrib['Width'])) |
|
1483 |
min_extents, max_extents = None, None |
|
1484 |
tokens = text_node.attrib['MaxExtents'].strip('()').split(',') |
|
1485 |
if 3 == len(tokens): |
|
1486 |
max_extents = self.convert_to_image_coords([float(tokens[0]), float(tokens[1])]) |
|
1487 |
|
|
1488 |
tokens = text_node.attrib['MinExtents'].strip('()').split(',') |
|
1489 |
if 3 == len(tokens): |
|
1490 |
min_extents = self.convert_to_image_coords([float(tokens[0]), float(tokens[1])]) |
|
1491 |
|
|
1492 |
_height = math.ceil(abs(max_extents[1] - min_extents[1])) |
|
1493 |
_width = math.ceil(abs(max_extents[0] - min_extents[0])) |
|
1487 | 1494 |
|
1488 | 1495 |
allowed_error = 0.01 |
1489 | 1496 |
if abs(angle - 1.57) < allowed_error: |
... | ... | |
1493 | 1500 |
_height, _width = _width, _height |
1494 | 1501 |
loc[0], loc[1] = loc[0] - _width, loc[1] + _height - _width |
1495 | 1502 |
|
1503 |
#_height = round(float(text_node.attrib['Height']) * self.scales[1]) |
|
1504 |
loc[1] -= _height |
|
1505 |
#_width = round(_height * len(text) * self.text_scale) |
|
1506 |
##_width = round(float(text_node.attrib['Width'])) |
|
1507 |
|
|
1496 | 1508 |
item = QEngineeringTextItem() |
1497 | 1509 |
item.setPlainText(text) |
1498 | 1510 |
item.loc = loc |
내보내기 Unified diff