프로젝트

일반

사용자정보

개정판 79326880

ID7932688087a5d85dc95b62933eb0aaf96e8723c2
상위 9b706aed
하위 2e04ae10

Gyusu 이(가) 6년 이상 전에 추가함

파이프 최소길이 미만 따로 표시 및 모델링 제외

차이점 보기:

DTI_PID/SPPIDConverter/Main.vb
18 18
    Dim _AllLine_DT As New DataTable()
19 19
    Dim _AllSymbol_DT As New DataTable()
20 20

  
21
    Dim _ModelingLine_Dt As New DataTable()
22

  
21 23
    Dim _Placement As New Placement
22 24
    Dim _DWG_X = 0.875 '0.695 '1 '
23 25
    Dim _DWG_Y = 0.617 '0.585 '0.8 '
......
376 378
                    dEnd_y = dStart_y
377 379
                End If
378 380
            End If
379
            If Math.Abs(dStart_x - dEnd_x) < 10 Then
381
            If Math.Abs(dStart_x - dEnd_x) <= 15 Then
380 382
                bValidLine = False
381 383
            End If
382 384
        Else
......
394 396
                    dEnd_x = dStart_x
395 397
                End If
396 398
            End If
397
            If Math.Abs(dStart_y - dEnd_y) < 10 Then
399
            If Math.Abs(dStart_y - dEnd_y) <= 20 Then
398 400
                bValidLine = False
399 401
            End If
400 402
        End If
......
1904 1906
        Dim dPreConn_y As Double = 0
1905 1907
        If sConn1Type <> "" And sConn2Type <> "" Then
1906 1908
            If sConn1Type = "Line" Then
1907
                CheckConnectionLine(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector, dPreConn_x, dPreConn_y)
1909
                CheckConnectionLine(dConn1_x, dConn1_y, oStartLMConnector)
1908 1910
            Else
1909 1911
                CheckConnectionSymbolToSymbol(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector)
1910 1912
            End If
1911 1913

  
1912 1914
            If sConn2Type = "Line" Then
1913
                CheckConnectionLine(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector, dPreConn_x, dPreConn_y)
1915
                CheckConnectionLine(dConn2_x, dConn2_y, oEndLMConnector)
1914 1916
            Else
1915 1917
                CheckConnectionSymbolToSymbol(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector)
1916 1918
            End If
1917 1919

  
1918 1920
            sFirstUid = CheckExistModeling(oConn1Rows(0))
1919 1921
            sSecondUid = CheckExistModeling(oConn2Rows(0))
1920

  
1921
            If oStartLMConnector IsNot Nothing And oEndLMConnector IsNot Nothing Then
1922

  
1923
                ''라인을 센터점에 먼저그리기
1924
                'If dConn1_x <> dConn2_x And dConn1_y <> dConn2_y Then
1925
                '    'Angle Valve
1926
                '    '라인두개 긋기
1927
                '    objInputs.Clear()
1928
                '    objInputs.AddConnectorTarget(oStartLMConnector, dConn1_x, dConn1_y)
1929
                '    objInputs.AddPoint(dOriginal_x, dOriginal_y)
1930
                '    objInputs.AddConnectorTarget(oEndLMConnector, dConn2_x, dConn2_y)
1931
                '    Dim objItem As LMAItem
1932
                '    Dim sLineType As String = oConn1Rows(0)(_XML_LINE_TYPE).ToString()
1933
                '    Dim sLine1Path As String = GetPipeType(sLineType)
1934
                '    sLineType = oConn2Rows(0)(_XML_LINE_TYPE).ToString()
1935
                '    Dim sLine2Path As String = GetPipeType(sLineType)
1936
                '    If sLine1Path = sLine2Path Then
1937
                '        objItem = _Placement.PIDCreateItem(sLine1Path)
1938
                '        _Placement.PIDPlaceRun(objItem, objInputs)
1939
                '    Else
1940
                '        '//서로다른선일경우 먼저 Symbol을 그리고 커넥션으로 부터 각 선까지 선을 잇는다.
1941
                '    End If
1942

  
1943

  
1944
                'End If
1945
            Else
1946
                If oStartLMConnector IsNot Nothing Then
1947
                    dOriginal_x = dConn1_x
1948
                    dOriginal_y = dConn1_y
1949
                Else
1950
                    dOriginal_x = dConn2_x
1951
                    dOriginal_y = dConn2_y
1952
                End If
1953
            End If
1922
            Dim oCurrentLMConnector As LMConnector = Nothing
1923
            'If oStartLMConnector IsNot Nothing And oEndLMConnector IsNot Nothing Then
1924

  
1925
            '    '라인을 센터점에 먼저그리기
1926
            '    'If dConn1_x <> dConn2_x And dConn1_y <> dConn2_y Then
1927
            '    '    'Angle Valve
1928
            '    '    '라인두개 긋기
1929
            '    '    objInputs.Clear()
1930
            '    '    '   objInputs.AddPoint(dConn1_x, dConn1_y)
1931
            '    '    objInputs.AddConnectorTarget(oStartLMConnector, dConn1_x, dConn1_y)
1932
            '    '    objInputs.AddPoint(dOriginal_x, dOriginal_y)
1933

  
1934

  
1935
            '    '    Dim objItem As LMAItem
1936
            '    '    Dim sLineType As String = oConn1Rows(0)(_XML_LINE_TYPE).ToString()
1937
            '    '    Dim sLine1Path As String = GetPipeType(sLineType)
1938
            '    '    sLineType = oConn2Rows(0)(_XML_LINE_TYPE).ToString()
