프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / GenerateRelation.vb @ 6e10659e

이력 | 보기 | 이력해설 | 다운로드 (51.2 KB)

1 6ba3e887 Gyusu
Public Class GenerateRelation
2
3
    Dim d라인오차범위 As Double = 100
4
    Dim d심블오차범위 As Double = 100
5
6
    Public Function CalcLineConnectionItem_Equal(ByRef oLinelist_Dt_Line As DataTable, ByRef oLineLists As List(Of Line_no)) As Boolean
7
        Try
8
            For Each oLineRow In oLinelist_Dt_Line.Rows
9
                Dim sLineUid As String = oLineRow(_XML_LINE_UID)
10
                Dim dLineStart_x As Double = 0.0
11
                Dim dLineStart_y As Double = 0.0
12
                Dim dLineEnd_x As Double = 0.0
13
                Dim dLineEnd_y As Double = 0.0
14
15
                Dim sStartpoint As String = oLineRow(_XML_LINE_STARTPOINT).ToString()
16
                Dim sEndpoint As String = oLineRow(_XML_LINE_ENDPOINT).ToString()
17
18
                ConvertPointBystring(sStartpoint, dLineStart_x, dLineStart_y)
19
                ConvertPointBystring(sEndpoint, dLineEnd_x, dLineEnd_y)
20
21
                Dim sConn1_Uid As String = oLineRow(_XML_LINE_Conn1_Uid).ToString()
22
                Dim sConn2_Uid As String = oLineRow(_XML_LINE_Conn2_Uid).ToString()
23
24
                Dim sConn1_Flag As Boolean = False
25
                Dim sConn2_Flag As Boolean = False
26
27
                For Each oLinelist In oLineLists
28
                    For Each oConnLineRow In oLinelist.Dt_Line.Rows
29
                        Dim sConnLineUid As String = oConnLineRow(_XML_LINE_UID)
30
                        If sLineUid <> sConnLineUid Then
31
                            If sConn1_Uid <> "" And sConn2_Uid <> "" Then
32
                                Exit For
33
                            End If
34
                            Dim dConnLineStart_x As Double = 0.0
35
                            Dim dConnLineStart_y As Double = 0.0
36
                            Dim dConnLineEnd_x As Double = 0.0
37
                            Dim dConnLineEnd_y As Double = 0.0
38
                            Dim sConnStartpoint As String = oConnLineRow(_XML_LINE_STARTPOINT).ToString()
39
                            Dim sConnEndpoint As String = oConnLineRow(_XML_LINE_ENDPOINT).ToString()
40
                            ConvertPointBystring(sConnStartpoint, dConnLineStart_x, dConnLineStart_y)
41
                            ConvertPointBystring(sConnEndpoint, dConnLineEnd_x, dConnLineEnd_y)
42
43
                            If CheckDuplicatePoint(dLineStart_x, dLineStart_y, dLineEnd_x, dLineEnd_y,
44
                                                   dConnLineStart_x, dConnLineStart_y, dConnLineEnd_x, dConnLineEnd_y) Then
45
46
47
48
49
50
                                If sConn1_Uid = "" Then
51
                                    If dLineStart_x = dConnLineStart_x And dLineStart_y = dConnLineStart_y Then
52
                                        sConn1_Uid = sConnLineUid
53
                                        oConnLineRow(_XML_LINE_Conn1_Uid) = sLineUid
54
                                        oLineRow(_XML_LINE_Conn1_Uid) = sConnLineUid
55
                                    ElseIf dLineStart_x = dConnLineEnd_x And dLineStart_y = dConnLineEnd_y Then
56
                                        sConn1_Uid = sConnLineUid
57
                                        oConnLineRow(_XML_LINE_Conn2_Uid) = sLineUid
58
                                        oLineRow(_XML_LINE_Conn1_Uid) = sConnLineUid
59
                                    End If
60
61
                                End If
62
                                If sConn2_Uid = "" Then
63
                                    If dLineEnd_x = dConnLineStart_x And dLineEnd_y = dConnLineStart_y Then
64
                                        sConn2_Uid = sConnLineUid
65
                                        oConnLineRow(_XML_LINE_Conn1_Uid) = sLineUid
66
                                        oLineRow(_XML_LINE_Conn2_Uid) = sConnLineUid
67
                                    ElseIf dLineEnd_x = dConnLineEnd_x And dLineEnd_y = dConnLineEnd_y Then
68
                                        sConn2_Uid = sConnLineUid
69
                                        oConnLineRow(_XML_LINE_Conn2_Uid) = sLineUid
70
                                        oLineRow(_XML_LINE_Conn2_Uid) = sConnLineUid
71
                                    End If
72
                                End If
73
74
                            End If
75
                        End If
76
                    Next
77
                Next
78
79
                For Each oLinelist In oLineLists
80
                    For Each oConnSymbolRow In oLinelist.Dt_Symbol.Rows
81
                        If sConn1_Uid <> "" And sConn2_Uid <> "" Then
82
                            Exit For
83
                        End If
84
                        Dim sSymbolUid As String = oConnSymbolRow(_XML_SYMBOL_UID).ToString()
85
                        Dim sSymbolName As String = oConnSymbolRow(_XML_SYMBOL_NAME).ToString()
86
                        Dim sSymbolConnPoint As String = oConnSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString()
87
                        Dim sConnSplit As String() = sSymbolConnPoint.Split("/")
88
                        If sLineUid = "3c90fe63-b88e-4bb3-a774-a0c4ae8c4ebf" And sSymbolUid = "9ebcb62e-156e-4d3c-aeb2-3d9e5089915e" Then
89
90
                        End If
91
                        If sSymbolConnPoint <> "" Then
92
                            Dim dSymbolConn1_x As Double = 0.0
93
                            Dim dSymbolConn1_y As Double = 0.0
