프로젝트

일반

사용자정보

개정판 326dfc82

ID326dfc8279710f01b168f7e81e32b72070a1ca86
상위 96b89249
하위 c0fa4723

함의성이(가) 약 2년 전에 추가함

end break auto fill test

Change-Id: I94e8191da76ff3641dae1ee136ecae9e6561f084

차이점 보기:

DTI_PID/DTI_PID/ImportTextFromCADDialog.py
1294 1294
            _height = abs(max_extents[1] - min_extents[1])
1295 1295
            _width = abs(max_extents[0] - min_extents[0])
1296 1296

  
1297
            '''
1297 1298
            allowed_error = 0.01
1298 1299
            if abs(angle - 1.57) < allowed_error:
1299 1300
                _height, _width = _width, _height
......
1301 1302
            elif abs(angle - 4.71) < allowed_error:
1302 1303
                _height, _width = _width, _height
1303 1304
                #origin[0], origin[1] = origin[0] - _width, origin[1] + _height - _width
1305
            '''
1304 1306

  
1305 1307
            uid = None
1306 1308
            for config in mapping_configs:
DTI_PID/DTI_PID/MainWindow.py
775 775
    def on_connect_line_to_symbol(self):
776 776
        """connect line to symbol"""
777 777
        from LineDetector import LineDetector
778
        from RecognitionDialog import Worker
778
        from shapely.geometry import Point
779
        #from RecognitionDialog import Worker
779 780

  
780 781
        if not self.graphicsView.hasImage():
781 782
            self.showImageSelectionMessageBox()
......
790 791
        lines = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringLineItem]# if item.length() > 50]
791 792
        lines_short = []#[item for item in self.graphicsView.scene().items() if type(item) is QEngineeringLineItem if item.length() <= 50]
792 793
        unknowns = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringUnknownItem]
793
        symbols = [item for item in self.graphicsView.scene().items() if issubclass(type(item), SymbolSvgItem)]
794
        end_breaks = [item for item in self.graphicsView.scene().items() if type(item) is QEngineeringEndBreakItem]
795
        symbols = [item for item in self.graphicsView.scene().items() if issubclass(type(item), SymbolSvgItem) and item not in end_breaks]
794 796

  
795 797
        for item in lines_short + unknowns:
796 798
            item.transfer.onRemoved.emit(item)
......
866 868
                self.addMessage.emit(MessageType.Error, message)
867 869
            # up to here
868 870

  
871
            # connect end break
872
            usedItemPairs = []
873
            for end_break in end_breaks:
874
                originPoint = Point(end_break.origin[0], end_break.origin[1])
875
                minD = sys.maxsize
876
                ownerItem = None
877
                connectedItem = None
878

  
879
                for symbol in symbols:
880
                    for conn in symbol.connectors:
881
                        dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1]))
882
                        if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \
883
                            [pair for pair in usedItemPairs if symbol in pair and conn.connectedItem in pair] or dist > 2.5 * toler or dist > minD:
884
                            continue
885

  
886
                        minD = dist
887
                        ownerItem = symbol
888
                        connectedItem = conn.connectedItem
889

  
890
                for line in lines:
891
                    for conn in line.connectors:
892
                        dist = originPoint.distance(Point(conn.sceneConnectPoint[0], conn.sceneConnectPoint[1]))
893
                        if not conn.connectedItem or not issubclass(type(conn.connectedItem), QEngineeringAbstractItem) or \
894
                            conn._connected_at != QEngineeringAbstractItem.CONNECTED_AT_BODY  or \
895
                            [pair for pair in usedItemPairs if line in pair and conn.connectedItem in pair] or dist > 2.5 * toler or dist > minD:
896
                            continue
897

  
898
                        minD = dist
899
                        ownerItem = symbol
900
                        connectedItem = conn.connectedItem
901

  
902
                if ownerItem and connectedItem:
903
                    end_break.set_property('Connected Item', connectedItem)
904
                    end_break.setToolTip('owner : ' + str(ownerItem))
905
                    end_break.owner = ownerItem
906
                    end_break.set_property('Freeze', True)
907

  
908
                    usedItemPairs.append([ownerItem, connectedItem])
909
            # up to here
910

  
869 911
        QMessageBox.information(self, self.tr('Information'), self.tr('Connecting between symbols and lines is complete'))
870 912

  
871 913
    def on_recognize_line(self):

내보내기 Unified diff

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