개정판 d8b3de8d
issue #563: separate make spec break
Change-Id: Ieb9fed9198b5243fcf8d27de5c3aa94537420c0d
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
445 | 445 |
kyouho 2018.09.14 clear Item's owner |
446 | 446 |
''' |
447 | 447 |
|
448 |
|
|
449 | 448 |
def connectAttrImpl(worker, update_line_type, update_flow_mark, update_spec): |
450 |
import os, math
|
|
449 |
import os |
|
451 | 450 |
from App import App |
452 | 451 |
import uuid |
453 | 452 |
from LineNoTracer import LineNoTracer |
... | ... | |
719 | 718 |
QApplication.processEvents() |
720 | 719 |
""" update spec break """ |
721 | 720 |
if update_spec: |
722 |
freezed_spec_breaks = [] |
|
723 |
for spec_break in spec_breaks: |
|
724 |
if not spec_break.prop('Freeze'): |
|
725 |
spec_break.transfer.onRemoved.emit(spec_break) |
|
726 |
else: |
|
727 |
freezed_spec_breaks.append(spec_break) |
|
728 |
|
|
729 |
for line in lines: |
|
730 |
line.clear_labels() |
|
731 |
|
|
732 |
spec_break_names = docdata.getSymbolListByType('type', 'Segment Breaks') |
|
733 |
if len(spec_break_names) is not 0: |
|
734 |
configs = AppDocData.instance().getConfigs('Range', 'Detection Ratio') |
|
735 |
ratio = float(configs[0].value) if 1 == len(configs) else 1.5 |
|
736 |
ratio *= 2 |
|
737 |
|
|
738 |
svgFileName = spec_break_names[0].sName |
|
739 |
symbol = docdata.getSymbolByQuery('name', svgFileName) |
|
740 |
svgFilePath = os.path.join(docdata.getCurrentProject().getSvgFilePath(), symbol.getType(), |
|
741 |
svgFileName + '.svg') |
|
742 |
|
|
743 |
specBreakAttrsFull = [attr for attr in docdata.getSymbolAttribute('Segment Breaks') if |
|
744 |
attr.Target == 'ALL' and ( |
|
745 |
attr.AttributeType == 'Spec' or attr.AttributeType == 'String')] |
|
746 |
specBreakAttrs = [attr.Attribute for attr in specBreakAttrsFull] |
|
747 |
|
|
748 |
line_ends = [] |
|
749 |
# append upstream first and append downstream |
|
750 |
for lineNo in lineNos: |
|
751 |
for run in lineNo.runs: |
|
752 |
line_ends.append(run.items[0]) if issubclass(type(run.items[0]), SymbolSvgItem) or ( |
|
753 |
type(run.items[0]) is QEngineeringLineItem and ( |
|
754 |
run.items[0].lineType == 'Secondary' or run.items[ |
|
755 |
0].lineType == 'Primary')) else None |
|
756 |
for lineNo in lineNos: |
|
757 |
for run in lineNo.runs: |
|
758 |
if run.items[0] is not run.items[-1]: |
|
759 |
line_ends.append(run.items[-1]) if issubclass(type(run.items[-1]), SymbolSvgItem) or ( |
|
760 |
type(run.items[-1]) is QEngineeringLineItem and ( |
|
761 |
run.items[-1].lineType == 'Secondary' or run.items[ |
|
762 |
-1].lineType == 'Primary')) else None |
|
763 |
|
|
764 |
spec_breaks = [] |
|
765 |
for line_end in line_ends: |
|
766 |
for connector in line_end.connectors: |
|
767 |
if connector.connectedItem is not None and type( |
|
768 |
connector.connectedItem.owner) is QEngineeringLineNoTextItem and connector.connectedItem.owner is not line_end.owner: |
|
769 |
spec_break = [] # upstream, downstream, [spec, up value, down value], ... , [ ... ] |
|
770 |
match = False |
|
771 |
for prop, value in [[prop, value] for prop, value in line_end.owner.getAttributes().items() |
|
772 |
if prop.Attribute in specBreakAttrs]: |
|
773 |
for prop2, value2 in [[prop2, value2] for prop2, value2 in |
|
774 |
connector.connectedItem.owner.getAttributes().items() if |
|
775 |
prop2.Attribute in specBreakAttrs and prop2.UID == prop.UID]: |
|
776 |
if str(prop.UID) == str(prop2.UID) and value != value2: |
|
777 |
if not match: |
|
778 |
spec_break.extend([line_end, connector.connectedItem]) |
|
779 |
match = True |
|
780 |
spec_break.append([prop.Attribute, value, value2]) |
|
781 |
if match: |
|
782 |
spec_breaks.append(spec_break) |
|
783 |
|
|
784 |
if spec_breaks: |
|
785 |
# check duplication |
|
786 |
dupl = set() |
|
787 |
for i in range(len(spec_breaks)): |
|
788 |
for j in range(len(spec_breaks)): |
|
789 |
if i == j: |
|
790 |
continue |
|
791 |
else: |
|
792 |
setI = set([spec_breaks[i][0], spec_breaks[i][1]]) |
|
793 |
setJ = set([spec_breaks[j][0], spec_breaks[j][1]]) |
|
794 |
if not (setI - setJ): |
|
795 |
index = [i, j] |
|
796 |
index.sort() |
|
797 |
index = tuple(index) |
|
798 |
dupl.add(index) |
|
799 |
dupl = list(set([(indexSet[1]) for indexSet in list(dupl)])) |
|
800 |
dupl.sort(reverse=True) |
|
801 |
for index in dupl: |
|
802 |
spec_breaks.pop(index) |
|
803 |
# up to here |
|
804 |
|
|
805 |
spec_break_items = [] |
|
806 |
for spec in spec_breaks: |
|
807 |
dupl = False |
|
808 |
for freezed in freezed_spec_breaks: |
|
809 |
freezed_attrs = freezed.getAttributes() |
|
810 |
up = [attr.AssocItem for attr in freezed_attrs if attr.Attribute == 'UpStream'] |
|
811 |
down = [attr.AssocItem for attr in freezed_attrs if attr.Attribute == 'DownStream'] |
|
812 |
if up and down: |
|
813 |
if (up[0] is spec[0] and down[0] is spec[1]) or ( |
|
814 |
up[0] is spec[1] and down[0] is spec[0]): |
|
815 |
dupl = True |
|
816 |
break |
|
817 |
if dupl: |
|
818 |
continue |
|
819 |
|
|
820 |
for connector in spec[0].connectors: |
|
821 |
if connector.connectedItem is spec[1]: |
|
822 |
spec_break = SymbolSvgItem.createItem(symbol.getType(), None, svgFilePath) |
|
823 |
pt = [60 + connector.center()[0] - float(symbol.getOriginalPoint().split(',')[0]), |
|
824 |
90 + connector.center()[1] - float(symbol.getOriginalPoint().split(',')[1])] |
|
825 |
origin = [0, 0] |
|
826 |
if 2 == len(symbol.getOriginalPoint().split(',')): |
|
827 |
tokens = symbol.getOriginalPoint().split(',') |
|
828 |
origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])] |
|
829 |
spec_break.buildItem(svgFileName, symbol.getType(), 0.0, pt, |
|
830 |
[spec_break.boundingRect().width(), |
|
831 |
spec_break.boundingRect().height()], origin, [], |
|
832 |
symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), |
|
833 |
symbol.getHasInstrumentLabel()) |
|
834 |
|
|
835 |
attrs = spec_break.getAttributes() |
|
836 |
for key in attrs.keys(): |
|
837 |
if key.Attribute == 'UpStream': |
|
838 |
attrs[key] = str(spec[0]) |
|
839 |
spec_break.add_assoc_item(spec[0], key.AttrAt, force=True) |
|
840 |
key.AssocItem = spec[0] |
|
841 |
elif key.Attribute == 'DownStream': |
|
842 |
attrs[key] = str(spec[1]) |
|
843 |
spec_break.add_assoc_item(spec[1], key.AttrAt, force=True) |
|
844 |
key.AssocItem = spec[1] |
|
845 |
|
|
846 |
for attr, value, value2 in spec[2:]: |
|
847 |
for full in specBreakAttrsFull: |
|
848 |
if full.Attribute == attr: |
|
849 |
attrs[full] = [value, value2] |
|
850 |
|
|
851 |
# find label text for spec break line |
|
852 |
stream_line = [spec[0], spec[1]] |
|
853 |
stream_track = [spec[1], spec[0]] |
|
854 |
stream_res = [False, False] |
|
855 |
for index in range(len(stream_line)): |
|
856 |
while True: |
|
857 |
if type(stream_line[index]) is QEngineeringLineItem: |
|
858 |
stream_res[index] = True |
|
859 |
break |
|
860 |
else: |
|
861 |
find_next = False |
|
862 |
connected_count = 0 |
|
863 |
for connectorr in stream_line[index].connectors: |
|
864 |
connected_count += 1 |
|
865 |
if connectorr.connectedItem and stream_track[ |
|
866 |
index] is not connectorr.connectedItem and stream_line[ |
|
867 |
index].next_connected(stream_track[index], |
|
868 |
connectorr.connectedItem): |
|
869 |
stream_track[index] = stream_line[index] |
|
870 |
stream_line[index] = connectorr.connectedItem |
|
871 |
find_next = True |
|
872 |
break |
|
873 |
|
|
874 |
if not find_next: |
|
875 |
# prevent infinite loop |
|
876 |
if connected_count == 2: |
|
877 |
for connectorr in stream_line[index].connectors: |
|
878 |
if connectorr.connectedItem and not connectorr.connectedItem is \ |
|
879 |
stream_track[index]: |
|
880 |
stream_line[index] = connectorr.connectedItem |
|
881 |
stream_track[index] = stream_line[index] |
|
882 |
find_next = True |
|
883 |
break |
|
884 |
if not find_next: |
|
885 |
break |
|
886 |
else: |
|
887 |
break |
|
888 |
|
|
889 |
if stream_res[0] and stream_res[1]: |
|
890 |
texts = [item for item in worker.scene.items() if |
|
891 |
type(item) is QEngineeringTextItem and item.owner is None] |
|
892 |
positioning = False |
|
893 |
|
|
894 |
for attr, value, value2 in spec[2:]: |
|
895 |
up_texts = [text for text in texts if text.text() == value] |
|
896 |
down_texts = [text for text in texts if text.text() == value2] |
|
897 |
up_down_texts = [up_texts, down_texts] |
|
898 |
up_down_find = [None, None] |
|
899 |
|
|
900 |
for index in range(len(up_down_texts)): |
|
901 |
minDist = sys.maxsize |
|
902 |
|
|
903 |
for up_down_text in up_down_texts[index]: |
|
904 |
dx = connector.center()[0] - up_down_text.center().x() |
|
905 |
dy = connector.center()[1] - up_down_text.center().y() |
|
906 |
dist = ( |
|
907 |
up_down_text.sceneBoundingRect().height() + up_down_text.sceneBoundingRect().width()) * ratio / 2 |
|
908 |
length = math.sqrt(dx * dx + dy * dy) |
|
909 |
if length < dist and length < minDist: |
|
910 |
up_down_find[index] = up_down_text |
|
911 |
|
|
912 |
if up_down_find[0] and up_down_find[1]: |
|
913 |
for index in range(len(stream_line)): |
|
914 |
attrs = stream_line[index].getAttributes() |
|
915 |
for key in attrs.keys(): |
|
916 |
if key.Attribute == attr: |
|
917 |
attrs[key] = up_down_find[index].text() |
|
918 |
key.AssocItem = up_down_find[index] |
|
919 |
stream_line[index].add_assoc_item(up_down_find[index], |
|
920 |
key.AttrAt, force=True) |
|
921 |
up_down_find[index].owner = stream_line[index] |
|
922 |
break |
|
923 |
|
|
924 |
if not positioning: |
|
925 |
# set spec break position between |
|
926 |
positioning = True |
|
927 |
new_x = round( |
|
928 |
(up_down_find[0].center().x() + up_down_find[1].center().x()) / 2) |
|
929 |
new_y = round( |
|
930 |
(up_down_find[0].center().y() + up_down_find[1].center().y()) / 2) |
|
931 |
spec_break.loc = [new_x - spec_break.symbolOrigin[0], |
|
932 |
new_y - spec_break.symbolOrigin[1]] |
|
933 |
spec_break.origin = [new_x, new_y] |
|
934 |
if abs(up_down_find[0].center().x() - up_down_find[ |
|
935 |
1].center().x()) < abs( |
|
936 |
up_down_find[0].center().y() - up_down_find[1].center().y()): |
|
937 |
spec_break.angle = 1.57 |
|
938 |
else: |
|
939 |
spec_break.angle = 3.14 |
|
940 |
|
|
941 |
spec_break_items.append(spec_break) |
|
942 |
|
|
943 |
for spec_break_item in spec_break_items: |
|
944 |
spec_break_item.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
|
945 |
spec_break_item.addSvgItemToScene(worker.scene) |
|
946 |
|
|
947 |
spec_break_items.extend(freezed_spec_breaks) |
|
721 |
make_spec(worker, spec_breaks, lines, lineNos) |
|
948 | 722 |
|
949 | 723 |
worker.updateProgress.emit(tracer.maxValue) |
950 | 724 |
|
... | ... | |
978 | 752 |
(type1, value, traceback) = sys.exc_info() |
979 | 753 |
sys.excepthook(type1, value, traceback) |
980 | 754 |
|
755 |
def make_spec(worker, spec_breaks, lines, lineNos): |
|
756 |
''' update spec break ''' |
|
757 |
|
|
758 |
from App import App |
|
759 |
import os, math |
|
760 |
|
|
761 |
try: |
|
762 |
docdata = AppDocData.instance() |
|
763 |
|
|
764 |
freezed_spec_breaks = [] |
|
765 |
for spec_break in spec_breaks: |
|
766 |
if not spec_break.prop('Freeze'): |
|
767 |
spec_break.transfer.onRemoved.emit(spec_break) |
|
768 |
else: |
|
769 |
freezed_spec_breaks.append(spec_break) |
|
770 |
|
|
771 |
for line in lines: |
|
772 |
line.clear_labels() |
|
773 |
|
|
774 |
spec_break_names = docdata.getSymbolListByType('type', 'Segment Breaks') |
|
775 |
if len(spec_break_names) is not 0: |
|
776 |
configs = docdata.getConfigs('Range', 'Detection Ratio') |
|
777 |
ratio = float(configs[0].value) if 1 == len(configs) else 1.5 |
|
778 |
ratio *= 2 |
|
779 |
|
|
780 |
svgFileName = spec_break_names[0].sName |
|
781 |
symbol = docdata.getSymbolByQuery('name', svgFileName) |
|
782 |
svgFilePath = os.path.join(docdata.getCurrentProject().getSvgFilePath(), symbol.getType(), |
|
783 |
svgFileName + '.svg') |
|
784 |
|
|
785 |
specBreakAttrsFull = [attr for attr in docdata.getSymbolAttribute('Segment Breaks') if |
|
786 |
attr.Target == 'ALL' and ( |
|
787 |
attr.AttributeType == 'Spec' or attr.AttributeType == 'String')] |
|
788 |
specBreakAttrs = [attr.Attribute for attr in specBreakAttrsFull] |
|
789 |
|
|
790 |
line_ends = [] |
|
791 |
# append upstream first and append downstream |
|
792 |
for lineNo in lineNos: |
|
793 |
for run in lineNo.runs: |
|
794 |
line_ends.append(run.items[0]) if issubclass(type(run.items[0]), SymbolSvgItem) or ( |
|
795 |
type(run.items[0]) is QEngineeringLineItem and ( |
|
796 |
run.items[0].lineType == 'Secondary' or run.items[ |
|
797 |
0].lineType == 'Primary')) else None |
|
798 |
for lineNo in lineNos: |
|
799 |
for run in lineNo.runs: |
|
800 |
if run.items[0] is not run.items[-1]: |
|
801 |
line_ends.append(run.items[-1]) if issubclass(type(run.items[-1]), SymbolSvgItem) or ( |
|
802 |
type(run.items[-1]) is QEngineeringLineItem and ( |
|
803 |
run.items[-1].lineType == 'Secondary' or run.items[ |
|
804 |
-1].lineType == 'Primary')) else None |
|
805 |
|
|
806 |
spec_breaks = [] |
|
807 |
for line_end in line_ends: |
|
808 |
for connector in line_end.connectors: |
|
809 |
if connector.connectedItem is not None and type( |
|
810 |
connector.connectedItem.owner) is QEngineeringLineNoTextItem and connector.connectedItem.owner is not line_end.owner: |
|
811 |
spec_break = [] # upstream, downstream, [spec, up value, down value], ... , [ ... ] |
|
812 |
match = False |
|
813 |
for prop, value in [[prop, value] for prop, value in line_end.owner.getAttributes().items() |
|
814 |
if prop.Attribute in specBreakAttrs]: |
|
815 |
for prop2, value2 in [[prop2, value2] for prop2, value2 in |
|
816 |
connector.connectedItem.owner.getAttributes().items() if |
|
817 |
prop2.Attribute in specBreakAttrs and prop2.UID == prop.UID]: |
|
818 |
if str(prop.UID) == str(prop2.UID) and value != value2: |
|
819 |
if not match: |
|
820 |
spec_break.extend([line_end, connector.connectedItem]) |
|
821 |
match = True |
|
822 |
spec_break.append([prop.Attribute, value, value2]) |
|
823 |
if match: |
|
824 |
spec_breaks.append(spec_break) |
|
825 |
|
|
826 |
if spec_breaks: |
|
827 |
# check duplication |
|
828 |
dupl = set() |
|
829 |
for i in range(len(spec_breaks)): |
|
830 |
for j in range(len(spec_breaks)): |
|
831 |
if i == j: |
|
832 |
continue |
|
833 |
else: |
|
834 |
setI = set([spec_breaks[i][0], spec_breaks[i][1]]) |
|
835 |
setJ = set([spec_breaks[j][0], spec_breaks[j][1]]) |
|
836 |
if not (setI - setJ): |
|
837 |
index = [i, j] |
|
838 |
index.sort() |
|
839 |
index = tuple(index) |
|
840 |
dupl.add(index) |
|
841 |
dupl = list(set([(indexSet[1]) for indexSet in list(dupl)])) |
|
842 |
dupl.sort(reverse=True) |
|
843 |
for index in dupl: |
|
844 |
spec_breaks.pop(index) |
|
845 |
# up to here |
|
846 |
|
|
847 |
spec_break_items = [] |
|
848 |
for spec in spec_breaks: |
|
849 |
dupl = False |
|
850 |
for freezed in freezed_spec_breaks: |
|
851 |
freezed_attrs = freezed.getAttributes() |
|
852 |
up = [attr.AssocItem for attr in freezed_attrs if attr.Attribute == 'UpStream'] |
|
853 |
down = [attr.AssocItem for attr in freezed_attrs if attr.Attribute == 'DownStream'] |
|
854 |
if up and down: |
|
855 |
if (up[0] is spec[0] and down[0] is spec[1]) or ( |
|
856 |
up[0] is spec[1] and down[0] is spec[0]): |
|
857 |
dupl = True |
|
858 |
break |
|
859 |
if dupl: |
|
860 |
continue |
|
861 |
|
|
862 |
for connector in spec[0].connectors: |
|
863 |
if connector.connectedItem is spec[1]: |
|
864 |
spec_break = SymbolSvgItem.createItem(symbol.getType(), None, svgFilePath) |
|
865 |
pt = [60 + connector.center()[0] - float(symbol.getOriginalPoint().split(',')[0]), |
|
866 |
90 + connector.center()[1] - float(symbol.getOriginalPoint().split(',')[1])] |
|
867 |
origin = [0, 0] |
|
868 |
if 2 == len(symbol.getOriginalPoint().split(',')): |
|
869 |
tokens = symbol.getOriginalPoint().split(',') |
|
870 |
origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])] |
|
871 |
spec_break.buildItem(svgFileName, symbol.getType(), 0.0, pt, |
|
872 |
[spec_break.boundingRect().width(), |
|
873 |
spec_break.boundingRect().height()], origin, [], |
|
874 |
symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), |
|
875 |
symbol.getHasInstrumentLabel()) |
|
876 |
|
|
877 |
attrs = spec_break.getAttributes() |
|
878 |
for key in attrs.keys(): |
|
879 |
if key.Attribute == 'UpStream': |
|
880 |
attrs[key] = str(spec[0]) |
|
881 |
spec_break.add_assoc_item(spec[0], key.AttrAt, force=True) |
|
882 |
key.AssocItem = spec[0] |
|
883 |
elif key.Attribute == 'DownStream': |
|
884 |
attrs[key] = str(spec[1]) |
|
885 |
spec_break.add_assoc_item(spec[1], key.AttrAt, force=True) |
|
886 |
key.AssocItem = spec[1] |
|
887 |
|
|
888 |
for attr, value, value2 in spec[2:]: |
|
889 |
for full in specBreakAttrsFull: |
|
890 |
if full.Attribute == attr: |
|
891 |
attrs[full] = [value, value2] |
|
892 |
|
|
893 |
# find label text for spec break line |
|
894 |
stream_line = [spec[0], spec[1]] |
|
895 |
stream_track = [spec[1], spec[0]] |
|
896 |
stream_res = [False, False] |
|
897 |
for index in range(len(stream_line)): |
|
898 |
while True: |
|
899 |
if type(stream_line[index]) is QEngineeringLineItem: |
|
900 |
stream_res[index] = True |
|
901 |
break |
|
902 |
else: |
|
903 |
find_next = False |
|
904 |
connected_count = 0 |
|
905 |
for connectorr in stream_line[index].connectors: |
|
906 |
connected_count += 1 |
|
907 |
if connectorr.connectedItem and stream_track[ |
|
908 |
index] is not connectorr.connectedItem and stream_line[ |
|
909 |
index].next_connected(stream_track[index], |
|
910 |
connectorr.connectedItem): |
|
911 |
stream_track[index] = stream_line[index] |
|
912 |
stream_line[index] = connectorr.connectedItem |
|
913 |
find_next = True |
|
914 |
break |
|
915 |
|
|
916 |
if not find_next: |
|
917 |
# prevent infinite loop |
|
918 |
if connected_count == 2: |
|
919 |
for connectorr in stream_line[index].connectors: |
|
920 |
if connectorr.connectedItem and not connectorr.connectedItem is \ |
|
921 |
stream_track[index]: |
|
922 |
stream_line[index] = connectorr.connectedItem |
|
923 |
stream_track[index] = stream_line[index] |
|
924 |
find_next = True |
|
925 |
break |
|
926 |
if not find_next: |
|
927 |
break |
|
928 |
else: |
|
929 |
break |
|
930 |
|
|
931 |
if stream_res[0] and stream_res[1]: |
|
932 |
texts = [item for item in worker.scene.items() if |
|
933 |
type(item) is QEngineeringTextItem and item.owner is None] |
|
934 |
positioning = False |
|
935 |
|
|
936 |
for attr, value, value2 in spec[2:]: |
|
937 |
up_texts = [text for text in texts if text.text() == value] |
|
938 |
down_texts = [text for text in texts if text.text() == value2] |
|
939 |
up_down_texts = [up_texts, down_texts] |
|
940 |
up_down_find = [None, None] |
|
941 |
|
|
942 |
for index in range(len(up_down_texts)): |
|
943 |
minDist = sys.maxsize |
|
944 |
|
|
945 |
for up_down_text in up_down_texts[index]: |
|
946 |
dx = connector.center()[0] - up_down_text.center().x() |
|
947 |
dy = connector.center()[1] - up_down_text.center().y() |
|
948 |
dist = ( |
|
949 |
up_down_text.sceneBoundingRect().height() + up_down_text.sceneBoundingRect().width()) * ratio / 2 |
|
950 |
length = math.sqrt(dx * dx + dy * dy) |
|
951 |
if length < dist and length < minDist: |
|
952 |
up_down_find[index] = up_down_text |
|
953 |
|
|
954 |
if up_down_find[0] and up_down_find[1]: |
|
955 |
for index in range(len(stream_line)): |
|
956 |
attrs = stream_line[index].getAttributes() |
|
957 |
for key in attrs.keys(): |
|
958 |
if key.Attribute == attr: |
|
959 |
attrs[key] = up_down_find[index].text() |
|
960 |
key.AssocItem = up_down_find[index] |
|
961 |
stream_line[index].add_assoc_item(up_down_find[index], |
|
962 |
key.AttrAt, force=True) |
|
963 |
up_down_find[index].owner = stream_line[index] |
|
964 |
break |
|
965 |
|
|
966 |
if not positioning: |
|
967 |
# set spec break position between |
|
968 |
positioning = True |
|
969 |
new_x = round( |
|
970 |
(up_down_find[0].center().x() + up_down_find[1].center().x()) / 2) |
|
971 |
new_y = round( |
|
972 |
(up_down_find[0].center().y() + up_down_find[1].center().y()) / 2) |
|
973 |
spec_break.loc = [new_x - spec_break.symbolOrigin[0], |
|
974 |
new_y - spec_break.symbolOrigin[1]] |
|
975 |
spec_break.origin = [new_x, new_y] |
|
976 |
if abs(up_down_find[0].center().x() - up_down_find[ |
|
977 |
1].center().x()) < abs( |
|
978 |
up_down_find[0].center().y() - up_down_find[1].center().y()): |
|
979 |
spec_break.angle = 1.57 |
|
980 |
else: |
|
981 |
spec_break.angle = 3.14 |
|
982 |
|
|
983 |
spec_break_items.append(spec_break) |
|
984 |
|
|
985 |
for spec_break_item in spec_break_items: |
|
986 |
spec_break_item.transfer.onRemoved.connect(App.mainWnd().itemRemoved) |
|
987 |
spec_break_item.addSvgItemToScene(worker.scene) |
|
988 |
|
|
989 |
spec_break_items.extend(freezed_spec_breaks) |
|
990 |
except Exception as ex: |
|
991 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
992 |
sys.exc_info()[-1].tb_lineno) |
|
993 |
worker.display_message.emit(message) |
|
994 |
|
|
981 | 995 |
def make_flow_mark(worker, lines): |
982 | 996 |
''' make flow mark ''' |
983 | 997 |
|
984 | 998 |
try: |
985 | 999 |
docdata = AppDocData.instance() |
986 |
|
|
1000 |
|
|
987 | 1001 |
for line in lines: |
988 | 1002 |
line.flowMark = None |
989 | 1003 |
# line.update_arrow() |
내보내기 Unified diff