94
                            Dim dSymbolConn2_x As Double = 0.0
95
                            Dim dSymbolConn2_y As Double = 0.0
96
                            Dim dSymbolConn3_x As Double = 0.0
97
                            Dim dSymbolConn3_y As Double = 0.0
98
                            Dim dSymbolConn4_x As Double = 0.0
99
                            Dim dSymbolConn4_y As Double = 0.0
100
101
                            Dim sConn1Point As String = ""
102
                            Dim sConn2Point As String = ""
103
                            Dim sConn3Point As String = ""
104
                            Dim sConn4Point As String = ""
105
106
                            sConn1Point = sConnSplit(0)
107
108
                            If sConnSplit.Length > 1 Then
109
                                sConn2Point = sConnSplit(1)
110
                                If sConnSplit.Length > 2 Then
111
                                    sConn3Point = sConnSplit(2)
112
                                    If sConnSplit.Length > 3 Then
113
                                        sConn4Point = sConnSplit(3)
114
                                    End If
115
                                End If
116
                            End If
117
118
                            ConvertPointBystring(sConn1Point, dSymbolConn1_x, dSymbolConn1_y)
119
                            If sConn2Point <> "" Then
120
                                ConvertPointBystring(sConn2Point, dSymbolConn2_x, dSymbolConn2_y)
121
                            End If
122
                            If sConn3Point <> "" Then
123
                                ConvertPointBystring(sConn3Point, dSymbolConn3_x, dSymbolConn3_y)
124
                            End If
125
                            If sConn4Point <> "" Then
126
                                ConvertPointBystring(sConn4Point, dSymbolConn4_x, dSymbolConn4_y)
127
                            End If
128
                            '라인 끝에 연결되어 있는 심블
129
                            If sConn1_Uid = "" Then
130
                                If dLineStart_x = dSymbolConn1_x And dLineStart_y = dSymbolConn1_y Then
131
                                    sConn1_Uid = sSymbolUid
132
                                    oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sLineUid
133
                                    oLineRow(_XML_LINE_Conn1_Uid) = sConn1_Uid
134
                                ElseIf dLineStart_x = dSymbolConn2_x And dLineStart_y = dSymbolConn2_y Then
135
                                    sConn1_Uid = sSymbolUid
136
                                    oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sLineUid
137
                                    oLineRow(_XML_LINE_Conn1_Uid) = sConn1_Uid
138
                                ElseIf dLineStart_x = dSymbolConn3_x And dLineStart_y = dSymbolConn3_y Then
139
                                    sConn1_Uid = sSymbolUid
140
                                    oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sLineUid
141
                                    oLineRow(_XML_LINE_Conn1_Uid) = sConn1_Uid
142
                                ElseIf dLineStart_x = dSymbolConn4_x And dLineStart_y = dSymbolConn4_y Then
143
                                    sConn1_Uid = sSymbolUid
144
                                    oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sLineUid
145
                                    oLineRow(_XML_LINE_Conn1_Uid) = sConn1_Uid
146
                                End If
147
                            End If
148
149
                            If sConn2_Uid = "" Then
150
                                If dLineEnd_x = dSymbolConn1_x And dLineEnd_y = dSymbolConn1_y Then
151
                                    sConn2_Uid = sSymbolUid
152
                                    oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sLineUid
153
                                    oLineRow(_XML_LINE_Conn2_Uid) = sConn2_Uid
154
                                ElseIf dLineEnd_x = dSymbolConn2_x And dLineEnd_y = dSymbolConn2_y Then
155
                                    sConn2_Uid = sSymbolUid
156
                                    oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sLineUid
157
                                    oLineRow(_XML_LINE_Conn2_Uid) = sConn2_Uid
158
                                ElseIf dLineEnd_x = dSymbolConn3_x And dLineEnd_y = dSymbolConn3_y Then
159
                                    sConn2_Uid = sSymbolUid
160
                                    oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sLineUid
161
                                    oLineRow(_XML_LINE_Conn2_Uid) = sConn2_Uid
162
                                ElseIf dLineEnd_x = dSymbolConn4_x And dLineEnd_y = dSymbolConn4_y Then
163
                                    sConn2_Uid = sSymbolUid
164
                                    oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sLineUid
165
                                    oLineRow(_XML_LINE_Conn2_Uid) = sConn2_Uid
166
                                End If
167
                            End If
168
169
170
                            '라인 안에 포함되어 있는 심블
171
                            If sConn1_Uid = "" And sConn2_Uid = "" Then
172
                                If (dLineStart_x <= dSymbolConn1_x And dLineStart_y <= dSymbolConn1_y And
173
                                dLineEnd_x >= dSymbolConn2_x And dLineEnd_y >= dSymbolConn2_y) Or
174
                                (dLineStart_x >= dSymbolConn1_x And dLineStart_y >= dSymbolConn1_y And
175
                                dLineEnd_x <= dSymbolConn2_x And dLineEnd_y <= dSymbolConn2_y) Then
176
                                    oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sLineUid
177
                                    oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sLineUid
178
                                Else
179
180
                                End If
181
                            End If
182
183
                        End If
184
                    Next
185
                Next
186
187
188
189
                oLineRow(_XML_LINE_Conn1_Uid) = sConn1_Uid
190
                oLineRow(_XML_LINE_Conn2_Uid) = sConn2_Uid
191
192
            Next
193
        Catch ex As Exception
194
            Return False
195
        End Try
196
197
        Return True
198
    End Function
199
200
    Public Function CalcLineConnectionItem_NonEqual(ByRef oLinelist_Dt_Line As DataTable, ByRef oLineLists As List(Of Line_no)) As Boolean
201
        Try
202
203
            For Each oLineRow In oLinelist_Dt_Line.Rows
204
                Dim sLineUid As String = oLineRow(_XML_LINE_UID).ToString()