1939
            '    '    Dim sLine2Path As String = GetPipeType(sLineType)
1940
            '    '    If sLine1Path = sLine2Path Then
1941
            '    '        objItem = _Placement.PIDCreateItem(sLine1Path)
1942
            '    '        oCurrentLMConnector = _Placement.PIDPlaceRun(objItem, objInputs)
1943
            '    '    Else
1944
            '    '        '//서로다른선일경우 먼저 Symbol을 그리고 커넥션으로 부터 각 선까지 선을 잇는다.
1945
            '    '    End If
1946
            '    '    Dim sID_1 As String = ""
1947
            '    '    Dim sID_2 As String = ""
1948
            '    '    Dim sID_3 As String = ""
1949
            '    '    sID_1 = oStartLMConnector.ModelItemID
1950
            '    '    sID_2 = oCurrentLMConnector.ModelItemID
1951
            '    '    sID_3 = oEndLMConnector.ModelItemID
1952
            '    '    Try
1953

  
1954
            '    '        If sID_1 <> "" And sID_2 <> "" Then
1955
            '    '            Dim objSurvivorItem As LMAItem = Nothing
1956
            '    '            Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1)
1957
            '    '            Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2)
1958
            '    '            _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2)
1959
            '    '        End If
1960
            '    '    Catch ex As Exception
1961

  
1962
            '    '    End Try
1963
            '    '    objInputs.Clear()
1964
            '    '    '     objInputs.AddPoint(dOriginal_x, dOriginal_y)
1965
            '    '    objInputs.AddConnectorTarget(oStartLMConnector, dOriginal_x, dOriginal_y)
1966
            '    '    'objInputs.AddPoint(dConn2_x, dConn2_y)
1967
            '    '    objInputs.AddConnectorTarget(oEndLMConnector, dOriginal_x, dOriginal_y)
1968
            '    '    If sLine1Path = sLine2Path Then
1969
            '    '        objItem = _Placement.PIDCreateItem(sLine1Path)
1970
            '    '        oCurrentLMConnector = _Placement.PIDPlaceRun(objItem, objInputs)
1971
            '    '    Else
1972
            '    '        '//서로다른선일경우 먼저 Symbol을 그리고 커넥션으로 부터 각 선까지 선을 잇는다.
1973
            '    '    End If
1974

  
1975
            '    '    Try
1976
            '    '        sID_1 = oEndLMConnector.ModelItemID
1977
            '    '        sID_2 = oCurrentLMConnector.ModelItemID
1978
            '    '        If sID_1 <> "" And sID_2 <> "" Then
1979
            '    '            Dim objSurvivorItem As LMAItem = Nothing
1980
            '    '            Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1)
1981
            '    '            Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2)
1982
            '    '            _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2)
1983
            '    '        End If
1984
            '    '    Catch ex As Exception
1985
            '    '    End Try
1986
            '    'End If
1987
            'Else
1988
            '    If oStartLMConnector IsNot Nothing Then
1989
            '        dOriginal_x = dConn1_x
1990
            '        dOriginal_y = dConn1_y
1991
            '    Else
1992
            '        dOriginal_x = dConn2_x
1993
            '        dOriginal_y = dConn2_y
1994
            '    End If
1995
            'End If
1954 1996
        ElseIf sConn1Type <> "" And sConn2Type = "" Then
1955 1997
            If sConn1Type = "Line" Then
1956
                CheckConnectionLine(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector, dPreConn_x, dPreConn_y)
1998
                CheckConnectionLine(dConn1_x, dConn1_y, oStartLMConnector)
1957 1999
            Else
1958 2000
                CheckConnectionSymbolToSymbol(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector)
2001
                dOriginal_x = dConn1_x
2002
                dOriginal_y = dConn1_y
1959 2003
            End If
1960 2004

  
1961 2005
            sFirstUid = CheckExistModeling(oConn1Rows(0))
1962
            dOriginal_x = dConn1_x
1963
            dOriginal_y = dConn1_y
2006

  
1964 2007
        ElseIf sConn1Type = "" And sConn2Type <> "" Then
1965 2008

  
1966 2009
            If sConn1Type = "Line" Then
1967
                CheckConnectionLine(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector, dPreConn_x, dPreConn_y)
2010
                CheckConnectionLine(dConn2_x, dConn2_y, oEndLMConnector)
1968 2011
            Else
1969 2012
                CheckConnectionSymbolToSymbol(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector)
2013
                dOriginal_x = dConn2_x
2014
                dOriginal_y = dConn2_y
1970 2015
            End If
1971 2016
            sSecondUid = CheckExistModeling(oConn2Rows(0))
1972
            dOriginal_x = dConn2_x
1973
            dOriginal_y = dConn2_y
2017

  
1974 2018
        ElseIf sConn3Type <> "" And sConn4Type <> "" Then
1975 2019
            If sConn1Type = "Line" Then
1976
                CheckConnectionLine(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector, dPreConn_x, dPreConn_y)
2020
                CheckConnectionLine(dConn3_x, dConn3_y, oStartLMConnector)
1977 2021
            Else
1978 2022
                CheckConnectionSymbolToSymbol(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector)
1979 2023
            End If
1980 2024

  
1981 2025
            If sConn2Type = "Line" Then
1982
                CheckConnectionLine(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector, dPreConn_x, dPreConn_y)
2026
                CheckConnectionLine(dConn4_x, dConn4_y, oEndLMConnector)
1983 2027
            Else
1984 2028
                CheckConnectionSymbolToSymbol(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector)
1985 2029
            End If
