프로젝트

일반

사용자정보

개정판 1bfcc921

ID1bfcc9218bacfa4c081a65871a11f312d6986469
상위 7c8eb42b
하위 9b5d4527

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

issue #654

차이점 보기:

DTI_PID/SPPIDConverter/Main.vb
8 8
Imports System.Threading
9 9

  
10 10
Public Class Main
11

  
12 11
    'Dim _Mapping_DB As DataTable = New DataTable()
13 12
    Dim _Mapping_DB As DataSet = New DataSet()
14 13
    Dim _Attribute_DB As DataTable = New DataTable()
15 14
    Dim _PIDSymbol_DB As DataTable = New DataTable()
16 15
    Dim _ResultModeling_DT As DataTable = New DataTable()
17

  
18 16
    Dim _AllLine_DT As New DataTable()
19 17
    Dim _AllSymbol_DT As New DataTable()
20

  
21 18
    Dim _ModelingLine_Dt As New DataTable()
22 19
    Dim _ModelingSymbol_Dt As New DataTable()
23 20
    Dim _Placement As New Placement
......
27 24
    'Dim _DWG_Y = 0.614 '0.585 '0.8 '
28 25
    Dim _IMG_X = 0
29 26
    Dim _IMG_Y = 0
30

  
31 27
    Dim _Unit As String
32

  
33 28
    'Drawing 전역변수
34 29
    Dim _objPIDADrawing As Object
35 30
    '현재선택한 폴더경로
36 31
    Dim _selectFolderPath As String
37

  
38 32
    Private _Main_trd As Thread
39 33
    Private _Opc_trd As Thread
40

  
41 34
    Private _CompleteConvert As Boolean = False
42

  
43 35
    Private _DrawingsList As List(Of Drawing)
44

  
45

  
46 36
    Private _iPipeLineNocnt As Integer
47 37
    Private _iPipecnt As Integer
48 38
    Private _iFittingcnt As Integer
......
51 41
    Private _iEquipmentcnt As Integer
52 42
    Private _iNozzlecnt As Integer
53 43
    Private _iPipintOpccnt As Integer
54

  
55 44
    Private _allItem As Integer
56 45
    Private _Itemcnt As Integer
57

  
58 46
    Dim _Gembox As New CGembox()
47

  
59 48
    Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
60 49
        LoadDB()
61 50
    End Sub
51
    ''' <summary>
52
    ''' brief