205 f291ddcb Gyusu
206 6ba3e887 Gyusu
                Dim dLineStart_x As Double = 0.0
207
                Dim dLineStart_y As Double = 0.0
208
                Dim dLineEnd_x As Double = 0.0
209
                Dim dLineEnd_y As Double = 0.0
210
211
                Dim sStartpoint As String = oLineRow(_XML_LINE_STARTPOINT).ToString()
212
                Dim sEndpoint As String = oLineRow(_XML_LINE_ENDPOINT).ToString()
213
214
                ConvertPointBystring(sStartpoint, dLineStart_x, dLineStart_y)
215
                ConvertPointBystring(sEndpoint, dLineEnd_x, dLineEnd_y)
216
217
                Dim dPlusMinusValue = 0
218
                If Math.Abs(dLineStart_x - dLineEnd_x) < Math.Abs(dLineStart_y - dLineEnd_y) Then
219
                    '세로라인
220
                    dPlusMinusValue = Math.Abs(dLineStart_y - dLineEnd_y) / d라인오차범위
221
                Else
222
                    '가로라인
223
                    dPlusMinusValue = Math.Abs(dLineStart_x - dLineEnd_x) / d라인오차범위
224
                End If
225
226
227
                Dim sConn1_Uid As String = oLineRow(_XML_LINE_Conn1_Uid).ToString()
228
                Dim sConn2_Uid As String = oLineRow(_XML_LINE_Conn2_Uid).ToString()
229
                For Each oConnLineRow In oLinelist_Dt_Line.Rows
230
                    Dim sConnLineUid As String = oConnLineRow(_XML_LINE_UID).ToString()
231
                    If sLineUid <> sConnLineUid Then
232
                        If sConn1_Uid <> "" And sConn2_Uid <> "" Then
233
                            Exit For
234
                        End If
235
                        Dim dConnLineStart_x As Double = 0.0
236
                        Dim dConnLineStart_y As Double = 0.0
237
                        Dim dConnLineEnd_x As Double = 0.0
238
                        Dim dConnLineEnd_y As Double = 0.0
239
                        Dim sConnStartpoint As String = oConnLineRow(_XML_LINE_STARTPOINT).ToString()
240
                        Dim sConnEndpoint As String = oConnLineRow(_XML_LINE_ENDPOINT).ToString()
241
                        ConvertPointBystring(sConnStartpoint, dConnLineStart_x, dConnLineStart_y)
242
                        ConvertPointBystring(sConnEndpoint, dConnLineEnd_x, dConnLineEnd_y)
243
244
245
                        If CheckDuplicatePoint(dLineStart_x, dLineStart_y, dLineEnd_x, dLineEnd_y,
246
                                               dConnLineStart_x, dConnLineStart_y, dConnLineEnd_x, dConnLineEnd_y) Then
247
248
                            If sConn1_Uid = "" Then
249
                                If dLineStart_x - dPlusMinusValue <= dConnLineStart_x And dLineStart_x + dPlusMinusValue >= dConnLineStart_x And
250
                                    dLineStart_y - dPlusMinusValue <= dConnLineStart_y And dLineStart_y + dPlusMinusValue >= dConnLineStart_y Then
251
                                    sConn1_Uid = sConnLineUid
252
                                    oConnLineRow(_XML_LINE_Conn1_Uid) = sLineUid
253
                                    oLineRow(_XML_LINE_Conn1_Uid) = sConnLineUid
254
                                ElseIf dLineStart_x - dPlusMinusValue <= dConnLineEnd_x And dLineStart_x + dPlusMinusValue >= dConnLineEnd_x And
255
                                    dLineStart_y - dPlusMinusValue <= dConnLineEnd_y And dLineStart_y + dPlusMinusValue >= dConnLineEnd_y Then
256
                                    sConn1_Uid = sConnLineUid
257
                                    oConnLineRow(_XML_LINE_Conn2_Uid) = sLineUid
258
                                    oLineRow(_XML_LINE_Conn1_Uid) = sConnLineUid
259
                                End If
260
                            End If
261
                            If sConn2_Uid = "" Then
262
                                If dLineEnd_x - dPlusMinusValue <= dConnLineStart_x And dLineEnd_x + dPlusMinusValue >= dConnLineStart_x And
263
                                    dLineEnd_y - dPlusMinusValue <= dConnLineStart_y And dLineEnd_y + dPlusMinusValue >= dConnLineStart_y Then
264
                                    sConn2_Uid = sConnLineUid
265
                                    oConnLineRow(_XML_LINE_Conn1_Uid) = sLineUid
266
                                    oLineRow(_XML_LINE_Conn2_Uid) = sConnLineUid
267
                                ElseIf dLineEnd_x - dPlusMinusValue <= dConnLineEnd_x And dLineEnd_x + dPlusMinusValue >= dConnLineEnd_x And
268
                                    dLineEnd_y - dPlusMinusValue <= dConnLineEnd_y And dLineEnd_y + dPlusMinusValue >= dConnLineEnd_y Then
269
                                    sConn2_Uid = sConnLineUid
270
                                    oConnLineRow(_XML_LINE_Conn2_Uid) = sLineUid
271
                                    oLineRow(_XML_LINE_Conn2_Uid) = sConnLineUid
272
                                End If
273
274
275
                            End If
276
277
                        End If
278
                    End If
279
280
                Next
281
282
                For Each oLinelist In oLineLists
283
                    For Each oConnSymbolRow In oLinelist.Dt_Symbol.Rows
284
                        If sConn1_Uid <> "" And sConn2_Uid <> "" Then
285
                            Exit For
286
                        End If
287
288
                        Dim sSymbolUid As String = oConnSymbolRow(_XML_SYMBOL_UID).ToString()
289
                        Dim sSymbolName As String = oConnSymbolRow(_XML_SYMBOL_NAME).ToString()