1986 2030

  
1987 2031
            sFirstUid = CheckExistModeling(oConn3Rows(0))
1988 2032
            sSecondUid = CheckExistModeling(oConn4Rows(0))
1989
            If oStartLMConnector IsNot Nothing Then
1990
                dOriginal_x = dConn3_x
1991
                dOriginal_y = dConn3_y
1992
            Else
1993
                dOriginal_x = dConn4_x
1994
                dOriginal_y = dConn4_y
1995
            End If
2033
            'If oStartLMConnector IsNot Nothing Then
2034
            '    dOriginal_x = dConn3_x
2035
            '    dOriginal_y = dConn3_y
2036
            'Else
2037
            '    dOriginal_x = dConn4_x
2038
            '    dOriginal_y = dConn4_y
2039
            'End If
1996 2040

  
1997 2041
        ElseIf sConn3Type <> "" And sConn4Type = "" Then
1998 2042
            If sConn1Type = "Line" Then
1999
                CheckConnectionLine(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector, dPreConn_x, dPreConn_y)
2043
                CheckConnectionLine(dConn3_x, dConn3_y, oStartLMConnector)
2000 2044
            Else
2001 2045
                CheckConnectionSymbolToSymbol(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector)
2046
                dOriginal_x = dConn3_x
2047
                dOriginal_y = dConn3_y
2002 2048
            End If
2003 2049

  
2004 2050
            sFirstUid = CheckExistModeling(oConn3Rows(0))
2005
            dOriginal_x = dConn3_x
2006
            dOriginal_y = dConn3_y
2051

  
2007 2052
        ElseIf sConn3Type = "" And sConn4Type <> "" Then
2008 2053
            If sConn2Type = "Line" Then
2009
                CheckConnectionLine(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector, dPreConn_x, dPreConn_y)
2054
                CheckConnectionLine(dConn4_x, dConn4_y, oEndLMConnector)
2010 2055
            Else
2011 2056
                CheckConnectionSymbolToSymbol(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector)
2057
                dOriginal_x = dConn4_x
2058
                dOriginal_y = dConn4_y
2012 2059
            End If
2013 2060

  
2014 2061
            sSecondUid = CheckExistModeling(oConn4Rows(0))
2015
            dOriginal_x = dConn4_x
2016
            dOriginal_y = dConn4_y
2062

  
2017 2063
        Else
2018 2064
            '      oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle)
2019 2065
        End If
......
2032 2078
            sReturnUid = ""
2033 2079
        End If
2034 2080

  
2035

  
2036

  
2037

  
2038

  
2039

  
2040

  
2041

  
2042 2081
        If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then
2043 2082
            oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle)
2044 2083
            oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol
......
2061 2100
                oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle)
2062 2101
                oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol
2063 2102
            End If
2064

  
2065

  
2066

  
2067 2103
        End If
2068 2104

  
2069

  
2070 2105
        If sChildItem <> "" Then
2071 2106
            Dim sConn1_Systempath As String = ""
2072 2107
            Dim sConn2_Systempath As String = ""
......
2077 2112
                Dim iType As Integer = 0
2078 2113
                For Each sType In sDirection.Split(",")
2079 2114
                    If sConn1_Systempath = "" Then
2115

  
2080 2116
                        If iType = 0 Then
2081 2117
                            sConn1_Angle = GetChildSymbolDirection(sType)
2082 2118
                            iType = iType + 1
......
2085 2121
                            ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y)
2086 2122
                            ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y)
2087 2123
                            sConn1_Systempath = GetDataFromMappingDB(sType, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH)
2088
                            If oStartLMConnector Is Nothing Then
2089
                                Dim dChildConn1_x As Double = 0
2090
                                Dim dChildConn1_y As Double = 0
2091
                                _Placement.PIDConnectPointLocation(oLMSymbol, 1, dChildConn1_x, dChildConn1_y)
2092
                                If oLMSymbol.Connect1Connectors.Count = 0 And oLMSymbol IsNot Nothing Then
2093
                                    _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2094
                                     TargetItem:=oLMSymbol.AsLMAItem)
2095
                                Else
2096
                                    For Each oConnector In oLMSymbol.Connect1Connectors
2097
                                        _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2098
                                        TargetItem:=oConnector.AsLMAItem)
2099
                                    Next
2100
                                End If
2124
                            Dim dChildConn1_x As Double = 0
2125
                            Dim dChildConn1_y As Double = 0
2101 2126

  
2127
                            If oLMSymbol IsNot Nothing Then
2128
                                _Placement.PIDConnectPointLocation(oLMSymbol, 1, dChildConn1_x, dChildConn1_y)
2129
                                _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2130
                                 TargetItem:=oLMSymbol.AsLMAItem)
2102 2131
                            Else
2103
                                _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn1_x, dConn1_y,, sConn1_Angle,,
2104
                                            TargetItem:=oLMSymbol.AsLMAItem)
2105
                                'oLMSymbol = _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn1_x, dConn1_y,, sConn1_Angle,,
2106
                                'TargetItem:=oStartLMConnector.AsLMAItem)
2132
                                _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn1_x, dConn1_y,, sConn1_Angle,,)
2107 2133
                            End If
2108

  
2109 2134
                        End If
2135

  
2136
                        'If iType = 0 Then
2137
                        '    sConn1_Angle = GetChildSymbolDirection(sType)
2138
                        '    iType = iType + 1
2139
                        'Else
2140
                        '    Dim sStartpoint As String = oCurrentSymbolRow(_XML_SYMBOL_Conn1_Point).ToString()
2141
                        '    ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y)
