개정판 1ddf0866
issue #563: testing split run sorting and final step remain
Change-Id: I8683359151d5a327a3ca461757bb72744e4122be
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
917 | 917 |
remain_count_past = remain_count |
918 | 918 |
|
919 | 919 |
# fourth step : body connected split run or split owner run sort |
920 |
fixed_merged_run_infos = [] |
|
921 |
waiting_merged_run_infos = [] |
|
920 |
fixed_merged_run_infos = [] # [[run_info1, run_info2, ... in order], [merged run items]] |
|
921 |
waiting_merged_run_infos = [] # [[run_info1, run_info2, ... in order], [merged run items]] |
|
922 |
|
|
923 |
# waiting run merge and sort |
|
922 | 924 |
consumed_count_past = 0 |
923 | 925 |
for index1 in range(len(waiting_run_infos)): |
924 | 926 |
if waiting_run_infos[index1].consumed: |
... | ... | |
927 | 929 |
if index1 == index2 or waiting_run_infos[index2].consumed: |
928 | 930 |
continue |
929 | 931 |
|
930 |
result, merged_run_info, header = QEngineeringLineTracerRunItem.merge_and_sort_if_possible(waiting_run_infos[index1], waiting_run_infos[index2]) |
|
932 |
result, merged_run_info, header, reverse = QEngineeringLineTracerRunItem.merge_and_sort_if_possible(waiting_run_infos[index1], waiting_run_infos[index2])
|
|
931 | 933 |
if result: |
932 | 934 |
waiting_run_infos[index1].consumed = True |
933 | 935 |
waiting_run_infos[index2].consumed = True |
934 | 936 |
consumed_count_past += 2 |
935 | 937 |
if header: |
936 |
waiting_merged_run_infos.append([[index2, index1], merged_run_info])
|
|
938 |
waiting_merged_run_infos.append([[waiting_run_infos[index2], waiting_run_infos[index1]], merged_run_info])
|
|
937 | 939 |
else: |
938 |
waiting_merged_run_infos.append([[index1, index2], merged_run_info])
|
|
940 |
waiting_merged_run_infos.append([[waiting_run_infos[index1], waiting_run_infos[index2]], merged_run_info])
|
|
939 | 941 |
break |
940 | 942 |
|
941 | 943 |
while True: |
... | ... | |
946 | 948 |
continue |
947 | 949 |
|
948 | 950 |
for waiting_merged_run_info in waiting_merged_run_infos: |
949 |
result, merged_run_info, header = QEngineeringLineTracerRunItem.merge_and_sort_if_possible(waiting_merged_run_info[1], waiting_run_infos[index]) |
|
951 |
result, merged_run_info, header, reverse = QEngineeringLineTracerRunItem.merge_and_sort_if_possible(waiting_merged_run_info[1], waiting_run_infos[index])
|
|
950 | 952 |
if result: |
951 | 953 |
waiting_run_infos[index].consumed = True |
952 | 954 |
consumed_count += 1 |
953 | 955 |
if header: |
954 |
waiting_merged_run_info[0].insert(0, index)
|
|
956 |
waiting_merged_run_info[0].insert(0, waiting_run_infos[index])
|
|
955 | 957 |
waiting_merged_run_info[1] = merged_run_info |
956 | 958 |
else: |
957 |
waiting_merged_run_info[0].append(index)
|
|
959 |
waiting_merged_run_info[0].append(waiting_run_infos[index])
|
|
958 | 960 |
waiting_merged_run_info[1] = merged_run_info |
961 |
break |
|
959 | 962 |
|
960 | 963 |
if consumed_count_past == consumed_count: |
961 | 964 |
break |
962 | 965 |
else: |
963 | 966 |
consumed_count_past = consumed_count |
964 | 967 |
|
968 |
while True: |
|
969 |
merged = False |
|
970 |
for index1 in range(len(waiting_merged_run_infos)): |
|
971 |
waiting_merged_run_info1 = waiting_merged_run_infos[index1] |
|
972 |
for index2 in range(len(waiting_merged_run_infos)): |
|
973 |
if index1 == index2: |
|
974 |
continue |
|
975 |
waiting_merged_run_info2 = waiting_merged_run_infos[index2] |
|
976 |
result, merged_run_info, header, reverse = QEngineeringLineTracerRunItem.merge_and_sort_if_possible(waiting_merged_run_info1[1], waiting_merged_run_info2[1]) |
|
977 |
if result: |
|
978 |
if header: |
|
979 |
if reverse: |
|
980 |
for waiting_run_info in waiting_merged_run_info2[0]: |
|
981 |
waiting_run_info.reverse() |
|
982 |
waiting_merged_run_info2[0].reverse() |
|
983 |
waiting_merged_run_info2[0].extend(waiting_merged_run_info1[0]) |
|
984 |
waiting_merged_run_info1[0] = waiting_merged_run_info2[0] |
|
985 |
waiting_merged_run_info1[1] = merged_run_info |
|
986 |
else: |
|
987 |
if reverse: |
|
988 |
for waiting_run_info in waiting_merged_run_info2[0]: |
|
989 |
waiting_run_info.reverse() |
|
990 |
waiting_merged_run_info2[0].reverse() |
|
991 |
waiting_merged_run_info1[0].extend(waiting_merged_run_info2[0]) |
|
992 |
waiting_merged_run_info1[1] = merged_run_info |
|
993 |
merged = True |
|
994 |
break |
|
995 |
if merged: |
|
996 |
waiting_merged_run_infos.pop(index2) |
|
997 |
break |
|
998 |
if not merged: |
|
999 |
break |
|
1000 |
|
|
1001 |
# fixed run merge |
|
1002 |
consumed_count_past = 0 |
|
1003 |
|
|
1004 |
|
|
965 | 1005 |
except Exception as ex: |
966 | 1006 |
from App import App |
967 | 1007 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
1113 | 1113 |
if matches: |
1114 | 1114 |
indices[1] = 1 if QPointF(matches[0].center()[0], matches[0].center()[ |
1115 | 1115 |
1]) == connector.connectedItem.line().p1() else 2 |
1116 |
else: |
|
1117 |
error = SymbolSvgItem.createItem('Error', dataPath) |
|
1118 |
error.setPosition(connector.center()) |
|
1119 |
error.parent = self |
|
1120 |
error.msg = _translate('disconnected from opposite side', 'disconnected from opposite side') |
|
1121 |
error.setToolTip(error.msg) |
|
1122 |
error.area = 'Drawing' |
|
1123 |
error.name = 'Error' |
|
1124 |
errors.append(error) |
|
1116 | 1125 |
|
1117 | 1126 |
if indices[0] == indices[1]: |
1118 | 1127 |
error = SymbolSvgItem.createItem('Error', dataPath) |
DTI_PID/DTI_PID/Shapes/EngineeringLineTracerRunItem.py | ||
---|---|---|
43 | 43 |
connected = False |
44 | 44 |
merged_items = [] |
45 | 45 |
header = False |
46 |
reverse = False |
|
46 | 47 |
merged_Tracer = None |
47 | 48 |
|
48 |
if run_info1.run.items[-1].is_connected(run_info2.run.items[0]): |
|
49 |
if (len(run_info1.run.items) > 1 and len(run_info2.run.items) > 1 and run_info1.run.items[-1].is_connected(run_info2.run.items[0])) or \ |
|
50 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) > 1 and run_info1.run.items[0].connectors[1].connectedItem is run_info2.run.items[0]) or \ |
|
51 |
(len(run_info1.run.items) > 1 and len(run_info2.run.items) == 1 and run_info2.run.items[0].connectors[0].connectedItem is run_info1.run.items[-1]) or \ |
|
52 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) == 1 and run_info1.run.items[0].connectors[1].connectedItem is run_info2.run.items[0] and \ |
|
53 |
run_info2.run.items[0].connectors[0].connectedItem is run_info1.run.items[0]): |
|
49 | 54 |
connected = True |
50 | 55 |
header = False |
56 |
reverse = False |
|
51 | 57 |
merged_items = run_info1.run.items + run_info2.run.items |
52 |
elif run_info1.run.items[-1].is_connected(run_info2.run.items[-1]): |
|
58 |
elif (len(run_info1.run.items) > 1 and len(run_info2.run.items) > 1 and run_info1.run.items[-1].is_connected(run_info2.run.items[-1])) or \ |
|
59 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) > 1 and run_info1.run.items[0].connectors[1].connectedItem is run_info2.run.items[-1]) or \ |
|
60 |
(len(run_info1.run.items) > 1 and len(run_info2.run.items) == 1 and run_info2.run.items[0].connectors[1].connectedItem is run_info1.run.items[-1]) or \ |
|
61 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) == 1 and run_info1.run.items[0].connectors[1].connectedItem is run_info2.run.items[0] and \ |
|
62 |
run_info2.run.items[0].connectors[1].connectedItem is run_info1.run.items[0]): |
|
53 | 63 |
connected = True |
54 | 64 |
header = False |
65 |
reverse = True |
|
55 | 66 |
run_info2.reverse() |
56 | 67 |
merged_items = run_info1.run.items + run_info2.run.items |
57 |
elif run_info1.run.items[0].is_connected(run_info2.run.items[-1]): |
|
68 |
elif (len(run_info1.run.items) > 1 and len(run_info2.run.items) > 1 and run_info1.run.items[0].is_connected(run_info2.run.items[-1])) or \ |
|
69 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) > 1 and run_info1.run.items[0].connectors[0].connectedItem is run_info2.run.items[-1]) or \ |
|
70 |
(len(run_info1.run.items) > 1 and len(run_info2.run.items) == 1 and run_info2.run.items[0].connectors[1].connectedItem is run_info1.run.items[-1]) or \ |
|
71 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) == 1 and run_info1.run.items[0].connectors[0].connectedItem is run_info2.run.items[0] and \ |
|
72 |
run_info2.run.items[0].connectors[1].connectedItem is run_info1.run.items[0]): |
|
58 | 73 |
connected = True |
59 | 74 |
header = True |
75 |
reverse = False |
|
60 | 76 |
merged_items = run_info2.run.items + run_info1.run.items |
61 |
elif run_info1.run.items[0].is_connected(run_info2.run.items[0]): |
|
77 |
elif (len(run_info1.run.items) > 1 and len(run_info2.run.items) > 1 and run_info1.run.items[0].is_connected(run_info2.run.items[0])) or \ |
|
78 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) > 1 and run_info1.run.items[0].connectors[0].connectedItem is run_info2.run.items[0]) or \ |
|
79 |
(len(run_info1.run.items) > 1 and len(run_info2.run.items) == 1 and run_info2.run.items[0].connectors[0].connectedItem is run_info1.run.items[0]) or \ |
|
80 |
(len(run_info1.run.items) == 1 and len(run_info2.run.items) == 1 and run_info1.run.items[0].connectors[0].connectedItem is run_info2.run.items[0] and \ |
|
81 |
run_info2.run.items[0].connectors[0].connectedItem is run_info1.run.items[0]): |
|
62 | 82 |
connected = True |
63 | 83 |
header = True |
84 |
reverse = True |
|
64 | 85 |
run_info2.reverse() |
65 | 86 |
merged_items = run_info2.run.items + run_info1.run.items |
66 | 87 |
|
... | ... | |
69 | 90 |
merged_run.items = merged_items |
70 | 91 |
merged_Tracer = QEngineeringLineTracerRunItem(merged_run) |
71 | 92 |
|
72 |
return connected, merged_Tracer, header |
|
93 |
return connected, merged_Tracer, header, reverse
|
|
73 | 94 |
|
74 | 95 |
@staticmethod |
75 | 96 |
def merge_if_possible(run_info1, run_info2): |
내보내기 Unified diff