290
                        Dim sSymbolSize As String = oConnSymbolRow(_XML_SYMBOL_SIZE).ToString()
291
                        Dim sSizeSplit() As String = sSymbolSize.Split(",")
292
                        Dim sSize_x As String = sSizeSplit(0)
293
                        Dim sSize_y As String = sSizeSplit(1)
294
                        dPlusMinusValue = 0
295
                        If sSize_x > sSize_y Then
296
                            dPlusMinusValue = sSize_x / d라인오차범위
297
                        Else
298
                            dPlusMinusValue = sSize_y / d라인오차범위
299
                        End If
300
301
                        Dim sSymbolConnPoint As String = oConnSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString()
302
                        Dim sConnSplit As String() = sSymbolConnPoint.Split("/")
303
                        If sSymbolConnPoint <> "" Then
304
                            Dim dSymbolConn1_x As Double = 0.0
305
                            Dim dSymbolConn1_y As Double = 0.0
306
                            Dim dSymbolConn2_x As Double = 0.0
307
                            Dim dSymbolConn2_y As Double = 0.0
308
                            Dim dSymbolConn3_x As Double = 0.0
309
                            Dim dSymbolConn3_y As Double = 0.0
310
                            Dim dSymbolConn4_x As Double = 0.0
311
                            Dim dSymbolConn4_y As Double = 0.0
312
313
                            Dim sConn1Point As String = ""
314
                            Dim sConn2Point As String = ""
315
                            Dim sConn3Point As String = ""
316
                            Dim sConn4Point As String = ""
317
318
                            sConn1Point = sConnSplit(0)
319
320
                            If sConnSplit.Length > 1 Then
321
                                sConn2Point = sConnSplit(1)
322
                                If sConnSplit.Length > 2 Then
323
                                    sConn3Point = sConnSplit(2)
324
                                    If sConnSplit.Length > 3 Then
325
                                        sConn4Point = sConnSplit(3)
326
                                    End If
327
                                End If
328
                            End If
329
330
                            ConvertPointBystring(sConn1Point, dSymbolConn1_x, dSymbolConn1_y)
331
                            If sConn2Point <> "" Then
332
                                ConvertPointBystring(sConn2Point, dSymbolConn2_x, dSymbolConn2_y)
333
                            End If
334
                            If sConn3Point <> "" Then
335
                                ConvertPointBystring(sConn3Point, dSymbolConn3_x, dSymbolConn3_y)
336
                            End If
337
                            If sConn4Point <> "" Then
338
                                ConvertPointBystring(sConn4Point, dSymbolConn4_x, dSymbolConn4_y)
339
                            End If
340
                            If sConn1_Uid = "" Then
341
                                If dLineStart_x - dPlusMinusValue <= dSymbolConn1_x And dLineStart_x + dPlusMinusValue >= dSymbolConn1_x And
342
                                    dLineStart_y - dPlusMinusValue <= dSymbolConn1_y And dLineStart_y + dPlusMinusValue >= dSymbolConn1_y Then
343
                                    sConn1_Uid = sSymbolUid
344
                                    oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sLineUid
345
                                    oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid
346
                                ElseIf dLineStart_x - dPlusMinusValue <= dSymbolConn2_x And dLineStart_x + dPlusMinusValue >= dSymbolConn2_x And
347
                                    dLineStart_y - dPlusMinusValue <= dSymbolConn2_y And dLineStart_y + dPlusMinusValue >= dSymbolConn2_y Then
348
                                    sConn1_Uid = sSymbolUid
349
                                    oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sLineUid
350
                                    oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid
351
                                ElseIf dLineStart_x - dPlusMinusValue <= dSymbolConn3_x And dLineStart_x + dPlusMinusValue >= dSymbolConn3_x And
352
                              dLineStart_y - dPlusMinusValue <= dSymbolConn3_y And dLineStart_y + dPlusMinusValue >= dSymbolConn3_y Then
353
                                    sConn1_Uid = sSymbolUid
354
                                    oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sLineUid
355
                                    oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid
356
                                ElseIf dLineStart_x - dPlusMinusValue <= dSymbolConn4_x And dLineStart_x + dPlusMinusValue >= dSymbolConn4_x And
357
                             dLineStart_y - dPlusMinusValue <= dSymbolConn4_y And dLineStart_y + dPlusMinusValue >= dSymbolConn4_y Then
358
                                    sConn1_Uid = sSymbolUid
359
                                    oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sLineUid
360
                                    oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid
361
                                End If
362
                            End If
363
                            If sConn2_Uid = "" Then
364
                                If dLineEnd_x - dPlusMinusValue <= dSymbolConn1_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn1_x And
365
                                    dLineEnd_y - dPlusMinusValue <= dSymbolConn1_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn1_y Then
366
                                    sConn2_Uid = sSymbolUid
367
                                    oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sLineUid
368
                                    oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid
369
                                ElseIf dLineEnd_x - dPlusMinusValue <= dSymbolConn2_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn2_x And
370
                                    dLineEnd_y - dPlusMinusValue <= dSymbolConn2_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn2_y Then
371
                                    sConn2_Uid = sSymbolUid
372
                                    oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sLineUid
373
                                    oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid
374
                                ElseIf dLineEnd_x - dPlusMinusValue <= dSymbolConn3_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn3_x And
375
                              dLineEnd_y - dPlusMinusValue <= dSymbolConn3_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn3_y Then
376
                                    sConn2_Uid = sSymbolUid
377
                                    oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sLineUid
378
                                    oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid
379
                                ElseIf dLineEnd_x - dPlusMinusValue <= dSymbolConn4_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn4_x And
380
                             dLineEnd_y - dPlusMinusValue <= dSymbolConn4_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn4_y Then
381
                                    sConn2_Uid = sSymbolUid
382
                                    oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sLineUid
383
                                    oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid
384
                                End If
385
                            End If
386
387
                        End If
388
                    Next
389
                Next
390
391
                oLineRow(_XML_LINE_Conn1_Uid) = sConn1_Uid
392
                oLineRow(_XML_LINE_Conn2_Uid) = sConn2_Uid
393
            Next
394
        Catch ex As Exception
395
            Return False
396
        End Try
397
398
        Return True
399
    End Function
400
401
402
#Region "Symbol과 Symbol Connection 찾기"
403
    Public Function CalcSymbolConnectionItem_Equal(ByRef oLinelist_Dt_Symbol As DataTable, ByRef oLineLists As List(Of Line_no)) As Boolean
404
        Try
405
            For Each oSymbolRow In oLinelist_Dt_Symbol.Rows
406
                Dim sUid As String = oSymbolRow(_XML_SYMBOL_UID)
407 f291ddcb Gyusu
408 6ba3e887 Gyusu
                Dim dConn1_x As Double = 0.0
409
                Dim dConn1_y As Double = 0.0
410
                Dim dConn2_x As Double = 0.0
411
                Dim dConn2_y As Double = 0.0
412
                Dim dConn3_x As Double = 0.0
413
                Dim dConn3_y As Double = 0.0
414
                Dim dConn4_x As Double = 0.0
415
                Dim dConn4_y As Double = 0.0
416
                Dim sConnPoint As String = oSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString()
417
                Dim sConnSplit As String() = sConnPoint.Split("/")
418
                Dim sConn1Point As String = ""
419
                Dim sConn2Point As String = ""
420
                Dim sConn3Point As String = ""
421
                Dim sConn4Point As String = ""
422
423
                Dim sConn1_Uid As String = oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()
424
                Dim sConn2_Uid As String = oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()
425
                Dim sConn3_Uid As String = oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()
426
                Dim sConn4_Uid As String = oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()
427
428
429
                sConn1Point = sConnSplit(0)
430
431
                If sConnSplit.Length > 1 Then
432
                    sConn2Point = sConnSplit(1)
433
                    If sConnSplit.Length > 2 Then
434
                        sConn3Point = sConnSplit(2)
435
                        If sConnSplit.Length > 3 Then
436
                            sConn4Point = sConnSplit(3)
437
                        End If
438
                    End If
439
                End If
440
                If sConn1Point <> "" Then
441
                    ConvertPointBystring(sConn1Point, dConn1_x, dConn1_y)
442
                End If
443
444
                If sConn2Point <> "" Then
445
                    ConvertPointBystring(sConn2Point, dConn2_x, dConn2_y)
446
                End If
447
448
                If sConn3Point <> "" Then
449
                    ConvertPointBystring(sConn3Point, dConn3_x, dConn3_y)
450
                End If
451
452
                If sConn4Point <> "" Then
453
                    ConvertPointBystring(sConn4Point, dConn4_x, dConn4_y)
454
                End If
455
456
                For Each oLinelist In oLineLists
457
                    For Each oConnSymbolRow In oLinelist.Dt_Symbol.Rows
458
                        Dim sSymbolUid As String = oConnSymbolRow(_XML_SYMBOL_UID).ToString()
459
                        If sUid <> sSymbolUid Then
460
                            Dim sSymbolName As String = oConnSymbolRow(_XML_SYMBOL_NAME).ToString()
461
                            Dim sSymbolConnPoint As String = oConnSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString()
462
                            Dim sRelConnSplit As String() = sSymbolConnPoint.Split("/")
463
                            If sSymbolConnPoint <> "" Then
464
                                Dim dSymbolConn1_x As Double = 0.0
465
                                Dim dSymbolConn1_y As Double = 0.0
466
                                Dim dSymbolConn2_x As Double = 0.0
467
                                Dim dSymbolConn2_y As Double = 0.0
468
                                Dim dSymbolConn3_x As Double = 0.0
469
                                Dim dSymbolConn3_y As Double = 0.0
470
                                Dim dSymbolConn4_x As Double = 0.0
471
                                Dim dSymbolConn4_y As Double = 0.0
472
                                Dim sRelConn1Point As String = ""
473
                                Dim sRelConn2Point As String = ""
474
                                Dim sRelConn3Point As String = ""
475
                                Dim sRelConn4Point As String = ""
476
                                sRelConn1Point = sRelConnSplit(0)
477
                                If sRelConnSplit.Length > 1 Then
478
                                    sRelConn2Point = sRelConnSplit(1)
479
                                    If sRelConnSplit.Length > 2 Then
480
                                        sRelConn3Point = sRelConnSplit(2)
481
                                        If sRelConnSplit.Length > 3 Then
482
                                            sRelConn4Point = sRelConnSplit(3)
483
                                        End If
484
                                    End If
485
                                End If
486
                                ConvertPointBystring(sRelConn1Point, dSymbolConn1_x, dSymbolConn1_y)
487
                                If sRelConn2Point <> "" Then
488
                                    ConvertPointBystring(sRelConn2Point, dSymbolConn2_x, dSymbolConn2_y)
489
                                End If
490
                                If sRelConn3Point <> "" Then
491
                                    ConvertPointBystring(sRelConn3Point, dSymbolConn3_x, dSymbolConn3_y)
492
                                End If
493
                                If sRelConn4Point <> "" Then
494
                                    ConvertPointBystring(sRelConn4Point, dSymbolConn4_x, dSymbolConn4_y)
495
                                End If
496
497
                                If sConn1_Uid = "" And dConn1_x > 0 And dConn1_y > 0 Then
498
                                    If dConn1_x = dSymbolConn1_x And dConn1_y = dSymbolConn1_y Then
499
                                        sConn1_Uid = sSymbolUid
500
                                        oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
501
                                        oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
502
                                    ElseIf dConn1_x = dSymbolConn2_x And dConn1_y = dSymbolConn2_y Then