2142
                        '    ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y)
2143
                        '    sConn1_Systempath = GetDataFromMappingDB(sType, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH)
2144
                        '    If oStartLMConnector Is Nothing Then
2145
                        '        Dim dChildConn1_x As Double = 0
2146
                        '        Dim dChildConn1_y As Double = 0
2147
                        '        _Placement.PIDConnectPointLocation(oLMSymbol, 1, dChildConn1_x, dChildConn1_y)
2148
                        '        If oLMSymbol.Connect1Connectors.Count = 0 And oLMSymbol IsNot Nothing Then
2149
                        '            _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2150
                        '             TargetItem:=oLMSymbol.AsLMAItem)
2151
                        '        Else
2152
                        '            For Each oConnector In oLMSymbol.Connect1Connectors
2153
                        '                _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2154
                        '                TargetItem:=oConnector.AsLMAItem)
2155
                        '            Next
2156
                        '        End If
2157

  
2158
                        '    Else
2159
                        '        _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn1_x, dConn1_y,, sConn1_Angle,,
2160
                        '                    TargetItem:=oLMSymbol.AsLMAItem)
2161
                        '        'oLMSymbol = _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn1_x, dConn1_y,, sConn1_Angle,,
2162
                        '        'TargetItem:=oStartLMConnector.AsLMAItem)
2163
                        '    End If
2164

  
2165
                        'End If
2110 2166
                    Else
2111 2167
                        If iType = 0 Then
2112 2168
                            sConn2_Angle = GetChildSymbolDirection(sType)
......
2116 2172
                            ConvertPointBystring(sEndPoint, dConn2_x, dConn2_y)
2117 2173
                            ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y)
2118 2174
                            sConn2_Systempath = GetDataFromMappingDB(sType, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH)
2119
                            If oEndLMConnector Is Nothing Then
2120
                                Dim dChildConn2_x As Double = 0
2121
                                Dim dChildConn2_y As Double = 0
2122
                                _Placement.PIDConnectPointLocation(oLMSymbol, 2, dChildConn2_x, dChildConn2_y)
2123
                                If oLMSymbol.Connect2Connectors.Count = 0 And oLMSymbol IsNot Nothing Then
2124
                                    _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2125
                                    TargetItem:=oLMSymbol.AsLMAItem)
2126
                                Else
2127
                                    For Each oConnector In oLMSymbol.Connect2Connectors
2128
                                        oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2129
                                        TargetItem:=oConnector.AsLMAItem)
2130
                                    Next
2131
                                End If
2132 2175

  
2176
                            Dim dChildConn2_x As Double = 0
2177
                            Dim dChildConn2_y As Double = 0
2178

  
2179
                            If oLMSymbol IsNot Nothing Then
2180
                                _Placement.PIDConnectPointLocation(oLMSymbol, 2, dChildConn2_x, dChildConn2_y)
2181
                                _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2182
                                        TargetItem:=oLMSymbol.AsLMAItem)
2133 2183
                            Else
2134
                                _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn2_x, dConn2_y,, sConn2_Angle,,
2135
                                    TargetItem:=oLMSymbol.AsLMAItem)
2136
                                '    oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dConn2_x, dConn2_y,, sConn2_Angle,,
2137
                                'TargetItem:=oEndLMConnector.AsLMAItem)
2184
                                _Placement.PIDPlaceSymbol(sConn2_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,)
2138 2185
                            End If
2139 2186

  
2140 2187
                        End If
2188

  
2189

  
2190
                        'If iType = 0 Then
2191
                        '    sConn2_Angle = GetChildSymbolDirection(sType)
2192
                        '    iType = iType + 1
2193
                        'Else
2194
                        '    Dim sEndPoint As String = oCurrentSymbolRow(_XML_SYMBOL_Conn2_Point).ToString()
2195
                        '    ConvertPointBystring(sEndPoint, dConn2_x, dConn2_y)
2196
                        '    ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y)
2197
                        '    sConn2_Systempath = GetDataFromMappingDB(sType, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH)
2198
                        '    If oEndLMConnector Is Nothing Then
2199
                        '        Dim dChildConn2_x As Double = 0
2200
                        '        Dim dChildConn2_y As Double = 0
2201
                        '        _Placement.PIDConnectPointLocation(oLMSymbol, 2, dChildConn2_x, dChildConn2_y)
2202
                        '        If oLMSymbol.Connect2Connectors.Count = 0 And oLMSymbol IsNot Nothing Then
2203
                        '            _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2204
                        '            TargetItem:=oLMSymbol.AsLMAItem)
2205
                        '        Else
2206
                        '            For Each oConnector In oLMSymbol.Connect2Connectors
2207
                        '                oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2208
                        '                TargetItem:=oConnector.AsLMAItem)
2209
                        '            Next
2210
                        '        End If
2211

  
2212
                        '    Else
2213
                        '        _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn2_x, dConn2_y,, sConn2_Angle,,
2214
                        '            TargetItem:=oLMSymbol.AsLMAItem)
2215
                        '        '    oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dConn2_x, dConn2_y,, sConn2_Angle,,
2216
                        '        'TargetItem:=oEndLMConnector.AsLMAItem)
2217
                        '    End If
2218

  
2219
                        'End If
2141 2220
                    End If
2142 2221
                Next
2143 2222
            Next
......
2372 2451

  
2373 2452
                End If
2374 2453
            Else
2454

  
2455
                Dim oOriginalPoint As String = oConn1Rows(0)(_XML_SYMBOL_ORIGINALPOINT)
