프로젝트

일반

사용자정보

개정판 653c5f56

ID653c5f5604a7bd0120d55907a5c7dc24de9cf438
상위 2d0ab83b
하위 90008bc3, 488ee1ca

함의성이(가) 5년 이상 전에 추가함

issue #563: add run sorting first step : sort using symbol in out info

Change-Id: I8786e4c7211fbf602871f4593f990cd4211e0f87

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
694 694
                lineNo.update_flow_mark(position, length)
695 695

  
696 696
        # sort run flow order
697
        fixed_run = []
698
        waiting_run = []
697
        fixed_runs = []
698
        waiting_runs = []
699 699
        runs = []
700 700
        # first step : make fixed run using opc
701 701
        for lineNo in [lineNo for lineNo in docdata.tracerLineNos if len(lineNo.runs) > 0]:
......
704 704
            for run in lineNo.runs:
705 705
                not_secondary = True if run_index is 0 else False
706 706
                # runs can know flow directly
707
                if len(run.items) > 1 and (type(run.items[0]) is QEngineeringOPCItem or type(run.items[-1]) is QEngineeringOPCItem):
708
                    if type(run.items[0]) is QEngineeringOPCItem and run.items[0].connectors[0].connectedItem:
709
                        if not_trim and not_secondary:
710
                            lineNo.reverse()
711
                        else:
712
                            run.reverse()
713
                    elif type(run.items[-1]) is QEngineeringOPCItem and run.items[-1].connectors[1].connectedItem:
714
                        if not_trim and not_secondary:
715
                            lineNo.reverse()
716
                        else:
717
                            run.reverse()
718
                    fixed_run.append([run, lineNo, not_trim, not_secondary])
719 707

  
708
                reference_symbols = [item for item in run.items if issubclass(type(item), SymbolSvgItem) and item.has_in_out_connector()]
709
                if len(run.items) > 1 and len(reference_symbols) > 0:
710
                    for reference_symbol in reference_symbols:
711
                        reference_symbol_index = run.items.index(reference_symbol)
712
                        # place at first
713
                        if reference_symbol is run.items[0]:
714
                            if len([connector_index for connector_index in reference_symbol.in_out_connector[0] \
715
                                            if reference_symbol.connectors[connector_index].connectedItem is run.items[1]]) > 0:
716
                                if not_trim and not_secondary:
717
                                    lineNo.reverse()
718
                                else:
719
                                    run.reverse()
720
                                fixed_runs.append([run, lineNo, not_trim, not_secondary])
721
                                break
722
                            elif len([connector_index for connector_index in reference_symbol.in_out_connector[1] \
723
                                            if reference_symbol.connectors[connector_index].connectedItem is run.items[1]]) > 0:
724
                                fixed_runs.append([run, lineNo, not_trim, not_secondary])
725
                                break
726
                        # place at last
727
                        elif reference_symbol is run.items[-1]:
728
                            if len([connector_index for connector_index in reference_symbol.in_out_connector[1] \
729
                                            if reference_symbol.connectors[connector_index].connectedItem is run.items[-2]]) > 0:
730
                                if not_trim and not_secondary:
731
                                    lineNo.reverse()
732
                                else:
733
                                    run.reverse()
734
                                fixed_runs.append([run, lineNo, not_trim, not_secondary])
735
                                break
736
                            elif len([connector_index for connector_index in reference_symbol.in_out_connector[0] \
737
                                            if reference_symbol.connectors[connector_index].connectedItem is run.items[1]]) > 0:
738
                                fixed_runs.append([run, lineNo, not_trim, not_secondary])
739
                                break
740
                        # place at middle
741
                        else:
742
                            in_items = [reference_symbol.connectors[connector_index].connectedItem for connector_index in reference_symbol.in_out_connector[0] \
743
                                        if reference_symbol.connectors[connector_index].connectedItem in run.items]
744
                            out_items = [reference_symbol.connectors[connector_index].connectedItem for connector_index in reference_symbol.in_out_connector[1] \
745
                                        if reference_symbol.connectors[connector_index].connectedItem in run.items]
746
                            in_item = in_items[0] if in_items else None
747
                            out_item = out_items[0] if out_items else None
748
                            if in_item and out_item:
749
                                in_item_index = run.items.index(in_item)
750
                                out_item_index = run.items.index(out_item)
751
                                if out_item_index < in_item_index:
752
                                    if not_trim and not_secondary:
753
                                        lineNo.reverse()
754
                                    else:
755
                                        run.reverse()
756
                                    fixed_runs.append([run, lineNo, not_trim, not_secondary])
757
                                    break
758
                    waiting_runs.append([run, lineNo, not_trim, not_secondary])
720 759
                # only symbol runs doesn't need flow
721 760
                elif (len(run.items) is 1 and issubclass(type(run.items[0]), SymbolSvgItem)) or \
722 761
                        len([not_symbol for not_symbol in run.items if not issubclass(type(item), SymbolSvgItem)]) is 0:
723 762
                    runs.append([run, lineNo, not_trim, not_secondary])
724 763
                # runs can't know flow directly
725 764
                else:
726
                    waiting_run.append([run, lineNo, not_trim, not_secondary])
765
                    waiting_runs.append([run, lineNo, not_trim, not_secondary])
727 766
                run_index += 1
728 767

  
729 768
        # second step : determine waiting run flow
769
        #remain_run = True
770
        #while remain_run:
771
        #    for run_index in reversed(range(len(waiting_runs))):
772
        #        for fixed_run in fixed_runs:
730 773
        
731 774

  
732 775
        # trace special item
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
95 95
        configs = app_doc_data.getConfigs('Symbol Style', 'Opacity')
96 96
        self.setOpacity(float(configs[0].value) / 100 if configs else 0.5)
97 97

  
98
    def has_in_out_connector(self):
99
        """ return True if item has in or out connector """
100
        if len(self.in_out_connector[0]) > 0 and len(self.in_out_connector[1]) > 0:
101
            return True
102
        else:
103
            return False
104

  
105
    def has_break_connector(self):
106
        """ return True if item has break connector """
107
        if len(self.break_connector) > 0:
108
            return True
109
        else:
110
            return False
111

  
98 112
    def __str__(self):
99 113
        """ return string represent uuid """
100 114
        return str(self.uid)
DTI_PID/DTI_PID/SymbolEditorDialog.py
1006 1006
            infoTitle = self.ui.originalPointLabel.text()
1007 1007
            return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
1008 1008

  
1009
        #if not (self.ui.tableWidgetConnList.rowCount() > 0):
1010
        #    infoTitle = self.ui.connectionPointLabel.text()
1011
        #    return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
1009
        if self.ui.tableWidgetConnList.rowCount() > 1:
1010
            infoTitle = self.ui.connectionPointLabel.text()
1011
            in_conn = False
1012
            out_conn = False
1013
            for index in range(self.ui.tableWidgetConnList.rowCount()):
1014
                if self.ui.tableWidgetConnList.cellWidget(index, 3).currentText() == 'In':
1015
                    in_conn = True
1016
                elif self.ui.tableWidgetConnList.cellWidget(index, 3).currentText() == 'Out':
1017
                    out_conn = True
1018
            if in_conn != out_conn:
1019
                return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
1012 1020
            
1013 1021
        return True, None
1014 1022

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)