503
                                        sConn1_Uid = sSymbolUid
504
                                        oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
505
                                        oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
506
                                    ElseIf dConn1_x = dSymbolConn3_x And dConn1_y = dSymbolConn3_y Then
507
                                        sConn1_Uid = sSymbolUid
508
                                        oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
509
                                        oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
510
                                    ElseIf dConn1_x = dSymbolConn4_x And dConn1_y = dSymbolConn4_y Then
511
                                        sConn1_Uid = sSymbolUid
512
                                        oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
513
                                        oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
514
                                    End If
515
                                End If
516
517
                                If sConn2_Uid = "" And dConn3_x > 0 And dConn3_y > 0 Then
518
                                    If dConn2_x = dSymbolConn1_x And dConn2_y = dSymbolConn1_y Then
519
                                        sConn2_Uid = sSymbolUid
520
                                        oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
521
                                        oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
522
                                    ElseIf dConn2_x = dSymbolConn2_x And dConn2_y = dSymbolConn2_y Then
523
                                        sConn2_Uid = sSymbolUid
524
                                        oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
525
                                        oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
526
                                    ElseIf dConn2_x = dSymbolConn3_x And dConn2_y = dSymbolConn3_y Then
527
                                        sConn2_Uid = sSymbolUid
528
                                        oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
529
                                        oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
530
                                    ElseIf dConn2_x = dSymbolConn4_x And dConn2_y = dSymbolConn4_y Then
531
                                        sConn2_Uid = sSymbolUid
532
                                        oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
533
                                        oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
534
                                    End If
535
                                End If
536
537
                                If sConn3_Uid = "" And dConn3_x > 0 And dConn3_y > 0 Then
538
                                    If dConn3_x = dSymbolConn1_x And dConn3_y = dSymbolConn1_y Then
539
                                        sConn3_Uid = sSymbolUid
540
                                        oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
541
                                        oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
542
                                    ElseIf dConn3_x = dSymbolConn2_x And dConn3_y = dSymbolConn2_y Then
543
                                        sConn3_Uid = sSymbolUid
544
                                        oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
545
                                        oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
546
                                    ElseIf dConn3_x = dSymbolConn3_x And dConn3_y = dSymbolConn3_y Then
547
                                        sConn3_Uid = sSymbolUid
548
                                        oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
549
                                        oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
550
                                    ElseIf dConn3_x = dSymbolConn4_x And dConn3_y = dSymbolConn4_y Then
551
                                        sConn3_Uid = sSymbolUid
552
                                        oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
553
                                        oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
554
                                    End If
555
                                End If
556
557
                                If sConn4_Uid = "" And dConn4_x > 0 And dConn4_y > 0 Then
558
                                    If dConn4_x = dSymbolConn1_x And dConn4_y = dSymbolConn1_y Then
559
                                        sConn4_Uid = sSymbolUid
560
                                        oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
561
                                        oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
562
                                    ElseIf dConn4_x = dSymbolConn2_x And dConn4_y = dSymbolConn2_y Then
563
                                        sConn4_Uid = sSymbolUid
564
                                        oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
565
                                        oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
566
                                    ElseIf dConn4_x = dSymbolConn3_x And dConn4_y = dSymbolConn3_y Then
567
                                        sConn4_Uid = sSymbolUid
568
                                        oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
569
                                        oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
570
                                    ElseIf dConn4_x = dSymbolConn4_x And dConn4_y = dSymbolConn4_y Then
571
                                        sConn4_Uid = sSymbolUid
572
                                        oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
573
                                        oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
574
                                    End If
575
                                End If
576
577
578
                            End If
579
                        End If
580
                    Next
581
                Next
582
583
                oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sConn1_Uid
584
                oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sConn2_Uid
585
                oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sConn3_Uid
586
                oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sConn4_Uid
587
            Next
588
        Catch ex As Exception
589
            Return False
590
        End Try
591
592
        Return True
593
    End Function
594
595
596
    Public Function CalcSymbolConnectionItem_NonEqual(ByRef oLinelist_Dt_Symbol As DataTable, ByRef oLineLists As List(Of Line_no)) As Boolean
597
        Try
598
599
            Dim dPlusMinusValue = 10
600
601
            For Each oSymbolRow In oLinelist_Dt_Symbol.Rows
602
                Dim sUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString()
603
604
                Dim dConn1_x As Double = 0.0
605
                Dim dConn1_y As Double = 0.0
606
                Dim dConn2_x As Double = 0.0
607
                Dim dConn2_y As Double = 0.0
608
                Dim dConn3_x As Double = 0.0
609
                Dim dConn3_y As Double = 0.0
610
                Dim dConn4_x As Double = 0.0
611
                Dim dConn4_y As Double = 0.0
612
                Dim sConnPoint As String = oSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString()
613
                Dim sConnSplit As String() = sConnPoint.Split("/")
614
                Dim sConn1Point As String = ""
615
                Dim sConn2Point As String = ""
616
                Dim sConn3Point As String = ""
617
                Dim sConn4Point As String = ""
618
619
                Dim sConn1_Uid As String = oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()
620
                Dim sConn2_Uid As String = oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()
621
                Dim sConn3_Uid As String = oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()
622
                Dim sConn4_Uid As String = oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()
623
624
                sConn1Point = sConnSplit(0)
625
626
                If sConnSplit.Length > 1 Then
627
                    sConn2Point = sConnSplit(1)
628
                    If sConnSplit.Length > 2 Then
629
                        sConn3Point = sConnSplit(2)
630
                        If sConnSplit.Length > 3 Then
631
                            sConn4Point = sConnSplit(3)
632
                        End If
633
                    End If
634
                End If
635
636
                If sConn1Point <> "" Then
637
                    ConvertPointBystring(sConn1Point, dConn1_x, dConn1_y)
638
                End If