2456
                ConvertPointBystring(oOriginalPoint, dStart_Dwg_x, dStart_Dwg_y)
2457
                ConvertPointByImage(dStart_Dwg_x, dStart_Dwg_y, _IMG_X, _IMG_Y)
2458
                oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_X) = dStart_Dwg_x
2459
                oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_Y) = dStart_Dwg_y
2375 2460
                sConn1Type = "Symbol"
2376 2461
            End If
2377 2462

  
......
2392 2477
                    'End If
2393 2478
                End If
2394 2479
            Else
2480
                Dim oOriginalPoint As String = oConn2Rows(0)(_XML_SYMBOL_ORIGINALPOINT)
2481
                ConvertPointBystring(oOriginalPoint, dEnd_Dwg_x, dEnd_Dwg_y)
2482
                ConvertPointByImage(dEnd_Dwg_x, dEnd_Dwg_y, _IMG_X, _IMG_Y)
2483
                oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_X) = dEnd_Dwg_x
2484
                oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_Y) = dEnd_Dwg_y
2395 2485
                sConn2Type = "Symbol"
2396 2486
            End If
2397 2487

  
2398 2488

  
2489
            If sConn1Type = "Symbol" Then
2490

  
2399 2491

  
2400 2492

  
2493
            End If
2494

  
2401 2495
            Dim sConn1LineNo As String = ""
2402 2496
            Dim sConn2LineNo As String = ""
2403 2497
            Dim oLMConnector As LMConnector = Nothing
......
2432 2526
            Dim dPreConnY As Double = 0
2433 2527

  
2434 2528

  
2435
            Dim sTargetDirection As String = CheckBranchLine(oLine_Dt.Rows, dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y, oLMConnector)
2529
            '   Dim sTargetDirection As String = CheckBranchLine(dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y, oLMConnector)
2436 2530

  
2437
            If sTargetDirection = "" Then
2438
                CheckConnectionLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector, dPreConnX, dPreConnY)
2531
            ' If sTargetDirection = "" Then
2532
            CheckConnectionLine(dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector)
2439 2533

  
2534
            If oStartLMConnector Is Nothing Then
2535
                UpdateCheckBranchLine(dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector)
2440 2536
                If oStartLMConnector Is Nothing Then
2441

  
2442 2537
                    oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2443 2538
                    If oLMSymbol1 IsNot Nothing Then
2444 2539
                        sConn1Type = "Symbol"
......
2447 2542
                    End If
2448 2543
                Else
2449 2544
                    sConn1Type = "Line"
2450
                    sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString()
2451
                    If sDirection = sPreConn1Direction Then
2452
                        If sDirection = "X" Then
2453
                            dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2454
                            dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2455
                        Else
2456
                            dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2457
                            dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2458
                        End If
2459
                    End If
2460

  
2545
                    'sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString()
2546
                    'If sDirection = sPreConn1Direction Then
2547
                    '    If sDirection = "X" Then
2548
                    '        dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2549
                    '        dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2550
                    '    Else
2551
                    '        dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2552
                    '        dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2553
                    '    End If
2554
                    'End If
2461 2555
                End If
2462
                CheckConnectionLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector, dPreConnX, dPreConnY)
2556
            Else
2557
                sConn1Type = "Line"
2558

  
2559
            End If
2560
                CheckConnectionLine(dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector)
2561
            If oEndLMConnector Is Nothing Then
2562
                UpdateCheckBranchLine(dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector)
2463 2563
                If oEndLMConnector Is Nothing Then
2464 2564
                    oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2465 2565
                    If oLMSymbol2 IsNot Nothing Then
......
2467 2567
                    End If
2468 2568
                Else
2469 2569
                    sConn2Type = "Line"
2470
                    sPreConn2Direction = oConn2Rows(0)(_XML_LINE_Direction).ToString()
2471
                    If sDirection = sPreConn2Direction Then
2472
                        If sDirection = "X" Then
2473
                            dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2474
                            dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2475
                        Else
2476
                            dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2477
                            dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2478
                        End If
2479
                    End If
2480 2570
                End If
2481 2571
            Else
2482
                If sTargetDirection = "START" Then
2483
                    oStartLMConnector = oLMConnector
2484
                    sConn1Type = "Line"
2485
                ElseIf sTargetDirection = "END" Then
2486
                    oEndLMConnector = oLMConnector
2487
                    sConn2Type = "Line"
2572
                sConn2Type = "Line"
2573
                    'sPreConn2Direction = oConn2Rows(0)(_XML_LINE_Direction).ToString()
2574
                    'If sDirection = sPreConn2Direction Then
2575
                    '    If sDirection = "X" Then
2576
                    '        dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2577
                    '        dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2578
                    '    Else
2579
                    '        dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2580
                    '        dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2581
                    '    End If
2582
                    'End If
2488 2583
                End If
2489
            End If
2584
                'Else
2585
                '    If sTargetDirection = "START" Then
2586
                '        oStartLMConnector = oLMConnector
2587
                '        sConn1Type = "Line"
2588
                '    ElseIf sTargetDirection = "END" Then
2589
                '        oEndLMConnector = oLMConnector
2590
                '        sConn2Type = "Line"
2591
                '    End If
2592
                'End If
2593

  
2594

  
2490 2595

  
2491
            'If iModelingType = 1 Then
2492
            '    If sConn1Type = "Line" Then
2493
            '        CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2494
            '    Else
2495
            '        oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2496
            '    End If
2497
            '    If sConn1Type = "Line" Then
2498
            '        CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2499
            '    Else
2500
            '        oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2501
            '    End If