53
    ''' </summary>
62 54

  
63 55
    Private Sub LoadDB()
64 56
        If My.Settings.DBPath <> "" And My.Settings.Plant_Hierarchy <> "" Then
......
74 66
        End If
75 67
    End Sub
76 68

  
77

  
78 69
    Private Function GetDataFromMappingDB(ByVal sSymbolName As String, ByVal sColumn As String) As String
79 70
        Dim sValue As String = ""
80 71
        For Each oDt As DataTable In _Mapping_DB.Tables
......
109 100
        Return sSPPIDAttribute
110 101
    End Function
111 102

  
112

  
113

  
114 103
    Private Function LoadSymbolInXml(ByVal sXmlPath As String) As Drawing
115 104
        Try
116 105
            ''  _TempSymbolDt = Symbol_Dt()
117 106
            Dim CDrawing As Drawing = New Drawing()
118 107
            Dim oDt As DataTable = LoadSymbol_DT()
119 108
            Dim oElement As XElement = XElement.Load(sXmlPath)
120

  
121 109
            If oElement IsNot Nothing Then
122 110
                CDrawing.DwgName = oElement.Element(_XML_DWGNAME).Value
123 111
                CDrawing.Size = oElement.Element(_XML_DWGSIZE).Value
124 112
                SplitLocation(CDrawing.Size, _IMG_X, _IMG_Y)
125 113
                CDrawing.Unit = oElement.Element(_XML_UNIT).Value
126

  
127 114
                Dim oLineno_list As New List(Of Line_no)
128 115
                Dim oEqp_list As New List(Of Eqp_no)
129 116
                Dim oTrim_Lineno_list As New List(Of Line_no)
......
135 122
                    Dim sUid As String = ""
136 123
                    For Each oSymbol As Object In oEqpNo.Elements(_XML_CATEGORY_SYMBOL)
137 124
                        Try
138

  
139 125
                            Dim oAddrow As DataRow = oSymbol_Dt.NewRow()
140 126
                            Dim oEleObj As XElement
141 127
                            Dim sName As String
......
153 139
                            Dim dCenterPos_y As Double = 0.0
154 140
                            Dim dDwgCenterPos_x As Double = 0.0
155 141
                            Dim dDwgCenterPos_y As Double = 0.0
156

  
157 142
                            Dim dConn1Pos_x As Double = 0.0
158 143
                            Dim dConn1Pos_y As Double = 0.0
159 144
                            Dim dConn2Pos_x As Double = 0.0
......
162 147
                            Dim dConn3Pos_y As Double = 0.0
163 148
                            Dim dConn4Pos_x As Double = 0.0
164 149
                            Dim dConn4Pos_y As Double = 0.0
165

  
166 150
                            Dim dDwg_Conn1Pos_x As Double = 0.0
167 151
                            Dim dDwg_Conn1Pos_y As Double = 0.0
168 152
                            Dim dDwg_Conn2Pos_x As Double = 0.0
......
171 155
                            Dim dDwg_Conn3Pos_y As Double = 0.0
172 156
                            Dim dDwg_Conn4Pos_x As Double = 0.0
173 157
                            Dim dDwg_Conn4Pos_y As Double = 0.0
174

  
175 158
                            oEleObj = oSymbol.Element(_XML_SYMBOL_UID)
176 159
                            sUid = oEleObj.Value
177 160
                            oEleObj = oSymbol.Element(_XML_SYMBOL_PARENT)
......
217 200
                            dDwgCenterPos_x = dCenterPos_x
218 201
                            dDwgCenterPos_y = dCenterPos_y
219 202
                            ConvertPointByImage(dDwgCenterPos_x, dDwgCenterPos_y, _IMG_X, _IMG_Y)
220

  
221 203
                            oAddrow(_XML_SYMBOL_CENTERPOINT_X) = dCenterPos_x
222 204
                            oAddrow(_XML_SYMBOL_CENTERPOINT_Y) = dCenterPos_y
223 205
                            oAddrow(_XML_SYMBOL_DWG_CENTERPOINT_X) = dDwgCenterPos_x
......
235 217
                                    dDwg_Conn1Pos_x = dConn1Pos_x
236 218
                                    dDwg_Conn1Pos_y = dConn1Pos_y
237 219
                                    ConvertPointByImage(dDwg_Conn1Pos_x, dDwg_Conn1Pos_y, _IMG_X, _IMG_Y)
238

  
239 220
                                    oAddrow(_XML_SYMBOL_CONN1_POINT_X) = dConn1Pos_x
240 221
                                    oAddrow(_XML_SYMBOL_CONN1_POINT_Y) = dConn1Pos_y
241 222
                                    oAddrow(_XML_SYMBOL_DWG_CONN1_POINT_X) = dDwg_Conn1Pos_x
......
275 256

  
276 257
                            Dim sXLength As String = ""
277 258
                            Dim sYLength As String = ""
278

  
279 259
                            Dim dMin_x As Double = 0
280 260
                            Dim dMax_x As Double = 0
281 261
                            Dim dMin_y As Double = 0
......
837 817
                Catch ex As Exception
838 818
                End Try
839 819
            Next
840

  
841 820
            SetConnectionInfo(oLine_Dt, oSymbol_Dt)
842 821
            _AllLine_DT.Merge(oLine_Dt)
843 822
            _AllSymbol_DT.Merge(oSymbol_Dt)
......
849 828
        Return oLineno_list
850 829
    End Function
851 830

  
852

  
853 831
    Private Sub ConvertPointByImage(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double)
854 832

  
855 833
        Dim calcx As Double = 0
......
863 841
        dX = calcx
864 842
        dY = calcy
865 843
    End Sub
866

  
867

  
868 844
    '@brief Convert To SPPID
869 845
    '@author : Gyusu Park
870 846
    '@date : 2018-04-10
871 847
    '@history:
872

  
873 848
    Private Sub SplitLocation(ByVal sLocation As String, ByRef dX As Double, ByRef dY As Double)
874 849

  
875 850
        Dim opointstr As String() = Split(sLocation, ",")
......
899 874
        Catch ex As Exception
900 875
            Return Nothing
901 876
        End Try
902

  
903

  
904 877
    End Function
905 878

  
906 879
    Private Function LoadAllDrawing() As DataTable
907

  
908

  
909 880
        SetListBoxItems(ListBox_Result, "도면정보 로드중....")
910 881
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "도면정보 로드중....")
911 882
        Dim oDt As DataTable = Drawing_Dt()
912 883
        Dim sHierarchy As String = My.Settings.Plant_Hierarchy
913

  
914

  
915 884
        Dim files() As String
916 885
        files = Directory.GetFiles(sHierarchy, "*.pid", SearchOption.AllDirectories)
917 886
        For Each FileName As String In files
......
924 893
        Return oDt
925 894
    End Function
926 895

  
927

  
928 896
    Dim _XMLList As ListView = New ListView()
929 897

  
930

  
931

  
932

  
933

  
934

  
935 898
    Private Function CheckOpenDrawing() As Boolean
936 899
        Try
937 900

  
......
983 946
            Return bCheckOpen
984 947
        End If
985 948

  
986
            Dim bCheckOpenDrawing As Boolean = False
987
            While (True)
988
                bCheckOpenDrawing = CheckOpenDrawing()
989
                If bCheckOpenDrawing = True Then
990
                    bCheckOpen = True
991
                    Exit While
992
                Else
993
                    Thread.Sleep(2000)
994
                End If
995
            End While
949
        Dim bCheckOpenDrawing As Boolean = False
950
        While (True)
951
            bCheckOpenDrawing = CheckOpenDrawing()
952
            If bCheckOpenDrawing = True Then
953
                bCheckOpen = True
954
                Exit While
955
            Else
956
                Thread.Sleep(2000)
957
            End If
958
        End While
996 959

  
997 960

  
998
            Return bCheckOpen
961
        Return bCheckOpen
999 962
    End Function
1000 963

  
1001 964
    Private Function GetDrawing(ByVal sDwgName As String) As Drawing
......
1107 1070
        _DrawLine_Dt.Rows.Add(oAddRow)
1108 1071
    End Sub
1109 1072

  
1110

  
1111

  
1112 1073
    Private Sub PlaceEquipment(ByVal sUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sEqpName As String)
1113 1074
        Try
1114 1075
            Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'")
......
1138 1099
                    ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y)
1139 1100
                    _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle)
1140 1101
                    SetListBoxItems(ListBox_Result, "Place Equipment.." & sUid & " (" & dLocationX & "," & dLocationY & ")..." & _iEquipmentcnt & " count ")
1141

  
1142 1102
                    _iEquipmentcnt = _iEquipmentcnt + 1
1143 1103
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Equipment : " & sUid)
1144 1104
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Name : " & sEqpName)
1145 1105
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle)
1146 1106
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY)
1147 1107
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Count : " & _iEquipmentcnt)
1148

  
1149

  
1150 1108
                End If
1151 1109
            End If
1152 1110
        Catch ex As Exception
1153

  
1154 1111
        End Try
1155

  
1156

  
1157 1112
    End Sub
1158 1113

  
1159 1114
    Private Function PlacePipingOPC(ByVal sUid As String, ByVal oOPCRow As DataRow, ByVal oAttribute_Dt As DataTable, ByVal sLineNoText As String) As LMSymbol
......
1235 1190
        Try
1236 1191

  
1237 1192
            Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'")
1238
                Dim oAttributeRow() As DataRow
1193
            Dim oAttributeRow() As DataRow
1239 1194
            If oAttribute_Dt.Rows.Count > 0 Then
1240 1195
                oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'")
1241 1196
            End If
......
1643 1598
            Dim sLocation = CLine_No.Location
1644 1599
            Dim dLocationx As Double = 0.0
1645 1600
            Dim dLocationy As Double = 0.0
1646

  
1647 1601
            Dim dX As Double = 0.0
1648 1602
            Dim dY As Double = 0.0
1649 1603
            If ConvertPointBystring(sLocation, dLocationx, dLocationy) Then
1650 1604
                dX = dLocationx
1651 1605
                dY = dLocationy
1652

  
1653 1606
                For Each oRow In oPipeRun_Dt.Rows
1654 1607
                    Dim dStartx As Double = Double.Parse(oRow("startx").ToString())
1655 1608
                    Dim dStarty As Double = Double.Parse(oRow("starty").ToString())
1656 1609
                    Dim dEndx As Double = Double.Parse(oRow("endx").ToString())
1657 1610
                    Dim dEndy As Double = Double.Parse(oRow("endy").ToString())
1658

  
1659 1611
                    Dim dStartSum As Double = Math.Abs(dStartx - dLocationx) + Math.Abs(dStarty - dLocationy)
1660 1612
                    Dim dEndSum As Double = Math.Abs(dEndx - dLocationx) + Math.Abs(dEndy - dLocationy)
1661 1613
                    If dStartSum > dEndSum Then
......
1663 1615
                    Else
1664 1616
                        oRow("value") = dStartSum
1665 1617
                    End If
1666

  
1667 1618
                Next
1668 1619
                Dim dataView As New DataView(oPipeRun_Dt)
1669 1620
                dataView.Sort = " value asc"
......
1679 1630
                        Dim sSystemPath As String = CLine_No.SystemPath
1680 1631
                        Dim dAngle As Double = CLine_No.Angle
1681 1632
                        Dim labelpersist As LMLabelPersist
1682

  
1683 1633
                        For Each representation In oPiperun.Representations
1684 1634
                            If representation.RepresentationType = "Connector" Then
1685 1635
                                labelpersist = _Placement.PIDPlaceLabel(sSystemPath,
1686 1636
                                dLineNoLocation,, dAngle, LabeledItem:=representation)
1687 1637
                                _iPipeLineNocnt = _iPipeLineNocnt + 1
1688 1638
                                SetListBoxItems(ListBox_Result, "Place PipeLineNo Label.." & CLine_No.Uid & " (" & dLocationx & "," & dLocationy & ")..." & _iPipeLineNocnt & " count ")
1689

  
1690 1639
                                ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & CLine_No.Uid & "")
1691 1640
                                ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & CLine_No.Text)
1692 1641
                                'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle)
......
1695 1644
                            End If
1696 1645
                        Next
1697 1646
                    Catch ex As Exception
1698

  
1699 1647
                    End Try
1700

  
1701

  
1702 1648
                End If
1703

  
1704

  
1705

  
1706 1649
                Return True
1707 1650
            Else
1708 1651
                Return False
1709 1652
            End If
1710

  
1711 1653
        Catch ex As Exception
1712 1654
            Return False
1713 1655
        End Try
......
1723 1665
        _iEquipmentcnt = 0
1724 1666
        _iNozzlecnt = 1
1725 1667
        _iPipintOpccnt = 0
1726

  
1727 1668
    End Sub
1728 1669

  
1729 1670
    Private Function GetAllCheckNodeCount() As Integer
......
1792 1733
                            Dim oSelectRows() As DataRow = oDt.Select("[" & _XML_SYMBOL_UID & "] = '" & sUid & "'")
1793 1734
                            If oSelectRows.Length = 1 Then
1794 1735
                                oSelectRows(0)(_XML_SYMBOL_DRAWING_TF) = "FALSE"
1795

  
1796 1736
                                If oSymbolNode.Checked Then
1797 1737
                                    oSelectRows(0)(_XML_SYMBOL_Check) = "TRUE"
1798 1738
                                Else
1799 1739
                                    oSelectRows(0)(_XML_SYMBOL_Check) = "FALSE"
1800 1740
                                End If
1801 1741
                            End If
1802

  
1803 1742
                        End If
1804

  
1805 1743
                    Next
1806 1744
                Next
1807 1745
            Next
......
1815 1753
        Dim sOriginalPoint As String = ""
1816 1754
        Dim dOriginal_x As Double = 0.0
1817 1755
        Dim dOriginal_y As Double = 0.0
1818

  
1819 1756
        Dim dConn1_x As Double = 0.0
1820 1757
        Dim dConn1_y As Double = 0.0
1821 1758
        Dim dConn2_x As Double = 0.0
......
1824 1761
        Dim dConn3_y As Double = 0.0
1825 1762
        Dim dConn4_x As Double = 0.0
1826 1763
        Dim dConn4_y As Double = 0.0
1827

  
1828 1764
        Dim sUid As String = oCurrentSymbolRow(_XML_SYMBOL_UID)
1829 1765
        Dim sSystemPath As String = oCurrentSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString()
1830 1766
        Dim dAngle As Double = oCurrentSymbolRow(_XML_SYMBOL_ANGLE)
......
1834 1770
        Dim sSymbolCompType As String = oCurrentSymbolRow(_XML_SYMBOL_TYPE).ToString()
1835 1771
        ConvertPointBystring(sOriginalPoint, dOriginal_x, dOriginal_y)
1836 1772
        ConvertPointByImage(dOriginal_x, dOriginal_y, _IMG_X, _IMG_Y)
1837

  
1838 1773
        Dim sChildItem As String = oCurrentSymbolRow(_XML_SYMBOL_CHILD)
1839

  
1840 1774
        'Connection 정보 체크, 모델링 되어 있는지 유무
1841 1775
        '양 커넥션의 모델링 유무를 체크한다.
1842 1776
        Dim sConn1Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()
1843 1777
        Dim sConn2Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()
1844 1778
        Dim sConn3Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()
1845 1779
        Dim sConn4Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()
1846

  
1847 1780
        Dim sConn1Type As String = ""
1848 1781
        Dim sConn2Type As String = ""
1849 1782
        Dim sConn3Type As String = ""
1850 1783
        Dim sConn4Type As String = ""
1851

  
1852 1784
        Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'")
1853 1785
        If oConn1Rows.Length = 0 Then
1854 1786
            oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'")
......
1907 1839
            ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y)
1908 1840
        End If
1909 1841

  
1910

  
1911

  
1912

  
1913

  
1914
        'If sConn1Type = "Line" Then
1915
        '    Dim sStartpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn1_Point).ToString()
1916
        '    ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y)
1917
        '    ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y)
1918
        'ElseIf sConn1Type = "Symbol" Then
1919
        '    ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y)
1920
        'End If
1921

  
1922
        'If sConn2Type = "Line" Then
1923
        '    Dim sEndpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn2_Point).ToString()
1924
        '    ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y)
1925
        '    ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y)
1926
        'ElseIf sConn2Type = "Symbol" Then
1927
        '    ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y)
1928
        'End If
1929

  
1930
        'If sConn3Type = "Line" Then
1931
        '    Dim sStartpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn3_Point).ToString()
1932
        '    ConvertPointBystring(sStartpoint, dConn3_x, dConn3_y)
1933
        '    ConvertPointByImage(dConn3_x, dConn3_y, _IMG_X, _IMG_Y)
1934
        'ElseIf sConn3Type = "Symbol" Then
1935
        '    ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y)
1936
        'End If
1937

  
1938
        'If sConn4Type = "Line" Then
1939
        '    Dim sEndpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn4_Point).ToString()
1940
        '    ConvertPointBystring(sEndpoint, dConn4_x, dConn4_y)
1941
        '    ConvertPointByImage(dConn4_x, dConn4_y, _IMG_X, _IMG_Y)
1942
        'ElseIf sConn4Type = "Symbol" Then
1943
        '    ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y)
1944
        'End If
1945

  
1946

  
1947

  
1948
        'If sConn1Type = "Line" And sConn2Type = "Line" Then
1949
        '    Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString()
1950
        '    ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y)
1951
        '    ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y)
1952
        '    Dim sEndpoint As String = oConn1Rows(_XML_LINE_ENDPOINT).ToString()
1953
        '    ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y)
1954
        '    ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y)
1955

  
1956
        'ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then
1957
        '    Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString()
1958
        '    ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y)
1959
        '    ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y)
1960

  
1961
        '    ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y)
1962
        'ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then
1963
        '    ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y)
1964

  
1965
        '    Dim sEndpoint As String = oConn1Rows(_XML_LINE_ENDPOINT).ToString()
1966
        '    ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y)
1967
        '    ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y)
1968

  
1969
        'ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then
1970
        '    ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y)
1971
        '    ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y)
1972
        'ElseIf sConn1Type = "Line" And sConn2Type = "" Then
1973
        '    Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString()
1974
        '    ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y)
1975
        '    ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y)
1976

  
1977
        'ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then
1978
        '    iModelingType = 6
1979
        'ElseIf sConn1Type = "" And sConn2Type = "Line" Then
1980
        '    iModelingType = 7
1981
        'ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then
1982
        '    iModelingType = 8
1983
        'ElseIf sConn3Type = "Line" And sConn4Type = "Line" Then
1984
        '        iModelingType = 4
1985
        '    ElseIf sConn3Type = "Line" And sConn4Type = "Symbol" Then
1986
        '        iModelingType = 4
1987
        '    ElseIf sConn3Type = "Symbol" And sConn4Type = "Line" Then
1988
        '        iModelingType = 4
1989
        '    ElseIf sConn3Type = "Symbol" And sConn4Type = "Symbol" Then
1990
        '        iModelingType = 4
1991
        '    ElseIf sConn3Type = "Line" And sConn4Type = "" Then
1992
        '        iModelingType = 5
1993
        '    ElseIf sConn3Type = "Symbol" And sConn4Type = "" Then
1994
        '        iModelingType = 5
1995
        '    ElseIf sConn3Type = "" And sConn4Type = "Line" Then
1996
        '        iModelingType = 6
1997
        '    ElseIf sConn3Type = "" And sConn4Type = "Symbol" Then
1998
        '        iModelingType = 6
1999
        '    Else
2000
        '        iModelingType = 7
2001
        '    End If
2002

  
2003
        'If iModelingType = 1 Then
2004
        '        ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y)
2005
        '        ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y)
2006
        '    ElseIf iModelingType = 2 Then
2007
        '        ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y)
2008
        '    ElseIf iModelingType = 3 Then
2009
        '        ConvertPoint(oConn2Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y)
2010
        '    ElseIf iModelingType = 4 Then
2011
        '        ConvertPoint(oConn3Rows(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y)
2012
        '        ConvertPoint(oConn4Rows(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y)
2013
        '    ElseIf iModelingType = 5 Then
2014
        '        ConvertPoint(oConn3Rows(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y)
2015
        '    ElseIf iModelingType = 6 Then
2016
        '        ConvertPoint(oConn4Rows(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y)
2017
        '    End If
2018 1842
        Dim sFirstUid As String = ""
2019 1843
        Dim sSecondUid As String = ""
2020 1844
        Dim oLMSymbol As LMSymbol = Nothing
......
2038 1862
            sFirstUid = CheckExistModeling(oConn1Rows(0))
2039 1863
            sSecondUid = CheckExistModeling(oConn2Rows(0))
2040 1864
            Dim oCurrentLMConnector As LMConnector = Nothing
2041
            'If oStartLMConnector IsNot Nothing And oEndLMConnector IsNot Nothing Then
2042

  
2043
            '    '라인을 센터점에 먼저그리기
2044
            '    'If dConn1_x <> dConn2_x And dConn1_y <> dConn2_y Then
2045
            '    '    'Angle Valve
2046
            '    '    '라인두개 긋기
2047
            '    '    objInputs.Clear()
2048
            '    '    '   objInputs.AddPoint(dConn1_x, dConn1_y)
2049
            '    '    objInputs.AddConnectorTarget(oStartLMConnector, dConn1_x, dConn1_y)
2050
            '    '    objInputs.AddPoint(dOriginal_x, dOriginal_y)
2051

  
2052

  
2053
            '    '    Dim objItem As LMAItem
2054
            '    '    Dim sLineType As String = oConn1Rows(0)(_XML_LINE_TYPE).ToString()
2055
            '    '    Dim sLine1Path As String = GetPipeType(sLineType)
2056
            '    '    sLineType = oConn2Rows(0)(_XML_LINE_TYPE).ToString()
2057
            '    '    Dim sLine2Path As String = GetPipeType(sLineType)
2058
            '    '    If sLine1Path = sLine2Path Then
2059
            '    '        objItem = _Placement.PIDCreateItem(sLine1Path)
2060
            '    '        oCurrentLMConnector = _Placement.PIDPlaceRun(objItem, objInputs)
2061
            '    '    Else
2062
            '    '        '//서로다른선일경우 먼저 Symbol을 그리고 커넥션으로 부터 각 선까지 선을 잇는다.
2063
            '    '    End If
2064
            '    '    Dim sID_1 As String = ""
2065
            '    '    Dim sID_2 As String = ""
2066
            '    '    Dim sID_3 As String = ""
2067
            '    '    sID_1 = oStartLMConnector.ModelItemID
2068
            '    '    sID_2 = oCurrentLMConnector.ModelItemID
2069
            '    '    sID_3 = oEndLMConnector.ModelItemID
2070
            '    '    Try
2071

  
2072
            '    '        If sID_1 <> "" And sID_2 <> "" Then
2073
            '    '            Dim objSurvivorItem As LMAItem = Nothing
2074
            '    '            Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1)
2075
            '    '            Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2)
2076
            '    '            _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2)
2077
            '    '        End If
2078
            '    '    Catch ex As Exception
2079

  
2080
            '    '    End Try
2081
            '    '    objInputs.Clear()
2082
            '    '    '     objInputs.AddPoint(dOriginal_x, dOriginal_y)
2083
            '    '    objInputs.AddConnectorTarget(oStartLMConnector, dOriginal_x, dOriginal_y)
2084
            '    '    'objInputs.AddPoint(dConn2_x, dConn2_y)
2085
            '    '    objInputs.AddConnectorTarget(oEndLMConnector, dOriginal_x, dOriginal_y)
2086
            '    '    If sLine1Path = sLine2Path Then
2087
            '    '        objItem = _Placement.PIDCreateItem(sLine1Path)
2088
            '    '        oCurrentLMConnector = _Placement.PIDPlaceRun(objItem, objInputs)
2089
            '    '    Else
2090
            '    '        '//서로다른선일경우 먼저 Symbol을 그리고 커넥션으로 부터 각 선까지 선을 잇는다.
2091
            '    '    End If
2092

  
2093
            '    '    Try
2094
            '    '        sID_1 = oEndLMConnector.ModelItemID
2095
            '    '        sID_2 = oCurrentLMConnector.ModelItemID
2096
            '    '        If sID_1 <> "" And sID_2 <> "" Then
2097
            '    '            Dim objSurvivorItem As LMAItem = Nothing
2098
            '    '            Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1)
2099
            '    '            Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2)
2100
            '    '            _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2)
2101
            '    '        End If
2102
            '    '    Catch ex As Exception
2103
            '    '    End Try
2104
            '    'End If
2105
            'Else
2106
            '    If oStartLMConnector IsNot Nothing Then
2107
            '        dOriginal_x = dConn1_x
2108
            '        dOriginal_y = dConn1_y
2109
            '    Else
2110
            '        dOriginal_x = dConn2_x
2111
            '        dOriginal_y = dConn2_y
2112
            '    End If
2113
            'End If
1865

  
2114 1866
        ElseIf sConn1Type <> "" And sConn2Type = "" Then
2115 1867
            If sConn1Type = "Line" Then
2116 1868
                CheckConnectionLine(dConn1_x, dConn1_y, oStartLMConnector, sStartConnectionUid)
......
2148 1900

  
2149 1901
            sFirstUid = CheckExistModeling(oConn3Rows(0))
2150 1902
            sSecondUid = CheckExistModeling(oConn4Rows(0))
2151
            'If oStartLMConnector IsNot Nothing Then
2152
            '    dOriginal_x = dConn3_x
2153
            '    dOriginal_y = dConn3_y
2154
            'Else
2155
            '    dOriginal_x = dConn4_x
2156
            '    dOriginal_y = dConn4_y
2157
            'End If
2158 1903

  
2159 1904
        ElseIf sConn3Type <> "" And sConn4Type = "" Then
2160 1905
            If sConn1Type = "Line" Then
......
2179 1924
            sSecondUid = CheckExistModeling(oConn4Rows(0))
2180 1925

  
2181 1926
        Else
2182
            '      oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle)
1927

  
2183 1928
        End If
2184 1929

  
2185 1930
        If sFirstUid <> "" And sSecondUid <> "" Then
......
2201 1946
            oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol
2202 1947
        Else
2203 1948
            If oStartLMConnector IsNot Nothing And oEndLMConnector IsNot Nothing Then
2204
                'oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle, ExistingItem:=oStartLMConnector.AsLMAItem,
2205
                '            TargetItem:=oEndLMConnector.AsLMAItem)
2206
                'oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol
2207 1949
                oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle)
2208 1950
                oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol
2209 1951
            ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then
......
2233 1975
        oAddRow(_XML_SYMBOL_MAX_Y) = oCurrentSymbolRow(_XML_SYMBOL_MAX_Y)
2234 1976
        _ModelingSymbol_Dt.Rows.Add(oAddRow)
2235 1977

  
2236

  
2237

  
2238

  
2239 1978
        If sChildItem <> "" Then
2240 1979
            Dim sConn1_Systempath As String = ""
2241 1980
            Dim sConn2_Systempath As String = ""
......
2267 2006
                            End If
2268 2007
                        End If
2269 2008

  
2270
                        'If iType = 0 Then
2271
                        '    sConn1_Angle = GetChildSymbolDirection(sType)
2272
                        '    iType = iType + 1
2273
                        'Else
2274
                        '    Dim sStartpoint As String = oCurrentSymbolRow(_XML_SYMBOL_Conn1_Point).ToString()
2275
                        '    ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y)
2276
                        '    ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y)
2277
                        '    sConn1_Systempath = GetDataFromMappingDB(sType, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH)
2278
                        '    If oStartLMConnector Is Nothing Then
2279
                        '        Dim dChildConn1_x As Double = 0
2280
                        '        Dim dChildConn1_y As Double = 0
2281
                        '        _Placement.PIDConnectPointLocation(oLMSymbol, 1, dChildConn1_x, dChildConn1_y)
2282
                        '        If oLMSymbol.Connect1Connectors.Count = 0 And oLMSymbol IsNot Nothing Then
2283
                        '            _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2284
                        '             TargetItem:=oLMSymbol.AsLMAItem)
2285
                        '        Else
2286
                        '            For Each oConnector In oLMSymbol.Connect1Connectors
2287
                        '                _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2288
                        '                TargetItem:=oConnector.AsLMAItem)
2289
                        '            Next
2290
                        '        End If
2291

  
2292
                        '    Else
2293
                        '        _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn1_x, dConn1_y,, sConn1_Angle,,
2294
                        '                    TargetItem:=oLMSymbol.AsLMAItem)
2295
                        '        'oLMSymbol = _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn1_x, dConn1_y,, sConn1_Angle,,
2296
                        '        'TargetItem:=oStartLMConnector.AsLMAItem)
2297
                        '    End If
2298

  
2299
                        'End If
2300 2009
                    Else
2301 2010
                        If iType = 0 Then
2302 2011
                            sConn2_Angle = GetChildSymbolDirection(sType)
......
2319 2028
                            End If
2320 2029

  
2321 2030
                        End If
2322

  
2323

  
2324
                        'If iType = 0 Then
2325
                        '    sConn2_Angle = GetChildSymbolDirection(sType)
2326
                        '    iType = iType + 1
2327
                        'Else
2328
                        '    Dim sEndPoint As String = oCurrentSymbolRow(_XML_SYMBOL_Conn2_Point).ToString()
2329
                        '    ConvertPointBystring(sEndPoint, dConn2_x, dConn2_y)
2330
                        '    ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y)
2331
                        '    sConn2_Systempath = GetDataFromMappingDB(sType, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH)
2332
                        '    If oEndLMConnector Is Nothing Then
2333
                        '        Dim dChildConn2_x As Double = 0
2334
                        '        Dim dChildConn2_y As Double = 0
2335
                        '        _Placement.PIDConnectPointLocation(oLMSymbol, 2, dChildConn2_x, dChildConn2_y)
2336
                        '        If oLMSymbol.Connect2Connectors.Count = 0 And oLMSymbol IsNot Nothing Then
2337
                        '            _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2338
                        '            TargetItem:=oLMSymbol.AsLMAItem)
2339
                        '        Else
2340
                        '            For Each oConnector In oLMSymbol.Connect2Connectors
2341
                        '                oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2342
                        '                TargetItem:=oConnector.AsLMAItem)
2343
                        '            Next
2344
                        '        End If
2345

  
2346
                        '    Else
2347
                        '        _Placement.PIDPlaceSymbol(sConn1_Systempath, dConn2_x, dConn2_y,, sConn2_Angle,,
2348
                        '            TargetItem:=oLMSymbol.AsLMAItem)
2349
                        '        '    oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dConn2_x, dConn2_y,, sConn2_Angle,,
2350
                        '        'TargetItem:=oEndLMConnector.AsLMAItem)
2351
                        '    End If
2352

  
2353
                        'End If
2354 2031
                    End If
2355 2032
                Next
2356 2033
            Next
2357

  
2358

  
2359
            'If sConn1_Systempath <> "" Then
2360
            '    Dim oConn1s As LMConnectors = oLMSymbol.Connect1Connectors
2361
            '    Dim dChildConn1_x As Double = 0
2362
            '    Dim dChildConn1_y As Double = 0
2363
            '    _Placement.PIDConnectPointLocation(oLMSymbol, 1, dChildConn1_x, dChildConn1_y)
2364
            '    oLMSymbol = _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle)
2365
            '    'For Each oConnector In oLMSymbol.Connect1Connectors
2366
            '    '    oLMSymbol = _Placement.PIDPlaceSymbol(sConn1_Systempath, dChildConn1_x, dChildConn1_y,, sConn1_Angle,,
2367
            '    '    TargetItem:=oConnector.AsLMAItem)
2368
            '    'Next
2369
            'End If
2370

  
2371
            'If sConn2_Systempath <> "" Then
2372
            '    Dim oConn2s As LMConnectors = oLMSymbol.Connect2Connectors
2373
            '    Dim dChildConn2_x As Double = 0
2374
            '    Dim dChildConn2_y As Double = 0
2375
            '    _Placement.PIDConnectPointLocation(oLMSymbol, 2, dChildConn2_x, dChildConn2_y)
2376
            '    oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle)
2377
            '    'For Each oConnector In oLMSymbol.Connect2Connectors
2378
            '    '    oLMSymbol = _Placement.PIDPlaceSymbol(sConn2_Systempath, dChildConn2_x, dChildConn2_y,, sConn2_Angle,,
2379
            '    '    TargetItem:=oConnector.AsLMAItem)
2380
            '    'Next
2381
            'End If
2382
            ''Child 모델링
2383

  
2384

  
2385

  
2386

  
2387

  
2388

  
2389

  
2390 2034
        End If
2391 2035

  
2392

  
2393

  
2394

  
2395

  
2396 2036
        AddProgress()
2397 2037

  
2398 2038
        SetListBoxItems(ListBox_Result, "Place Fitting.." & sUid & " (" & dOriginal_x & "," & dOriginal_y & ")..." & _iFittingcnt & " count ")
......
2413 2053
        _iFittingcnt = _iFittingcnt + 1
2414 2054
        oCurrentSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE"
2415 2055

  
2416

  
2417

  
2418

  
2419

  
2420

  
2421

  
2422

  
2423 2056
        Dim oAttributeRow() As DataRow
2424 2057
        oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'")
2425 2058
        If oAttribute_Dt.Rows.Count > 0 Then
......
2461 2094
                End Try
2462 2095
            End If
2463 2096
        End If
2464
        'Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'")
2465
        'If oAttributeRow.Length > 0 Then
2466
        '    For Each oAttribute In oAttributeRow
2467
        '        Try
2468
        '            Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString()
2469
        '            Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString()
2470
        '            If sPIDValue.Contains("'") Then
2471
        '                sPIDValue = sPIDValue.Replace("'", """")
2472
        '            End If
2473
        '            Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE)
2474
        '            oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue
2475
        '        Catch ex As Exception
2476
        '        End Try
2477
        '    Next
2478
        'End If
2479 2097

  
2480 2098
        Return sReturnUid
2481

  
2482

  
2483
        '현재 Uid 모델링
2484 2099
    End Function
2485

  
2486 2100
    Private Function GetChildSymbolDirection(ByVal sDirection As String) As Double
2487 2101
        Dim sReturnDirection As String = ""
2488 2102
        If sDirection.ToUpper() = "RIGHT" Then
......
2498 2112
        End If
2499 2113
    End Function
2500 2114

  
2501

  
2502

  
2503 2115
    Private Function CheckExistModeling(ByVal oRow As DataRow) As String
2504 2116
        If oRow(_XML_LINE_DRAWING_TF).ToString() = "FALSE" And oRow(_XML_LINE_Check).ToString() = "TRUE" Then
2505 2117
            Return oRow(_XML_LINE_UID).ToString()
......
2518 2130
                                  ByVal oAttribute_Dt As DataTable) As String
2519 2131
        Dim sReturnUid As String = ""
2520 2132
        Try
2521

  
2522
            '현재 Uid  모델링 여부 체크
2523
            'Dim sStartpoint As String = ""
2524
            'Dim sEndpoint As String = ""
2525
            'Dim dOriginalStart_x As Double = 0.0
2526
            'Dim dOriginalStart_y As Double = 0.0
2527
            'Dim dOriginalEnd_x As Double = 0.0
2528
            'Dim dOriginalEnd_y As Double = 0.0
2133
            Dim bCheckBranchItem As Boolean = False
2529 2134
            Dim dCenterPos_x As Double = 0.0
2530 2135
            Dim dCenterPos_y As Double = 0.0
2531 2136
            Dim objItem As LMAItem
2532

  
2533 2137
            Dim sUid As String = oCurrentLineRow(_XML_LINE_UID).ToString()
2534 2138
            Dim sLineType As String = oCurrentLineRow(_XML_LINE_TYPE).ToString()
2535 2139
            Dim sSystemPath As String = GetPipeType(sLineType)
2536 2140
            Dim sLineNoText As String = oCurrentLineRow(_XML_LINENO_TEXT).ToString()
2537 2141
            Dim sLineNoUid As String = oCurrentLineRow(_XML_LINE_LINENOUID).ToString()
2538
            'sStartpoint = oCurrentLineRow(_XML_LINE_STARTPOINT).ToString()
2539
            'ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y)
2540
            'ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y)
2541
            'sEndpoint = oCurrentLineRow(_XML_LINE_ENDPOINT).ToString()
2542
            'ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y)
2543
            'ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y)
2544

  
2545

  
2546 2142
            Dim dStart_Dwg_x As Double = oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_X)
2547 2143
            Dim dStart_Dwg_y As Double = oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_Y)
2548 2144
            Dim dEnd_Dwg_x As Double = oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_X)
2549 2145
            Dim dEnd_Dwg_y As Double = oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_Y)
2550 2146
            Dim sPreFlowDirection As String = ""
2551 2147
            Dim sFlowDirection As String = oCurrentLineRow(_XML_LINE_FlowDirection)
2552

  
2553 2148
            Dim sPreConn1Direction As String = ""
2554 2149
            Dim sPreConn2Direction As String = ""
2555 2150
            Dim sDirection As String = oCurrentLineRow(_XML_LINE_Direction)
2556

  
2557 2151
            dCenterPos_x = Math.Abs(dStart_Dwg_x + dEnd_Dwg_x) / 2
2558 2152
            dCenterPos_y = Math.Abs(dStart_Dwg_y + dEnd_Dwg_y) / 2
2559

  
2560

  
2561 2153
            Dim oPidDataSource As LMADataSource = Nothing
2562

  
2563 2154
            Try
2564 2155
                oPidDataSource = _Placement.PIDDataSource
2565 2156
            Catch ex As Exception
2566 2157
                CheckOpenDrawing()
2567 2158
                oPidDataSource = _Placement.PIDDataSource
2568 2159
            End Try
2569

  
2570 2160
            'Connection 정보 체크, 모델링 되어 있는지 유무
2571 2161
            '양 커넥션의 모델링 유무를 체크한다.
2572 2162
            Dim sConn1Uid As String = oCurrentLineRow(_XML_LINE_Conn1_Uid).ToString()
2573 2163
            Dim sConn2Uid As String = oCurrentLineRow(_XML_LINE_Conn2_Uid).ToString()
2574 2164
            Dim sConn1Type As String = ""
2575 2165
            Dim sConn2Type As String = ""
2576

  
2577 2166
            Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'")
2578 2167
            If oConn1Rows.Length = 0 Then
2579 2168
                oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'")
2580 2169
                If oConn1Rows.Length = 1 Then
2581 2170
                    sConn1Type = "Line"
2582
                    'sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString()
2583
                    'If sDirection = sPreConn1Direction Then
2584
                    '    If sDirection = "X" Then
2585
                    '        dStart_Dwg_y = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2586
                    '        dEnd_Dwg_y = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2587
                    '    Else
2588
                    '        dStart_Dwg_x = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2589
                    '        dEnd_Dwg_x = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2590
                    '    End If
2591
                    'End If
2592

  
2593 2171
                End If
2594 2172
            Else
2595

  
2596 2173
                Dim oOriginalPoint As String = oConn1Rows(0)(_XML_SYMBOL_ORIGINALPOINT)
2597 2174
                ConvertPointBystring(oOriginalPoint, dStart_Dwg_x, dStart_Dwg_y)
2598 2175
                ConvertPointByImage(dStart_Dwg_x, dStart_Dwg_y, _IMG_X, _IMG_Y)
......
2600 2177
                oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_Y) = dStart_Dwg_y
2601 2178
                sConn1Type = "Symbol"
2602 2179
            End If
2603

  
2604 2180
            Dim oConn2Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn2Uid & "'")
2605 2181
            If oConn2Rows.Length = 0 Then
2606 2182
                oConn2Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn2Uid & "'")
2607 2183
                If oConn2Rows.Length = 1 Then
2608 2184
                    sConn2Type = "Line"
2609
                    'sPreConn2Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString()
2610
                    'If sDirection = sPreConn2Direction Then
2611
                    '    If sDirection = "X" Then
2612
                    '        dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2613
                    '        dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2614
                    '    Else
2615
                    '        dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2616
                    '        dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2617
                    '    End If
2618
                    'End If
2619 2185
                End If
2620 2186
            Else
2621 2187
                Dim oOriginalPoint As String = oConn2Rows(0)(_XML_SYMBOL_ORIGINALPOINT)
......
2625 2191
                oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_Y) = dEnd_Dwg_y
2626 2192
                sConn2Type = "Symbol"
2627 2193
            End If
2628

  
2629

  
2630
            If sConn1Type = "Symbol" Then
2631

  
2632

  
2633

  
2634
            End If
2635

  
2636 2194
            Dim sConn1LineNo As String = ""
2637 2195
            Dim sConn2LineNo As String = ""
2638 2196
            Dim oLMConnector As LMConnector = Nothing
......
2662 2220
            Else
2663 2221
                iModelingType = 4
2664 2222
            End If
2665

  
2666 2223
            Dim dPreConnX As Double = 0
2667 2224
            Dim dPreConnY As Double = 0
2668

  
2669 2225
            Dim sStartConnectionUid As String = ""
2670 2226
            Dim sEndConnectionUid As String = ""
2227
            Dim bAlreadyCheckBranchLine As Boolean = False
2228
            '브런치라인이 먼저있는상태에서 메인라인을 그릴경우..해당되는 브런치라인 수 만큼 라인을 따로 생성 
2229
            If CheckAlreadyBranchLine(sSystemPath, dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y) = False Then
2671 2230

  
2672
            '   Dim sTargetDirection As String = CheckBranchLine(dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y, oLMConnector)
2673

  
2674
            ' If sTargetDirection = "" Then
2675
            CheckConnectionLine(dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector, sStartConnectionUid)
2676

  
2677
            If oStartLMConnector Is Nothing Then
2678
                UpdateCheckBranchLine(dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector, sStartConnectionUid)
2231
                CheckConnectionLine(dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector, sStartConnectionUid)
2679 2232
                If oStartLMConnector Is Nothing Then
2680
                    oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2681
                    If oLMSymbol1 IsNot Nothing Then
2682
                        sConn1Type = "Symbol"
2233
                    bCheckBranchItem = UpdateCheckBranchLine(dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector, sStartConnectionUid)
2234
                    If oStartLMConnector Is Nothing Then
2235
                        oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2236
                        If oLMSymbol1 IsNot Nothing Then
2237
                            sConn1Type = "Symbol"
2238
                        Else
2239
                            sConn1Type = ""
2240
                        End If
2683 2241
                    Else
2684
                        sConn1Type = ""
2242
                        sConn1Type = "Line"
2685 2243
                    End If
2686 2244
                Else
2687 2245
                    sConn1Type = "Line"
2688
                    'sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString()
2689
                    'If sDirection = sPreConn1Direction Then
2690
                    '    If sDirection = "X" Then
2691
                    '        dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2692
                    '        dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2693
                    '    Else
2694
                    '        dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2695
                    '        dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2696
                    '    End If
2697
                    'End If
2698 2246
                End If
2699
            Else
2700
                sConn1Type = "Line"
2701

  
2702
            End If
2703
            CheckConnectionLine(dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector, sEndConnectionUid)
2704
            If oEndLMConnector Is Nothing Then
2705
                UpdateCheckBranchLine(dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector, sEndConnectionUid)
2247
                CheckConnectionLine(dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector, sEndConnectionUid)
2706 2248
                If oEndLMConnector Is Nothing Then
2707
                    oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2708
                    If oLMSymbol2 IsNot Nothing Then
2709
                        sConn2Type = "Symbol"
2249
                    bCheckBranchItem = UpdateCheckBranchLine(dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector, sEndConnectionUid)
2250
                    If oEndLMConnector Is Nothing Then
2251
                        oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2252
                        If oLMSymbol2 IsNot Nothing Then
2253
                            sConn2Type = "Symbol"
2254
                        End If
2255
                    Else
2256
                        sConn2Type = "Line"
2710 2257
                    End If
2711 2258
                Else
2712 2259
                    sConn2Type = "Line"
2713 2260
                End If
2714
            Else
2715
                sConn2Type = "Line"
2716
                    'sPreConn2Direction = oConn2Rows(0)(_XML_LINE_Direction).ToString()
2717
                    'If sDirection = sPreConn2Direction Then
2718
                    '    If sDirection = "X" Then
2719
                    '        dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2720
                    '        dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y)
2721
                    '    Else
2722
                    '        dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2723
                    '        dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X)
2724
                    '    End If
2725
                    'End If
2726
                End If
2727
                'Else
2728
                '    If sTargetDirection = "START" Then
2729
                '        oStartLMConnector = oLMConnector
2730
                '        sConn1Type = "Line"
2731
                '    ElseIf sTargetDirection = "END" Then
2732
                '        oEndLMConnector = oLMConnector
2733
                '        sConn2Type = "Line"
2734
                '    End If
2735
                'End If
2736

  
2261
                Dim sFirstUid As String = ""
2262
                Dim sSecondUid As String = ""
2263
                Try
2264
                    If oStartLMConnector Is Nothing And oEndLMConnector Is Nothing Then
2265
                        If oLMSymbol1 Is Nothing Then
2266
                            objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y)
2267
                        Else
2268
                            objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2269
                        End If
2737 2270

  
2271
                        If oLMSymbol2 Is Nothing Then
2272
                            objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y)
2273
                        Else
2274
                            objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2275
                        End If
2738 2276

  
2277
                    ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then
2278
                        If sConn1Type = "Line" Then
2279
                            objInputs.AddConnectorTarget(oStartLMConnector, dStart_Dwg_x, dStart_Dwg_y)
2280
                        Else
2281
                            objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2282
                        End If
2283
                        If oLMSymbol2 Is Nothing Then
2284
                            objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y)
2285
                        Else
2286
                            objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2287
                        End If
2739 2288

  
2289
                    ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then
2290
                        If sConn2Type = "Line" Then
2291
                            objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dEnd_Dwg_y)
2292
                        Else
2293
                            objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2294
                        End If
2295
                        If oLMSymbol1 Is Nothing Then
2296
                            objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y)
2297
                        Else
2298
                            objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2299
                        End If
2740 2300

  
2301
                    Else
2302
                        If sConn1Type = "Line" Then
2303
                            objInputs.AddConnectorTarget(oStartLMConnector, dStart_Dwg_x, dStart_Dwg_y)
2304
                        Else
2305
                            objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2306
                        End If
2307
                        If sConn2Type = "Line" Then
2308
                            objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dEnd_Dwg_y)
2309
                        Else
2310
                            objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2311
                        End If
2741 2312

  
2313
                    End If
2314
                    If sConn1Type <> "" And sConn2Type <> "" Then
2315
                        If oConn1Rows.Count > 0 Then
2316
                            sFirstUid = CheckExistModeling(oConn1Rows(0))
2317
                        End If
2318
                        If oConn2Rows.Count > 0 Then
2319
                            sSecondUid = CheckExistModeling(oConn2Rows(0))
2320
                        End If
2742 2321

  
2743
                'If iModelingType = 1 Then
2744
                '    If sConn1Type = "Line" Then
2745
                '        CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2746
                '    Else
2747
                '        oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2748
                '    End If
2749
                '    If sConn1Type = "Line" Then
2750
                '        CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2751
                '    Else
2752
                '        oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2753
                '    End If
2754
                '    'CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2755
                '    'CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2756
                'ElseIf iModelingType = "2" Then
2757
                '    If sConn1Type = "Line" Then
2758
                '        CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2759
                '    Else
2760
                '        oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector)
2761
                '    End If
2762
                '    ' CheckConnectionLine(oConn2Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector)
2763
                'ElseIf iModelingType = "3" Then
2764
                '    If sConn1Type = "Line" Then
2765
                '        CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector)
2766
                '    Else
2767
                '        oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector)
2768
                '    End If
2769
                '    ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oStartLMConnector)
2322
                    ElseIf sConn1Type <> "" And sConn2Type = "" Then
2323
                        If oConn1Rows.Count > 0 Then
2324
                            sFirstUid = CheckExistModeling(oConn1Rows(0))
2325
                        End If
2770 2326

  
2771
                'Else
2772
                '    'objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y)
2773
                '    'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y)
2774
                'End If
2327
                    ElseIf sConn1Type = "" And sConn2Type <> "" Then
2328
                        If oConn2Rows.Count > 0 Then
2329
                            sSecondUid = CheckExistModeling(oConn2Rows(0))
2330
                        End If
2775 2331

  
2776
                Dim sFirstUid As String = ""
2777
            Dim sSecondUid As String = ""
2778
            Try
2779
                If oStartLMConnector Is Nothing And oEndLMConnector Is Nothing Then
2780
                    If oLMSymbol1 Is Nothing Then
2781
                        objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y)
2782
                    Else
2783
                        objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2784 2332
                    End If
2785 2333

  
2786
                    If oLMSymbol2 Is Nothing Then
2787
                        objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y)
2334
                    If sFirstUid <> "" And sSecondUid <> "" Then
2335
                        sReturnUid = sSecondUid
2336
                    ElseIf sFirstUid = "" And sSecondUid <> "" Then
2337
                        sReturnUid = sSecondUid
2338
                    ElseIf sFirstUid <> "" And sSecondUid = "" Then
2339
                        sReturnUid = sFirstUid
2788 2340
                    Else
2789
                        objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2341
                        sReturnUid = ""
2790 2342
                    End If
2343
                    _iPipecnt = _iPipecnt + 1
2791 2344

  
2792
                    'objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y)
2793
                    'objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y)
2794
                    'sFirstUid = CheckExistModeling(oConn1Rows(0))
2795
                    'sSecondUid = CheckExistModeling(oConn2Rows(0))
2796
                ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then
2797
                    If sConn1Type = "Line" Then
2798
                        objInputs.AddConnectorTarget(oStartLMConnector, dStart_Dwg_x, dStart_Dwg_y)
2799
                    Else
2800
                        objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2801
                    End If
2802
                    If oLMSymbol2 Is Nothing Then
2803
                        objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y)
2804
                    Else
2805
                        objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2806
                    End If
2345
                    '배관 모델링
2346
                    Dim oCurrentConnector As LMConnector = LineModeling(objInputs, sSystemPath)
2347

  
2348
                    If oCurrentConnector IsNot Nothing Then
2349
                        oCurrentLineRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector
2350
                        oCurrentLineRow(_XML_LINE_DRAWING_TF) = "TRUE"
2351
                        '로그 출력
2352
                        AddLog(sUid, sSystemPath, dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y, sLineNoText, sConn1Uid, sConn2Uid)
2353
                        Dim oPipeRun As LMPipeRun = oPidDataSource.GetPipeRun(oCurrentConnector.ModelItemID)
2354
                        '배관 속성 입력
2355
                        AddAttribute(oPipeRun, oAttribute_Dt, sLineNoUid)
2356

  
2357
                        Dim sID_1 As String = ""
2358
                        Dim sID_2 As String = ""
2359
                        Dim oAddConnector As LMConnector = Nothing
2360
                        If oStartLMConnector IsNot Nothing Then
2361
                            sID_1 = oStartLMConnector.ModelItemID
2362
                            sID_2 = oCurrentConnector.ModelItemID
2363
                            oAddConnector = oStartLMConnector
2364
                        ElseIf oEndLMConnector IsNot Nothing Then
2365
                            sID_1 = oEndLMConnector.ModelItemID
2366
                            sID_2 = oCurrentConnector.ModelItemID
2367
                            oAddConnector = oEndLMConnector
2368
                        End If
2369
                        If sID_1 <> "" And sID_2 <> "" Then
2370
                            'PipeRun 합치기
2371
                            JoinPipeRun(sID_1, sID_2)
2807 2372

  
2808
                    '    sSecondUid = CheckExistModeling(oConn2Rows(0))
2809
                ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then
2810
                    If sConn2Type = "Line" Then
2811
                        objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dEnd_Dwg_y)
2812
                    Else
2813
                        objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2814
                    End If
2815
                    If oLMSymbol1 Is Nothing Then
2816
                        objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y)
2373
                            If bCheckBranchItem Then
2374
                                '모델링 된 PipeLine 데이터 테이블 저장
2375
                                AddModelingDT(sUid, oCurrentConnector.ModelItemID, oCurrentConnector, dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y)
2376
                            Else
2377
                                '모델링 된 PipeLine 데이터 테이블 저장
2378
                                AddModelingDT(sUid, sID_1, oAddConnector, dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y)
2379
                            End If
2380
                        Else
2381
                            '모델링 된 PipeLine 데이터 테이블 저장
2382
                            AddModelingDT(sUid, oCurrentConnector.ModelItemID, oCurrentConnector, dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y)
2383
                        End If
2384
                        '//2018.09.07 LMControl에 따라서 inconsitency가 달라지는듯 확인
2385
                        If sStartConnectionUid <> "" Then
2386
                            Dim oChangeRow() As DataRow = _ModelingLine_Dt.Select(_XML_LINE_UID & " = '" & sStartConnectionUid & "'")
2387
                            If oChangeRow.Length = 1 Then
2388
                                oChangeRow(0)(_XML_LINE_SPID) = sID_1
2389
                                oChangeRow(0)(_XML_LINE_LMCONNECTOR) = oAddConnector
2390
                            End If
2391
                        End If
2392
                        If sEndConnectionUid <> "" Then
2393
                            Dim oChangeRow() As DataRow = _ModelingLine_Dt.Select(_XML_LINE_UID & " = '" & sEndConnectionUid & "'")
2394
                            If oChangeRow.Length = 1 Then
2395
                                oChangeRow(0)(_XML_LINE_SPID) = sID_1
2396
                                oChangeRow(0)(_XML_LINE_LMCONNECTOR) = oAddConnector
2397
                            End If
2398
                        End If
2817 2399
                    Else
2818
                        objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2400
                        sReturnUid = ""
2819 2401
                    End If
2402
                Catch ex As Exception
2403
                End Try
2404
            End If
2405
        Catch ex As Exception
2406
        End Try
2407
        Return sReturnUid
2408
        '현재 Uid 모델링
2409
    End Function
2410
    Private Sub AddLog(ByVal sUid As String, ByVal sSystemPath As String,
2411
                             ByVal dStart_Dwg_x As Double, ByVal dStart_Dwg_y As Double, ByVal dEnd_Dwg_x As Double, ByVal dEnd_Dwg_y As Double,
2412
                       ByVal sLineNoText As String, ByVal sConn1Uid As String, ByVal sConn2Uid As String)
2413
        SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dStart_Dwg_x & "," & dStart_Dwg_y & ") - (" & dEnd_Dwg_x & "," & dEnd_Dwg_y & ")..." & _iPipecnt & " count ")
2414
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid)
2415
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText)
2416
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & sConn1Uid)
2417
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & sConn2Uid)
2418
        'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle)
2419
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dStart_Dwg_x & "," & dStart_Dwg_y)
2420
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dEnd_Dwg_x & "," & dEnd_Dwg_y)
2421
        ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt)
2422
    End Sub
2820 2423

  
2424
    Private Sub AddAttribute(ByVal oPipeRun As LMPipeRun, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String)
2425
        Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'")
2426
        If oAttributeRow.Length > 0 Then
2427
            For Each oAttribute In oAttributeRow
2428
                Try
2429
                    Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString()
2430
                    Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString()
2431
                    If sPIDValue.Contains("'") Then
2432
                        sPIDValue = sPIDValue.Replace("'", """")
2433
                    End If
2434
                    Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE)
2435
                    oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue
2436
                Catch ex As Exception
2437
                End Try
2438
            Next
2439
            oPipeRun.Commit()
2440
        End If
2441
    End Sub
2821 2442

  
2822
                    'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y)
2443
    Private Sub AddModelingDT(ByVal sUid As String, ByVal sModelID As String, ByVal oCurrentConnector As LMConnector,
2444
                              ByVal dStart_Dwg_x As Double, ByVal dStart_Dwg_y As Double,
2445
                              ByVal dEnd_Dwg_x As Double, ByVal dEnd_Dwg_y As Double)
2446
        Dim oAddRow As DataRow = _ModelingLine_Dt.NewRow
2447
        oAddRow(_XML_LINE_UID) = sUid
2448
        oAddRow(_XML_LINE_SPID) = sModelID
2449
        oAddRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector
2450
        oAddRow(_XML_LINE_DRAWING_TF) = "TRUE"
2451
        oAddRow(_XML_LINE_DWG_STARTPOINT_X) = dStart_Dwg_x
2452
        oAddRow(_XML_LINE_DWG_STARTPOINT_Y) = dStart_Dwg_y
2453
        oAddRow(_XML_LINE_DWG_ENDPOINT_X) = dEnd_Dwg_x
2454
        oAddRow(_XML_LINE_DWG_ENDPOINT_Y) = dEnd_Dwg_y
2455
        _ModelingLine_Dt.Rows.Add(oAddRow)
2456
    End Sub
2823 2457

  
2824
                    '   sFirstUid = CheckExistModeling(oConn1Rows(0))
2825
                Else
2826
                    If sConn1Type = "Line" Then
2827
                        objInputs.AddConnectorTarget(oStartLMConnector, dStart_Dwg_x, dStart_Dwg_y)
2828
                    Else
2829
                        objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y)
2830
                    End If
2831
                    If sConn2Type = "Line" Then
2832
                        objInputs.AddConnectorTarget(oStartLMConnector, dEnd_Dwg_x, dEnd_Dwg_y)
2833
                    Else
2834
                        objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y)
2835
                    End If
2836
                    'objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y)
2837
                    'objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dOriginalEnd_y)
2838
                End If
2839
                If sConn1Type <> "" And sConn2Type <> "" Then
2840
                    If oConn1Rows.Count > 0 Then
2841
                        sFirstUid = CheckExistModeling(oConn1Rows(0))
2842
                    End If
2843
                    If oConn2Rows.Count > 0 Then
2844
                        sSecondUid = CheckExistModeling(oConn2Rows(0))
2845
                    End If
2846

  
2847
                ElseIf sConn1Type <> "" And sConn2Type = "" Then
2848
                    If oConn1Rows.Count > 0 Then
2849
                        sFirstUid = CheckExistModeling(oConn1Rows(0))
2850
                    End If
2458
    Private Function JoinPipeRun(ByVal sID_1 As String, ByVal sID_2 As String) As Boolean
2459
        Try
2460
            Dim objSurvivorItem As LMAItem = Nothing
2461
            Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1)
2462
            Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2)
2463
            _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2)
2464
            Return True
2465
        Catch ex As Exception
2466
            Return False
2467
        End Try
2468
    End Function
2851 2469

  
2852
                ElseIf sConn1Type = "" And sConn2Type <> "" Then
2853
                    If oConn2Rows.Count > 0 Then
2854
                        sSecondUid = CheckExistModeling(oConn2Rows(0))
2855
                    End If
2856 2470

  
2857
                End If
2471
    Private Function LineModeling(ByVal objInputs As PlaceRunInputs, ByVal sSystemPath As String) As LMConnector
2472
        Dim oCurrentConnector As LMConnector = Nothing
2473
        Dim objItem As LMAItem
2474
        objItem = _Placement.PIDCreateItem(sSystemPath)
2475
        Try
2476
            oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs)
2477
            AddProgress()
2478
        Catch ex As Exception
2479
        End Try
2480
        Return oCurrentConnector
2481
    End Function
2858 2482

  
2859
                If sFirstUid <> "" And sSecondUid <> "" Then
2860
                    sReturnUid = sSecondUid
2861
                ElseIf sFirstUid = "" And sSecondUid <> "" Then
2862
                    sReturnUid = sSecondUid
2863
                ElseIf sFirstUid <> "" And sSecondUid = "" Then
2864
                    sReturnUid = sFirstUid
2865
                Else
2866
                    sReturnUid = ""
2483
    Private Sub InstumentLineModeling(ByVal CLineNo As Line_no, ByVal oNode As TreeNode)
2484
        If CLineNo IsNot Nothing Then
2485
            Dim oLine_Dt As DataTable = CLineNo.Dt_Line
2486
            Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol
2487
            Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute
2488
            Dim oDrawLinenoLabel As Boolean = False
2489
            For Each oSymbolNode As TreeNode In oNode.Nodes
2490
                If oSymbolNode.Checked Then
2491
                    Try
2492
                        Dim sUid As String = oSymbolNode.Name
2493
                        Dim sLineNoUid As String = CLineNo.Uid
2494
                        Dim sReturnUid = sUid
2495
                        '  FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt)
2496
                        While True
2497
                            Dim oLineRows As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" &
2498
                                               _XML_SYMBOL_Check & "] = 'TRUE' And [" & _XML_LINE_ValieLine & "] = 'True'")
2499
                            If oLineRows.Count > 0 Then
2500
                                Dim sPipeType As String = oLineRows(0)(_XML_LINE_TYPE).ToString()
2501
                                If sPipeType.ToUpper() <> "PRIMARY" Then
2502
                                    sReturnUid = FinalLineModeling(oLineRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt)
2503
                                Else
2504
                                    sReturnUid = ""
2505
                                End If
2506
                            Else
2507
                                sReturnUid = ""
2508
                            End If
2509
                            If sReturnUid = "" Then
2510
                                Exit While
2511
                            End If
2512
                        End While
2513
                    Catch ex As Exception
2514
                    End Try
2867 2515
                End If
2868
                _iPipecnt = _iPipecnt + 1
2869
                Dim oCurrentConnector As LMConnector = Nothing
2870

  
2871
                objItem = _Placement.PIDCreateItem(sSystemPath)
2872
                Try
2873
                    If Chk_OnlyPoint.Checked Then
2874
                        objInputs.Clear()
2875
                        objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y)
2876
                        objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y)
2877
                        oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs)
2878
                    Else
2879
                        oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs)
2880
                    End If
2881
                    AddProgress()
2882

  
2883
                Catch ex As Exception
2884

  
2885
                End Try
2886
                If oCurrentConnector IsNot Nothing Then
2887
                    oCurrentLineRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector
2888
                    oCurrentLineRow(_XML_LINE_DRAWING_TF) = "TRUE"
2889

  
2890
                    SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dStart_Dwg_x & "," & dStart_Dwg_y & ") - (" & dEnd_Dwg_x & "," & dEnd_Dwg_y & ")..." & _iPipecnt & " count ")
2891

  
2892
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid)
2893
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText)
2894
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oCurrentLineRow(_XML_SYMBOL_Conn1_Uid).ToString())
2895
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oCurrentLineRow(_XML_SYMBOL_Conn2_Uid).ToString())
2896
                    'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle)
2897
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dStart_Dwg_x & "," & dStart_Dwg_y)
2898
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dEnd_Dwg_x & "," & dEnd_Dwg_y)
2899
                    ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt)
2900

  
2901
                    Dim oPipeRun As LMPipeRun = oPidDataSource.GetPipeRun(oCurrentConnector.ModelItemID)
2902

  
2903
                    '모델링 된 PipeLine 데이터 테이블 저장
2904
                    Dim oAddRow As DataRow = _ModelingLine_Dt.NewRow
2905
                    oAddRow(_XML_LINE_UID) = sUid
2906
                    oAddRow(_XML_LINE_SPID) = oCurrentConnector.ModelItemID
2907
                    oAddRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector
2908
                    oAddRow(_XML_LINE_DRAWING_TF) = "TRUE"
2909
                    oAddRow(_XML_LINE_DWG_STARTPOINT_X) = dStart_Dwg_x
2910
                    oAddRow(_XML_LINE_DWG_STARTPOINT_Y) = dStart_Dwg_y
2911
                    oAddRow(_XML_LINE_DWG_ENDPOINT_X) = dEnd_Dwg_x
2912
                    oAddRow(_XML_LINE_DWG_ENDPOINT_Y) = dEnd_Dwg_y
2913
                    _ModelingLine_Dt.Rows.Add(oAddRow)
2914

  
2516
            Next
2517
        End If
2518
    End Sub
2915 2519

  
2916
                    Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'")
2917
                    If oAttributeRow.Length > 0 Then
2918
                        For Each oAttribute In oAttributeRow
2919
                            Try
2920
                                Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString()
2921
                                Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString()
2922
                                If sPIDValue.Contains("'") Then
2923
                                    sPIDValue = sPIDValue.Replace("'", """")
2520
    Private Sub PipeLineModeling(ByVal CLineNo As Line_no, ByVal oNode As TreeNode)
2521
        If CLineNo IsNot Nothing Then
2522
            Dim oLine_Dt As DataTable = CLineNo.Dt_Line
2523
            Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol
2524
            Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute
2525
            Dim oDrawLinenoLabel As Boolean = False
2526
            Try
2527
                ManualCheckNode(oLine_Dt)
2528
                ManualCheckNode(oSymbol_Dt)
2529
            Catch ex As Exception
2530
            End Try
2531
            For Each oSymbolNode As TreeNode In oNode.Nodes
2532
                If oSymbolNode.Checked Then
2533
                    Try
2534
                        Dim sUid As String = oSymbolNode.Name
2535
                        Dim sLineNoUid As String = CLineNo.Uid
2536
                        Dim sReturnUid = sUid
2537
                        '  FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt)
2538
                        While True
2539
                            Dim oLineRows As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" &
2540
                                               _XML_SYMBOL_Check & "] = 'TRUE' And [" & _XML_LINE_ValieLine & "] = 'True'")
2541
                            If oLineRows.Count > 0 Then
2542
                                Dim sPipeType As String = oLineRows(0)(_XML_LINE_TYPE).ToString()
2543
                                If sPipeType.ToUpper() = "PRIMARY" Then
2544
                                    sReturnUid = FinalLineModeling(oLineRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt)
2545
                                Else
2546
                                    sReturnUid = ""
2924 2547
                                End If
2925
                                Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE)
2926
                                oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue
2927
                            Catch ex As Exception
2928
                            End Try
2929
                        Next
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

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