639
640
                If sConn2Point <> "" Then
641
                    ConvertPointBystring(sConn2Point, dConn2_x, dConn2_y)
642
                End If
643
644
                If sConn3Point <> "" Then
645
                    ConvertPointBystring(sConn3Point, dConn3_x, dConn3_y)
646
                End If
647
648
                If sConn4Point <> "" Then
649
                    ConvertPointBystring(sConn4Point, dConn4_x, dConn4_y)
650
                End If
651
                For Each oLinelist In oLineLists
652
                    For Each oConnSymbolRow In oLinelist.Dt_Symbol.Rows
653
                        Dim sSymbolUid As String = oConnSymbolRow(_XML_SYMBOL_UID).ToString()
654
                        If sUid <> sSymbolUid Then
655
                            Dim sSymbolName As String = oConnSymbolRow(_XML_SYMBOL_NAME).ToString()
656
                            Dim sSymbolConnPoint As String = oConnSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString()
657
                            Dim sRelConnSplit As String() = sSymbolConnPoint.Split("/")
658
                            If sSymbolConnPoint <> "" Then
659
                                Dim dSymbolConn1_x As Double = 0.0
660
                                Dim dSymbolConn1_y As Double = 0.0
661
                                Dim dSymbolConn2_x As Double = 0.0
662
                                Dim dSymbolConn2_y As Double = 0.0
663
                                Dim dSymbolConn3_x As Double = 0.0
664
                                Dim dSymbolConn3_y As Double = 0.0
665
                                Dim dSymbolConn4_x As Double = 0.0
666
                                Dim dSymbolConn4_y As Double = 0.0
667
                                Dim sRelConn1Point As String = ""
668
                                Dim sRelConn2Point As String = ""
669
                                Dim sRelConn3Point As String = ""
670
                                Dim sRelConn4Point As String = ""
671
                                sRelConn1Point = sRelConnSplit(0)
672
                                If sRelConnSplit.Length > 1 Then
673
                                    sRelConn2Point = sRelConnSplit(1)
674
                                    If sRelConnSplit.Length > 2 Then
675
                                        sRelConn3Point = sRelConnSplit(2)
676
                                        If sRelConnSplit.Length > 3 Then
677
                                            sRelConn4Point = sRelConnSplit(3)
678
                                        End If
679
                                    End If
680
                                End If
681
                                ConvertPointBystring(sRelConn1Point, dSymbolConn1_x, dSymbolConn1_y)
682
                                If sConn2Point <> "" Then
683
                                    ConvertPointBystring(sRelConn2Point, dSymbolConn2_x, dSymbolConn2_y)
684
                                End If
685
                                If sConn3Point <> "" Then
686
                                    ConvertPointBystring(sRelConn3Point, dSymbolConn3_x, dSymbolConn3_y)
687
                                End If
688
                                If sConn4Point <> "" Then
689
                                    ConvertPointBystring(sRelConn4Point, dSymbolConn4_x, dSymbolConn4_y)
690
                                End If
691
                                If sConn1_Uid = "" Then
692
                                    If dConn1_x > 0 And dConn1_y > 0 Then
693
                                        If dConn1_x - dPlusMinusValue <= dSymbolConn1_x And dConn1_x + dPlusMinusValue >= dSymbolConn1_x And
694
                                            dConn1_y - dPlusMinusValue <= dSymbolConn1_y And dConn1_y + dPlusMinusValue >= dSymbolConn1_y Then
695
                                            sConn1_Uid = sSymbolUid
696
                                            oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
697
                                            oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
698
                                        ElseIf dConn1_x - dPlusMinusValue <= dSymbolConn2_x And dConn1_x + dPlusMinusValue >= dSymbolConn2_x And
699
                                            dConn1_y - dPlusMinusValue <= dSymbolConn2_y And dConn1_y + dPlusMinusValue >= dSymbolConn2_y Then
700
                                            sConn1_Uid = sSymbolUid
701
                                            oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
702
                                            oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
703
                                        ElseIf dConn1_x - dPlusMinusValue <= dSymbolConn3_x And dConn1_x + dPlusMinusValue >= dSymbolConn3_x And
704
                                            dConn1_y - dPlusMinusValue <= dSymbolConn3_y And dConn1_y + dPlusMinusValue >= dSymbolConn3_y Then
705
                                            sConn1_Uid = sSymbolUid
706
                                            oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
707
                                            oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
708
                                        ElseIf dConn1_x - dPlusMinusValue <= dSymbolConn4_x And dConn1_x + dPlusMinusValue >= dSymbolConn4_x And
709
                                         dConn1_y - dPlusMinusValue <= dSymbolConn2_y And dConn1_y + dPlusMinusValue >= dSymbolConn2_y Then
710
                                            sConn1_Uid = sSymbolUid
711
                                            oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
712
                                            oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid
713
                                        End If
714
                                    End If
715
                                End If
716
717
                                If sConn2_Uid = "" Then
718
                                    If dConn2_x > 0 And dConn2_y > 0 Then
719
                                        If dConn2_x - dPlusMinusValue <= dSymbolConn1_x And dConn2_x + dPlusMinusValue >= dSymbolConn1_x And
720
                                            dConn2_y - dPlusMinusValue <= dSymbolConn1_y And dConn2_y + dPlusMinusValue >= dSymbolConn1_y Then
721
                                            sConn2_Uid = sSymbolUid
722
                                            oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
723
                                            oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
724
                                        ElseIf dConn2_x - dPlusMinusValue <= dSymbolConn2_x And dConn2_x + dPlusMinusValue >= dSymbolConn2_x And
725
                                            dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then
726
                                            oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
727
                                            sConn2_Uid = sSymbolUid
728
                                            oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
729
                                        ElseIf dConn2_x - dPlusMinusValue <= dSymbolConn3_x And dConn2_x + dPlusMinusValue >= dSymbolConn3_x And