2502
            '    'CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2503
            '    'CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2504
            'ElseIf iModelingType = "2" Then
2505
            '    If sConn1Type = "Line" Then
2506
            '        CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2507
            '    Else
2508
            '        oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2509
            '    End If
2510
            '    ' CheckConnectionLine(oConn2Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2511
            'ElseIf iModelingType = "3" Then
2512
            '    If sConn1Type = "Line" Then
2513
            '        CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2514
            '    Else
2515
            '        oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2516
            '    End If
2517
            '    ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oStartLMConnector)
2518 2596

  
2519
            'Else
2520
            '    'objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y)
2521
            '    'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y)
2522
            'End If
2523 2597

  
2524
            Dim sFirstUid As String = ""
2598

  
2599

  
2600
                'If iModelingType = 1 Then
2601
                '    If sConn1Type = "Line" Then
2602
                '        CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2603
                '    Else
2604
                '        oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2605
                '    End If
2606
                '    If sConn1Type = "Line" Then
2607
                '        CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2608
                '    Else
2609
                '        oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2610
                '    End If
2611
                '    'CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2612
                '    'CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2613
                'ElseIf iModelingType = "2" Then
2614
                '    If sConn1Type = "Line" Then
2615
                '        CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2616
                '    Else
2617
                '        oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2618
                '    End If
2619
                '    ' CheckConnectionLine(oConn2Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2620
                'ElseIf iModelingType = "3" Then
2621
                '    If sConn1Type = "Line" Then
2622
                '        CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2623
                '    Else
2624
                '        oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2625
                '    End If
2626
                '    ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oStartLMConnector)
2627

  
2628
                'Else
2629
                '    'objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y)
2630
                '    'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y)
2631
                'End If
2632

  
2633
                Dim sFirstUid As String = ""
2525 2634
            Dim sSecondUid As String = ""
2526 2635
            Try
2527 2636
                If oStartLMConnector Is Nothing And oEndLMConnector Is Nothing Then
......
2627 2736
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt)
2628 2737

  
2629 2738
                    Dim oPipeRun As LMPipeRun = oPidDataSource.GetPipeRun(oCurrentConnector.ModelItemID)
2739

  
2740
                    '모델링 된 PipeLine 데이터 테이블 저장
2741
                    Dim oAddRow As DataRow = _ModelingLine_Dt.NewRow
2742
                    oAddRow(_XML_LINE_SPID) = oCurrentConnector.ModelItemID
2743
                    oAddRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector
2744
                    oAddRow(_XML_LINE_DRAWING_TF) = "TRUE"
2745
                    oAddRow(_XML_LINE_DWG_STARTPOINT_X) = dStart_Dwg_x
2746
                    oAddRow(_XML_LINE_DWG_STARTPOINT_Y) = dStart_Dwg_y
2747
                    oAddRow(_XML_LINE_DWG_ENDPOINT_X) = dEnd_Dwg_x
2748
                    oAddRow(_XML_LINE_DWG_ENDPOINT_Y) = dEnd_Dwg_y
2749
                    _ModelingLine_Dt.Rows.Add(oAddRow)
2750

  
2751

  
2630 2752
                    Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'")
2631
                    If oAttributeRow.Length > 0 Then
2632
                        For Each oAttribute In oAttributeRow
2633
                            Try
2634
                                Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString()
2635
                                Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString()
2636
                                If sPIDValue.Contains("'") Then
2637
                                    sPIDValue = sPIDValue.Replace("'", """")
2638
                                End If
2639
                                Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE)
2640
                                oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue
2641
                            Catch ex As Exception
2642
                            End Try
2643
                        Next
2644
                        oPipeRun.Commit()
2645
                    End If
2753
                        If oAttributeRow.Length > 0 Then
2754
                            For Each oAttribute In oAttributeRow
2755
                                Try
2756
                                    Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString()
2757
                                    Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString()
2758
                                    If sPIDValue.Contains("'") Then
2759
                                        sPIDValue = sPIDValue.Replace("'", """")
2760
                                    End If
2761
                                    Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE)
2762
                                    oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue
2763
                                Catch ex As Exception
2764
                                End Try
2765
                            Next
2766
                            oPipeRun.Commit()
2767
                        End If
2646 2768

  
2647
                    Dim sID_1 As String = ""
2769
                        Dim sID_1 As String = ""
2648 2770
                    Dim sID_2 As String = ""
2771
                    Dim oAddConnector As LMConnector = Nothing
2649 2772
                    If oStartLMConnector IsNot Nothing Then
2650
                        sID_1 = oStartLMConnector.ModelItemID
2773
                            sID_1 = oStartLMConnector.ModelItemID
2651 2774
                        sID_2 = oCurrentConnector.ModelItemID
2775
                        oAddConnector = oStartLMConnector
2652 2776
                    ElseIf oEndLMConnector IsNot Nothing Then
2653
                        sID_1 = oEndLMConnector.ModelItemID
2777
                            sID_1 = oEndLMConnector.ModelItemID
2654 2778
                        sID_2 = oCurrentConnector.ModelItemID
2779
                        oAddConnector = oEndLMConnector
2655 2780
                    End If
2656
                    If sID_1 <> "" And sID_2 <> "" Then
2657
                        Dim objSurvivorItem As LMAItem = Nothing
2658
                        Dim oPipeRun1 As LMPipeRun = oPidDataSource.GetPipeRun(sID_1)
2659
                        Dim oPipeRun2 As LMPipeRun = oPidDataSource.GetPipeRun(sID_2)
2781
                        If sID_1 <> "" And sID_2 <> "" Then
