修复了第一个塔不是耐张塔时计算累加高差和档距的bug。

This commit is contained in:
n3040 2023-01-26 03:43:36 +08:00
parent 034ba492c7
commit 475ce6c367
1 changed files with 17 additions and 8 deletions

View File

@ -220,7 +220,11 @@ class StringImpactPlate:
tower_key_list = list(tower_dict.keys())
try:
index_of_first_tower = tower_key_list.index(start_tower_name)
index.append(index_of_first_tower)
if (
tower_dict[tower_key_list[index_of_first_tower]].is_tension_tower
== True
):
index.append(index_of_first_tower)
except ValueError: # 没找到第一个塔,就直接返回
return index
try:
@ -234,7 +238,8 @@ class StringImpactPlate:
== True
):
index.append(index_of_tension_tower)
index.append(index_of_last_tower)
if tower_dict[tower_key_list[index_of_last_tower]].is_tension_tower == True:
index.append(index_of_last_tower)
except ValueError: # 没找到最后一个塔,就只画一个耐张段
for index_of_tension_tower in range(
index_of_first_tower + 1, len(tower_key_list)
@ -296,7 +301,9 @@ class StringImpactPlate:
for draw_tower_index in draw_tower_indexes:
draw_tower_key = tower_key_list[draw_tower_index]
tower_info: SEntry = tower_dict[draw_tower_key]
if draw_tower_index != draw_tower_indexes[-1]: # 不是最后一个
if draw_tower_index < tower_key_list.index(
self._draw_end_tower_name
): # 不是最后一个,或者只有第一个。
# 画前侧
forth_reprtv_span = tower_info.forth_representive_span
continouse_sheet.range("B69").value = forth_reprtv_span
@ -330,7 +337,7 @@ class StringImpactPlate:
plate_origin[0]
+ (
tower_dict[tower_key_list[draw_tower_index]].mileage_in_s
- tower_dict[tower_key_list[draw_tower_indexes[0]]].mileage_in_s
- tower_dict[self._draw_start_tower_name].mileage_in_s
)
/ 5
+ x / 5
@ -339,7 +346,7 @@ class StringImpactPlate:
[
tower_dict[tower_key_list[bar]].altitude_off
for bar in range(
draw_tower_indexes[0] + 1, draw_tower_index + 1
tower_key_list.index(self._draw_start_tower_name) + 1, draw_tower_index + 1
)
]
)
@ -349,7 +356,9 @@ class StringImpactPlate:
+ (tower_info.tower_height - tower_info.foundation_low + y) * 2
).reshape(len(x), 1)
self._plot(cad, plot_x, plot_y)
if draw_tower_index != draw_tower_indexes[0]: # 不是第一个
if draw_tower_index > tower_key_list.index(
self._draw_start_tower_name
): # 不是第一个,或者只有最后一个
# 画后侧
back_reprtv_span = tower_info.back_representive_span
continouse_sheet.range("B69").value = back_reprtv_span
@ -383,7 +392,7 @@ class StringImpactPlate:
plate_origin[0]
+ (
tower_dict[tower_key_list[draw_tower_index]].mileage_in_s
- tower_dict[tower_key_list[draw_tower_indexes[0]]].mileage_in_s
- tower_dict[self._draw_start_tower_name].mileage_in_s
)
/ 5
- x / 5 # 从右往左画
@ -392,7 +401,7 @@ class StringImpactPlate:
[
tower_dict[tower_key_list[bar]].altitude_off
for bar in range(
draw_tower_indexes[0] + 1, draw_tower_index + 1
tower_key_list.index(self._draw_start_tower_name) + 1, draw_tower_index + 1
)
]
)