730
                                        dConn2_y - dPlusMinusValue <= dSymbolConn3_y And dConn2_y + dPlusMinusValue >= dSymbolConn3_y Then
731
                                            oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
732
                                            sConn2_Uid = sSymbolUid
733
                                            oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
734
                                        ElseIf dConn2_x - dPlusMinusValue <= dSymbolConn4_x And dConn2_x + dPlusMinusValue >= dSymbolConn4_x And
735
                                         dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then
736
                                            oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
737
                                            sConn2_Uid = sSymbolUid
738
                                            oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid
739
                                        End If
740
                                    End If
741
                                End If
742
743
744
                                If sConn3_Uid = "" Then
745
                                    If dConn3_x > 0 And dConn3_y > 0 Then
746
                                        If dConn3_x - dPlusMinusValue <= dSymbolConn1_x And dConn3_x + dPlusMinusValue >= dSymbolConn1_x And
747
                                        dConn2_y - dPlusMinusValue <= dSymbolConn1_y And dConn2_y + dPlusMinusValue >= dSymbolConn1_y Then
748
                                            sConn2_Uid = sSymbolUid
749
                                            oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
750
                                            oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
751
752
                                        ElseIf dConn3_x - dPlusMinusValue <= dSymbolConn2_x And dConn3_x + dPlusMinusValue >= dSymbolConn2_x And
753
                                        dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then
754
                                            oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
755
                                            sConn2_Uid = sSymbolUid
756
                                            oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
757
                                        ElseIf dConn3_x - dPlusMinusValue <= dSymbolConn3_x And dConn3_x + dPlusMinusValue >= dSymbolConn3_x And
758
                                    dConn2_y - dPlusMinusValue <= dSymbolConn3_y And dConn2_y + dPlusMinusValue >= dSymbolConn3_y Then
759
                                            oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
760
                                            sConn2_Uid = sSymbolUid
761
                                            oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
762
                                        ElseIf dConn3_x - dPlusMinusValue <= dSymbolConn4_x And dConn3_x + dPlusMinusValue >= dSymbolConn4_x And
763
                                     dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then
764
                                            oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
765
                                            sConn2_Uid = sSymbolUid
766
                                            oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid
767
                                        End If
768
                                    End If
769
                                End If
770
771
772
                                If sConn4_Uid = "" Then
773
                                    If dConn4_x > 0 And dConn4_y > 0 Then
774
                                        If dConn4_x - dPlusMinusValue <= dSymbolConn1_x And dConn4_x + dPlusMinusValue >= dSymbolConn1_x And
775
                                        dConn2_y - dPlusMinusValue <= dSymbolConn1_y And dConn2_y + dPlusMinusValue >= dSymbolConn1_y Then
776
                                            sConn2_Uid = sSymbolUid
777
                                            oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid
778
                                            oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
779
                                        ElseIf dConn4_x - dPlusMinusValue <= dSymbolConn2_x And dConn4_x + dPlusMinusValue >= dSymbolConn2_x And
780
                                        dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then
781
                                            oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid
782
                                            sConn2_Uid = sSymbolUid
783
                                            oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
784
                                        ElseIf dConn4_x - dPlusMinusValue <= dSymbolConn3_x And dConn4_x + dPlusMinusValue >= dSymbolConn3_x And
785
                                    dConn2_y - dPlusMinusValue <= dSymbolConn3_y And dConn2_y + dPlusMinusValue >= dSymbolConn3_y Then
786
                                            oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid
787
                                            sConn2_Uid = sSymbolUid
788
                                            oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
789
                                        ElseIf dConn4_x - dPlusMinusValue <= dSymbolConn4_x And dConn4_x + dPlusMinusValue >= dSymbolConn4_x And
790
                                     dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then
791
                                            oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid
792
                                            sConn2_Uid = sSymbolUid
793
                                            oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid
794
                                        End If
795
                                    End If
796
                                End If
797
798
                            End If
799
                        End If
800
801
                    Next
802
                Next
803
804
                oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sConn1_Uid
805
                oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sConn2_Uid
806
                oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sConn3_Uid
807
                oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sConn4_Uid
808
            Next
809
        Catch ex As Exception
810
            Return False
811
        End Try
812
813
        Return True
814
    End Function
815
816
817
818
#End Region
819
820
821
822
    Private Function ConvertPointBystring(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean
823
        Try
824
            Dim opointstr As String() = Split(sPoint, ",")
825
            If (opointstr.Length > 1) Then
826
                If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then
827
                    dX = opointstr(0)
828
                    dY = opointstr(1)
829
                Else
830
                    dX = 0
831
                    dY = 0
832
                    Return False
833
                End If
834
            End If
835
            Return True
836
        Catch ex As Exception
837
            Return False
838
        End Try
839
    End Function
840
    Private Function CheckDuplicatePoint(ByVal dLineStart_x As Double, ByVal dLineStart_y As Double, ByVal dLineEnd_x As Double, ByVal dLineEnd_y As Double,
841
                      ByVal dConnLineStart_x As Double, ByVal dConnLineStart_y As Double, ByVal dConnLineEnd_x As Double, ByVal dConnLineEnd_y As Double)
842
        If dLineStart_x = dConnLineStart_x And dLineStart_y = dConnLineStart_y And
843
            dLineEnd_x = dConnLineEnd_x And dLineEnd_y = dConnLineEnd_y Then
844
            Return False
845
        ElseIf dLineStart_x = dConnLineEnd_x And dLineStart_y = dConnLineEnd_y And
846
            dLineEnd_x = dConnLineStart_x And dLineEnd_y = dConnLineStart_y Then
847
            Return False
848
        Else
849
            Return True
850
        End If
851
    End Function
852
End Class
클립보드 이미지 추가 (최대 크기: 500 MB)