2782
                            Dim objSurvivorItem As LMAItem = Nothing
2783
                            Dim oPipeRun1 As LMPipeRun = oPidDataSource.GetPipeRun(sID_1)
2784
                            Dim oPipeRun2 As LMPipeRun = oPidDataSource.GetPipeRun(sID_2)
2660 2785
                        _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2)
2786

  
2787
                        Dim oChangeRow() As DataRow = _ModelingLine_Dt.Select(_XML_LINE_SPID & " = '" & sID_2 & "'")
2788
                        If oChangeRow.Length = 1 Then
2789
                            oChangeRow(0)(_XML_LINE_SPID) = sID_1
2790
                            oChangeRow(0)(_XML_LINE_LMCONNECTOR) = oAddConnector
2791
                        End If
2661 2792
                    End If
2662
                Else
2663
                    sReturnUid = ""
2793
                    Else
2794
                        sReturnUid = ""
2664 2795
                End If
2665 2796
            Catch ex As Exception
2666 2797

  
......
3019 3150

  
3020 3151

  
3021 3152

  
3022
    Private Function CheckBranchLine(ByVal oLine_Dt As DataTable, ByVal dStartX As Double, ByVal dStartY As Double,
3153
    Private Function CheckBranchLine(ByVal dStartX As Double, ByVal dStartY As Double,
3023 3154
                                ByRef dEndX As Double, ByRef dEndY As Double, ByRef sBranchType As String, ByRef oLMConnector As LMConnector) As Boolean
3024 3155

  
3025 3156
        Try
3026
            Dim oModelingLineRows() As DataRow = oLine_Dt.Select("[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And [" & _XML_LINE_SPID & "] <> ''")
3027
            For Each oModelrow In oModelingLineRows
3028
                Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT)
3029
                Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT)
3157

  
3158
            For Each oModelrow In _ModelingLine_Dt.Rows
3159
                'Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT)
3160
                'Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT)
3030 3161
                Dim dModelStartX As Double
3031 3162
                Dim dModelStartY As Double
3032 3163
                Dim dModelEndX As Double
3033 3164
                Dim dModelEndY As Double
3034
                ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY)
3035
                ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY)
3036
                ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y)
3037
                ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y)
3165
                dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X)
3166
                dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y)
3167
                dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X)
3168
                dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y)
3169
                'ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY)
3170
                'ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY)
3171
                'ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y)
3172
                'ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y)
3038 3173
                Dim dGap As Double = 0.0002
3039 3174
                Dim d기준x As Double = (dModelStartX + dModelEndX) / 2
3040 3175
                Dim d기준y As Double = (dModelStartY + dModelEndY) / 2
......
3187 3322
                        End If
3188 3323

  
3189 3324
                    End If
3190
                    Else
3325
                Else
3191 3326
                    'Horizontal
3192 3327
                    If Math.Abs(dModelStartX - dModelEndX) >= Math.Abs(dModelStartY - dModelEndY) Then
3193 3328
                        'Vertical
......
3724 3859

  
3725 3860
    End Function
3726 3861

  
3862
    Private Function UpdateCheckBranchLine(ByRef dX As Double, ByRef dY As Double,
3863
                                  ByRef oLMConnector As LMConnector) As Boolean
3864
        Dim bConnectionFlag As Boolean = False
3865
        Dim iGapCheck As Integer = 0
3866
        Try
3867
            For Each oModelrow In _ModelingLine_Dt.Rows
3868
                Dim d기준x As Double = dX
3869
                Dim d기준y As Double = dY
3870
                Dim dGap As Double = 0.001
3871
                Dim oRun As LMPipeRun = Nothing
3872
                Dim dModelStartX As Double
3873
                Dim dModelStartY As Double
3874
                Dim dModelEndX As Double
3875
                Dim dModelEndY As Double
3876
                dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X)
3877
                dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y)
3878
                dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X)
3879
                dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y)
3880
                d기준x = (dModelStartX + dModelEndX) / 2
3881
                d기준y = (dModelStartY + dModelEndY) / 2
3882

  
3883

  
3884
                Dim dMax_X As Double = 0.0
3885
                Dim dMax_Y As Double = 0.0
3886
                Dim dMin_X As Double = 0.0
3887
                Dim dMin_Y As Double = 0.0
3888

  
3889

  
3890
                If dModelEndX > dModelStartX Then
3891
                    dMax_X = dModelEndX
3892
                    dMin_X = dModelStartX
3893
                Else
3894
                    dMax_X = dModelStartX
3895
                    dMin_X = dModelEndX
3896
                End If
3897

  
3898
                If dModelEndY > dModelStartY Then
3899
                    dMax_Y = dModelEndY
3900
                    dMin_Y = dModelStartY
3901
                Else
3902
                    dMax_Y = dModelStartY
3903
                    dMin_Y = dModelEndY
3904
                End If
3905

  
3906
                If dX <= dMax_X + dGap And dX >= dMin_X - dGap And
3907
                  dY <= dMax_Y + dGap And dY >= dMin_Y - dGap Then
3908
                    If Math.Abs(dMax_X - dMin_X) > Math.Abs(dMax_Y - dMin_Y) Then
3909
                        dY = dMax_Y
3910
                    Else
3911
                        dX = dMax_X
3912
                    End If
3913

  
3914
                    oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR)
3915
                End If
3916

  
3917

  
3918
            Next
3919
        Catch ex As Exception
3920
            bConnectionFlag = False
3921
            oLMConnector = Nothing
3922
        End Try
3923
        Return bConnectionFlag
3924
    End Function
3925

  
3926

  
3727 3927
    ''' <summary>
3728 3928
    ''' 라인과 특정 포인트에 커넥션을 확인하는 메서드
3729 3929
    ''' </summary>
......
3736 3936
    ''' <returns></returns>
3737 3937

  
3738 3938

  
3739
    Private Function CheckConnectionLine(ByVal oModelingLineRows() As DataRow, ByVal dX As Double, ByVal dY As Double,
3740
                                  ByRef oLMConnector As LMConnector, ByRef dPreConnX As Double, ByRef dPreConnY As Double) As Boolean
3939

  
3940
    Private Function CheckConnectionLine(ByRef dX As Double, ByRef dY As Double,
3941
                                  ByRef oLMConnector As LMConnector) As Boolean
3741 3942
        Dim bConnectionFlag As Boolean = False
3742 3943
        Dim iGapCheck As Integer = 0
3743 3944
        Try
3744
            For Each oModelrow In oModelingLineRows
3945
            For Each oModelrow In _ModelingLine_Dt.Rows
3745 3946
                Dim d기준x As Double = dX
3746 3947
                Dim d기준y As Double = dY
3747 3948
                Dim dGap As Double = 0.0002
......
3762 3963
                dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y)
3763 3964
                d기준x = (dModelStartX + dModelEndX) / 2
3764 3965
                d기준y = (dModelStartY + dModelEndY) / 2
3765
                Try
3766
                    oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR)
3767
                    oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID)
3768
                Catch ex As Exception
3769
                End Try
3770
                Try
3771
                    If oRun IsNot Nothing Then
3772
                        Dim dResultCalc As Double = -1
3773
                        For Each objRep In oRun.Representations
3774
                            If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then
3775
                                Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID)
3776
                                For Each objConnectorVertex In objConnector.ConnectorVertices
3777
                                    Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value
3778
                                    Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value
3779
                                    If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then
3780
                                        oLMConnector = objConnector
3781
                                        dPreConnX = dConn_X
3782
                                        dPreConnY = dConn_Y
3783
                                        bConnectionFlag = True
3784
                                    End If
3785
                                Next
3786
                            End If
3787
                        Next
3788
                    End If
3789
                Catch ex As Exception
3790
                End Try
3966

  
3967

  
3968
                Dim bCheckEqual As Boolean = False
3969
                If dX <= dModelStartX + dGap And dX >= dModelStartX - dGap And
3970
                        dY <= dModelStartY + dGap And dY >= dModelStartY - dGap Then
3971
                    bCheckEqual = True
3972
                ElseIf dX <= dModelEndX + dGap And dX >= dModelEndX - dGap And
3973
                        dY <= dModelEndY + dGap And dY >= dModelEndY - dGap Then
3974
                    bCheckEqual = True
3975

  
3976
                End If
3977

  
3978
                If bCheckEqual Then
3979
                    Try
3980
                        oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR)
3981
                        oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID)
3982
                    Catch ex As Exception
3983
                    End Try
3984
                    Try
3985
                        If oRun IsNot Nothing Then
3986
                            Dim dResultCalc As Double = -1
3987
                            For Each objRep In oRun.Representations
3988
                                If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then
3989
                                    Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID)
3990
                                    For Each objConnectorVertex In objConnector.ConnectorVertices
3991
                                        Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value
3992
                                        Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value
3993
                                        If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then
3994
                                            oLMConnector = objConnector
3995
                                            dX = dConn_X
3996
                                            dY = dConn_Y
3997
                                            bConnectionFlag = True
3998
                                        End If
3999
                                    Next
4000
                                End If
4001
                            Next
4002
                        End If
4003
                    Catch ex As Exception
4004
                    End Try
4005
                Else
4006
                    'Dim dMax_X As Double = 0.0
4007
                    'Dim dMax_Y As Double = 0.0
4008
                    'Dim dMin_X As Double = 0.0
4009
                    'Dim dMin_Y As Double = 0.0
4010

  
4011

  
4012
                    'If dModelEndX > dModelStartX Then
4013
                    '    dMax_X = dModelEndX
4014
                    '    dMin_X = dModelStartX
4015
                    'Else
4016
                    '    dMax_X = dModelStartX
4017
                    '    dMin_X = dModelEndX
4018
                    'End If
4019

  
4020
                    'If dModelEndY > dModelStartY Then
4021
                    '    dMax_Y = dModelEndY
4022
                    '    dMin_Y = dModelStartY
4023
                    'Else
4024
                    '    dMin_Y = dModelStartY
4025
                    '    dMin_X = dModelEndY
4026
                    'End If
4027

  
4028
                    'If dX <= dMax_X + dGap And dX >= dMin_X - dGap And
4029
                    '  dY <= dMax_Y + dGap And dY >= dMin_Y - dGap Then
4030

  
4031
                    '    If Math.Abs(dMax_X - dMin_X) > Math.Abs(dMax_Y - dMin_Y) Then
4032
                    '        dY = dMax_Y
4033
                    '    Else
4034
                    '        dX = dMax_X
4035
                    '    End If
4036

  
4037
                    '    oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR)
4038
                    'End If
4039
                End If
4040

  
3791 4041
            Next
3792 4042
        Catch ex As Exception
3793 4043
            bConnectionFlag = False
......
5313 5563
        Try
5314 5564
            _AllLine_DT = Line_Dt()
5315 5565
            _AllSymbol_DT = Symbol_Dt()
5566
            _ModelingLine_Dt = Line_Dt()
5316 5567

  
5317 5568
            _CompleteConvert = False
5318 5569
            Label_Progress.Text = "0%"

내보내기 Unified diff