hytos / DTI_PID / SPPIDConverter / GenerateRelation.vb @ 4c2584c5
이력 | 보기 | 이력해설 | 다운로드 (51.4 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 | If sLineUid = "c5e85037-c9a6-4b8b-aff8-240d4dd89876" Then |
||
206 | ' MessageBox.Show("") |
||
207 | End If |
||
208 | Dim dLineStart_x As Double = 0.0 |
||
209 | Dim dLineStart_y As Double = 0.0 |
||
210 | Dim dLineEnd_x As Double = 0.0 |
||
211 | Dim dLineEnd_y As Double = 0.0 |
||
212 | |||
213 | Dim sStartpoint As String = oLineRow(_XML_LINE_STARTPOINT).ToString() |
||
214 | Dim sEndpoint As String = oLineRow(_XML_LINE_ENDPOINT).ToString() |
||
215 | |||
216 | ConvertPointBystring(sStartpoint, dLineStart_x, dLineStart_y) |
||
217 | ConvertPointBystring(sEndpoint, dLineEnd_x, dLineEnd_y) |
||
218 | |||
219 | Dim dPlusMinusValue = 0 |
||
220 | If Math.Abs(dLineStart_x - dLineEnd_x) < Math.Abs(dLineStart_y - dLineEnd_y) Then |
||
221 | '세로라인 |
||
222 | dPlusMinusValue = Math.Abs(dLineStart_y - dLineEnd_y) / d라인오차범위 |
||
223 | Else |
||
224 | '가로라인 |
||
225 | dPlusMinusValue = Math.Abs(dLineStart_x - dLineEnd_x) / d라인오차범위 |
||
226 | End If |
||
227 | |||
228 | |||
229 | Dim sConn1_Uid As String = oLineRow(_XML_LINE_Conn1_Uid).ToString() |
||
230 | Dim sConn2_Uid As String = oLineRow(_XML_LINE_Conn2_Uid).ToString() |
||
231 | For Each oConnLineRow In oLinelist_Dt_Line.Rows |
||
232 | Dim sConnLineUid As String = oConnLineRow(_XML_LINE_UID).ToString() |
||
233 | If sLineUid <> sConnLineUid Then |
||
234 | If sConn1_Uid <> "" And sConn2_Uid <> "" Then |
||
235 | Exit For |
||
236 | End If |
||
237 | Dim dConnLineStart_x As Double = 0.0 |
||
238 | Dim dConnLineStart_y As Double = 0.0 |
||
239 | Dim dConnLineEnd_x As Double = 0.0 |
||
240 | Dim dConnLineEnd_y As Double = 0.0 |
||
241 | Dim sConnStartpoint As String = oConnLineRow(_XML_LINE_STARTPOINT).ToString() |
||
242 | Dim sConnEndpoint As String = oConnLineRow(_XML_LINE_ENDPOINT).ToString() |
||
243 | ConvertPointBystring(sConnStartpoint, dConnLineStart_x, dConnLineStart_y) |
||
244 | ConvertPointBystring(sConnEndpoint, dConnLineEnd_x, dConnLineEnd_y) |
||
245 | |||
246 | |||
247 | If CheckDuplicatePoint(dLineStart_x, dLineStart_y, dLineEnd_x, dLineEnd_y, |
||
248 | dConnLineStart_x, dConnLineStart_y, dConnLineEnd_x, dConnLineEnd_y) Then |
||
249 | |||
250 | If sConn1_Uid = "" Then |
||
251 | If dLineStart_x - dPlusMinusValue <= dConnLineStart_x And dLineStart_x + dPlusMinusValue >= dConnLineStart_x And |
||
252 | dLineStart_y - dPlusMinusValue <= dConnLineStart_y And dLineStart_y + dPlusMinusValue >= dConnLineStart_y Then |
||
253 | sConn1_Uid = sConnLineUid |
||
254 | oConnLineRow(_XML_LINE_Conn1_Uid) = sLineUid |
||
255 | oLineRow(_XML_LINE_Conn1_Uid) = sConnLineUid |
||
256 | ElseIf dLineStart_x - dPlusMinusValue <= dConnLineEnd_x And dLineStart_x + dPlusMinusValue >= dConnLineEnd_x And |
||
257 | dLineStart_y - dPlusMinusValue <= dConnLineEnd_y And dLineStart_y + dPlusMinusValue >= dConnLineEnd_y Then |
||
258 | sConn1_Uid = sConnLineUid |
||
259 | oConnLineRow(_XML_LINE_Conn2_Uid) = sLineUid |
||
260 | oLineRow(_XML_LINE_Conn1_Uid) = sConnLineUid |
||
261 | End If |
||
262 | End If |
||
263 | If sConn2_Uid = "" Then |
||
264 | If dLineEnd_x - dPlusMinusValue <= dConnLineStart_x And dLineEnd_x + dPlusMinusValue >= dConnLineStart_x And |
||
265 | dLineEnd_y - dPlusMinusValue <= dConnLineStart_y And dLineEnd_y + dPlusMinusValue >= dConnLineStart_y Then |
||
266 | sConn2_Uid = sConnLineUid |
||
267 | oConnLineRow(_XML_LINE_Conn1_Uid) = sLineUid |
||
268 | oLineRow(_XML_LINE_Conn2_Uid) = sConnLineUid |
||
269 | ElseIf dLineEnd_x - dPlusMinusValue <= dConnLineEnd_x And dLineEnd_x + dPlusMinusValue >= dConnLineEnd_x And |
||
270 | dLineEnd_y - dPlusMinusValue <= dConnLineEnd_y And dLineEnd_y + dPlusMinusValue >= dConnLineEnd_y Then |
||
271 | sConn2_Uid = sConnLineUid |
||
272 | oConnLineRow(_XML_LINE_Conn2_Uid) = sLineUid |
||
273 | oLineRow(_XML_LINE_Conn2_Uid) = sConnLineUid |
||
274 | End If |
||
275 | |||
276 | |||
277 | End If |
||
278 | |||
279 | End If |
||
280 | End If |
||
281 | |||
282 | Next |
||
283 | |||
284 | For Each oLinelist In oLineLists |
||
285 | For Each oConnSymbolRow In oLinelist.Dt_Symbol.Rows |
||
286 | If sConn1_Uid <> "" And sConn2_Uid <> "" Then |
||
287 | Exit For |
||
288 | End If |
||
289 | |||
290 | Dim sSymbolUid As String = oConnSymbolRow(_XML_SYMBOL_UID).ToString() |
||
291 | Dim sSymbolName As String = oConnSymbolRow(_XML_SYMBOL_NAME).ToString() |
||
292 | Dim sSymbolSize As String = oConnSymbolRow(_XML_SYMBOL_SIZE).ToString() |
||
293 | Dim sSizeSplit() As String = sSymbolSize.Split(",") |
||
294 | Dim sSize_x As String = sSizeSplit(0) |
||
295 | Dim sSize_y As String = sSizeSplit(1) |
||
296 | dPlusMinusValue = 0 |
||
297 | If sSize_x > sSize_y Then |
||
298 | dPlusMinusValue = sSize_x / d라인오차범위 |
||
299 | Else |
||
300 | dPlusMinusValue = sSize_y / d라인오차범위 |
||
301 | End If |
||
302 | |||
303 | Dim sSymbolConnPoint As String = oConnSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString() |
||
304 | Dim sConnSplit As String() = sSymbolConnPoint.Split("/") |
||
305 | If sSymbolConnPoint <> "" Then |
||
306 | Dim dSymbolConn1_x As Double = 0.0 |
||
307 | Dim dSymbolConn1_y As Double = 0.0 |
||
308 | Dim dSymbolConn2_x As Double = 0.0 |
||
309 | Dim dSymbolConn2_y As Double = 0.0 |
||
310 | Dim dSymbolConn3_x As Double = 0.0 |
||
311 | Dim dSymbolConn3_y As Double = 0.0 |
||
312 | Dim dSymbolConn4_x As Double = 0.0 |
||
313 | Dim dSymbolConn4_y As Double = 0.0 |
||
314 | |||
315 | Dim sConn1Point As String = "" |
||
316 | Dim sConn2Point As String = "" |
||
317 | Dim sConn3Point As String = "" |
||
318 | Dim sConn4Point As String = "" |
||
319 | |||
320 | sConn1Point = sConnSplit(0) |
||
321 | |||
322 | If sConnSplit.Length > 1 Then |
||
323 | sConn2Point = sConnSplit(1) |
||
324 | If sConnSplit.Length > 2 Then |
||
325 | sConn3Point = sConnSplit(2) |
||
326 | If sConnSplit.Length > 3 Then |
||
327 | sConn4Point = sConnSplit(3) |
||
328 | End If |
||
329 | End If |
||
330 | End If |
||
331 | |||
332 | ConvertPointBystring(sConn1Point, dSymbolConn1_x, dSymbolConn1_y) |
||
333 | If sConn2Point <> "" Then |
||
334 | ConvertPointBystring(sConn2Point, dSymbolConn2_x, dSymbolConn2_y) |
||
335 | End If |
||
336 | If sConn3Point <> "" Then |
||
337 | ConvertPointBystring(sConn3Point, dSymbolConn3_x, dSymbolConn3_y) |
||
338 | End If |
||
339 | If sConn4Point <> "" Then |
||
340 | ConvertPointBystring(sConn4Point, dSymbolConn4_x, dSymbolConn4_y) |
||
341 | End If |
||
342 | If sConn1_Uid = "" Then |
||
343 | If dLineStart_x - dPlusMinusValue <= dSymbolConn1_x And dLineStart_x + dPlusMinusValue >= dSymbolConn1_x And |
||
344 | dLineStart_y - dPlusMinusValue <= dSymbolConn1_y And dLineStart_y + dPlusMinusValue >= dSymbolConn1_y Then |
||
345 | sConn1_Uid = sSymbolUid |
||
346 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sLineUid |
||
347 | oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid |
||
348 | ElseIf dLineStart_x - dPlusMinusValue <= dSymbolConn2_x And dLineStart_x + dPlusMinusValue >= dSymbolConn2_x And |
||
349 | dLineStart_y - dPlusMinusValue <= dSymbolConn2_y And dLineStart_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
350 | sConn1_Uid = sSymbolUid |
||
351 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sLineUid |
||
352 | oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid |
||
353 | ElseIf dLineStart_x - dPlusMinusValue <= dSymbolConn3_x And dLineStart_x + dPlusMinusValue >= dSymbolConn3_x And |
||
354 | dLineStart_y - dPlusMinusValue <= dSymbolConn3_y And dLineStart_y + dPlusMinusValue >= dSymbolConn3_y Then |
||
355 | sConn1_Uid = sSymbolUid |
||
356 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sLineUid |
||
357 | oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid |
||
358 | ElseIf dLineStart_x - dPlusMinusValue <= dSymbolConn4_x And dLineStart_x + dPlusMinusValue >= dSymbolConn4_x And |
||
359 | dLineStart_y - dPlusMinusValue <= dSymbolConn4_y And dLineStart_y + dPlusMinusValue >= dSymbolConn4_y Then |
||
360 | sConn1_Uid = sSymbolUid |
||
361 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sLineUid |
||
362 | oLineRow(_XML_LINE_Conn1_Uid) = sSymbolUid |
||
363 | End If |
||
364 | End If |
||
365 | If sConn2_Uid = "" Then |
||
366 | If dLineEnd_x - dPlusMinusValue <= dSymbolConn1_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn1_x And |
||
367 | dLineEnd_y - dPlusMinusValue <= dSymbolConn1_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn1_y Then |
||
368 | sConn2_Uid = sSymbolUid |
||
369 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sLineUid |
||
370 | oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid |
||
371 | ElseIf dLineEnd_x - dPlusMinusValue <= dSymbolConn2_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn2_x And |
||
372 | dLineEnd_y - dPlusMinusValue <= dSymbolConn2_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
373 | sConn2_Uid = sSymbolUid |
||
374 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sLineUid |
||
375 | oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid |
||
376 | ElseIf dLineEnd_x - dPlusMinusValue <= dSymbolConn3_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn3_x And |
||
377 | dLineEnd_y - dPlusMinusValue <= dSymbolConn3_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn3_y Then |
||
378 | sConn2_Uid = sSymbolUid |
||
379 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sLineUid |
||
380 | oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid |
||
381 | ElseIf dLineEnd_x - dPlusMinusValue <= dSymbolConn4_x And dLineEnd_x + dPlusMinusValue >= dSymbolConn4_x And |
||
382 | dLineEnd_y - dPlusMinusValue <= dSymbolConn4_y And dLineEnd_y + dPlusMinusValue >= dSymbolConn4_y Then |
||
383 | sConn2_Uid = sSymbolUid |
||
384 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sLineUid |
||
385 | oLineRow(_XML_LINE_Conn2_Uid) = sSymbolUid |
||
386 | End If |
||
387 | End If |
||
388 | |||
389 | End If |
||
390 | Next |
||
391 | Next |
||
392 | |||
393 | oLineRow(_XML_LINE_Conn1_Uid) = sConn1_Uid |
||
394 | oLineRow(_XML_LINE_Conn2_Uid) = sConn2_Uid |
||
395 | Next |
||
396 | Catch ex As Exception |
||
397 | Return False |
||
398 | End Try |
||
399 | |||
400 | Return True |
||
401 | End Function |
||
402 | |||
403 | |||
404 | #Region "Symbol과 Symbol Connection 찾기" |
||
405 | Public Function CalcSymbolConnectionItem_Equal(ByRef oLinelist_Dt_Symbol As DataTable, ByRef oLineLists As List(Of Line_no)) As Boolean |
||
406 | Try |
||
407 | For Each oSymbolRow In oLinelist_Dt_Symbol.Rows |
||
408 | Dim sUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
409 | If sUid = "9ebcb62e-156e-4d3c-aeb2-3d9e5089915e" Then |
||
410 | ' MessageBox.Show("") |
||
411 | End If |
||
412 | Dim dConn1_x As Double = 0.0 |
||
413 | Dim dConn1_y As Double = 0.0 |
||
414 | Dim dConn2_x As Double = 0.0 |
||
415 | Dim dConn2_y As Double = 0.0 |
||
416 | Dim dConn3_x As Double = 0.0 |
||
417 | Dim dConn3_y As Double = 0.0 |
||
418 | Dim dConn4_x As Double = 0.0 |
||
419 | Dim dConn4_y As Double = 0.0 |
||
420 | Dim sConnPoint As String = oSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString() |
||
421 | Dim sConnSplit As String() = sConnPoint.Split("/") |
||
422 | Dim sConn1Point As String = "" |
||
423 | Dim sConn2Point As String = "" |
||
424 | Dim sConn3Point As String = "" |
||
425 | Dim sConn4Point As String = "" |
||
426 | |||
427 | Dim sConn1_Uid As String = oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString() |
||
428 | Dim sConn2_Uid As String = oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString() |
||
429 | Dim sConn3_Uid As String = oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString() |
||
430 | Dim sConn4_Uid As String = oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString() |
||
431 | |||
432 | |||
433 | sConn1Point = sConnSplit(0) |
||
434 | |||
435 | If sConnSplit.Length > 1 Then |
||
436 | sConn2Point = sConnSplit(1) |
||
437 | If sConnSplit.Length > 2 Then |
||
438 | sConn3Point = sConnSplit(2) |
||
439 | If sConnSplit.Length > 3 Then |
||
440 | sConn4Point = sConnSplit(3) |
||
441 | End If |
||
442 | End If |
||
443 | End If |
||
444 | If sConn1Point <> "" Then |
||
445 | ConvertPointBystring(sConn1Point, dConn1_x, dConn1_y) |
||
446 | End If |
||
447 | |||
448 | If sConn2Point <> "" Then |
||
449 | ConvertPointBystring(sConn2Point, dConn2_x, dConn2_y) |
||
450 | End If |
||
451 | |||
452 | If sConn3Point <> "" Then |
||
453 | ConvertPointBystring(sConn3Point, dConn3_x, dConn3_y) |
||
454 | End If |
||
455 | |||
456 | If sConn4Point <> "" Then |
||
457 | ConvertPointBystring(sConn4Point, dConn4_x, dConn4_y) |
||
458 | End If |
||
459 | |||
460 | For Each oLinelist In oLineLists |
||
461 | For Each oConnSymbolRow In oLinelist.Dt_Symbol.Rows |
||
462 | Dim sSymbolUid As String = oConnSymbolRow(_XML_SYMBOL_UID).ToString() |
||
463 | If sUid <> sSymbolUid Then |
||
464 | Dim sSymbolName As String = oConnSymbolRow(_XML_SYMBOL_NAME).ToString() |
||
465 | Dim sSymbolConnPoint As String = oConnSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString() |
||
466 | Dim sRelConnSplit As String() = sSymbolConnPoint.Split("/") |
||
467 | If sSymbolConnPoint <> "" Then |
||
468 | Dim dSymbolConn1_x As Double = 0.0 |
||
469 | Dim dSymbolConn1_y As Double = 0.0 |
||
470 | Dim dSymbolConn2_x As Double = 0.0 |
||
471 | Dim dSymbolConn2_y As Double = 0.0 |
||
472 | Dim dSymbolConn3_x As Double = 0.0 |
||
473 | Dim dSymbolConn3_y As Double = 0.0 |
||
474 | Dim dSymbolConn4_x As Double = 0.0 |
||
475 | Dim dSymbolConn4_y As Double = 0.0 |
||
476 | Dim sRelConn1Point As String = "" |
||
477 | Dim sRelConn2Point As String = "" |
||
478 | Dim sRelConn3Point As String = "" |
||
479 | Dim sRelConn4Point As String = "" |
||
480 | sRelConn1Point = sRelConnSplit(0) |
||
481 | If sRelConnSplit.Length > 1 Then |
||
482 | sRelConn2Point = sRelConnSplit(1) |
||
483 | If sRelConnSplit.Length > 2 Then |
||
484 | sRelConn3Point = sRelConnSplit(2) |
||
485 | If sRelConnSplit.Length > 3 Then |
||
486 | sRelConn4Point = sRelConnSplit(3) |
||
487 | End If |
||
488 | End If |
||
489 | End If |
||
490 | ConvertPointBystring(sRelConn1Point, dSymbolConn1_x, dSymbolConn1_y) |
||
491 | If sRelConn2Point <> "" Then |
||
492 | ConvertPointBystring(sRelConn2Point, dSymbolConn2_x, dSymbolConn2_y) |
||
493 | End If |
||
494 | If sRelConn3Point <> "" Then |
||
495 | ConvertPointBystring(sRelConn3Point, dSymbolConn3_x, dSymbolConn3_y) |
||
496 | End If |
||
497 | If sRelConn4Point <> "" Then |
||
498 | ConvertPointBystring(sRelConn4Point, dSymbolConn4_x, dSymbolConn4_y) |
||
499 | End If |
||
500 | |||
501 | If sConn1_Uid = "" And dConn1_x > 0 And dConn1_y > 0 Then |
||
502 | If dConn1_x = dSymbolConn1_x And dConn1_y = dSymbolConn1_y Then |
||
503 | sConn1_Uid = sSymbolUid |
||
504 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
505 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
506 | ElseIf dConn1_x = dSymbolConn2_x And dConn1_y = dSymbolConn2_y Then |
||
507 | sConn1_Uid = sSymbolUid |
||
508 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
509 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
510 | ElseIf dConn1_x = dSymbolConn3_x And dConn1_y = dSymbolConn3_y Then |
||
511 | sConn1_Uid = sSymbolUid |
||
512 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
513 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
514 | ElseIf dConn1_x = dSymbolConn4_x And dConn1_y = dSymbolConn4_y Then |
||
515 | sConn1_Uid = sSymbolUid |
||
516 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
517 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
518 | End If |
||
519 | End If |
||
520 | |||
521 | If sConn2_Uid = "" And dConn3_x > 0 And dConn3_y > 0 Then |
||
522 | If dConn2_x = dSymbolConn1_x And dConn2_y = dSymbolConn1_y Then |
||
523 | sConn2_Uid = sSymbolUid |
||
524 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
525 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
526 | ElseIf dConn2_x = dSymbolConn2_x And dConn2_y = dSymbolConn2_y Then |
||
527 | sConn2_Uid = sSymbolUid |
||
528 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
529 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
530 | ElseIf dConn2_x = dSymbolConn3_x And dConn2_y = dSymbolConn3_y Then |
||
531 | sConn2_Uid = sSymbolUid |
||
532 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
533 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
534 | ElseIf dConn2_x = dSymbolConn4_x And dConn2_y = dSymbolConn4_y Then |
||
535 | sConn2_Uid = sSymbolUid |
||
536 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
537 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
538 | End If |
||
539 | End If |
||
540 | |||
541 | If sConn3_Uid = "" And dConn3_x > 0 And dConn3_y > 0 Then |
||
542 | If dConn3_x = dSymbolConn1_x And dConn3_y = dSymbolConn1_y Then |
||
543 | sConn3_Uid = sSymbolUid |
||
544 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
545 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
546 | ElseIf dConn3_x = dSymbolConn2_x And dConn3_y = dSymbolConn2_y Then |
||
547 | sConn3_Uid = sSymbolUid |
||
548 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
549 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
550 | ElseIf dConn3_x = dSymbolConn3_x And dConn3_y = dSymbolConn3_y Then |
||
551 | sConn3_Uid = sSymbolUid |
||
552 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
553 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
554 | ElseIf dConn3_x = dSymbolConn4_x And dConn3_y = dSymbolConn4_y Then |
||
555 | sConn3_Uid = sSymbolUid |
||
556 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
557 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
558 | End If |
||
559 | End If |
||
560 | |||
561 | If sConn4_Uid = "" And dConn4_x > 0 And dConn4_y > 0 Then |
||
562 | If dConn4_x = dSymbolConn1_x And dConn4_y = dSymbolConn1_y Then |
||
563 | sConn4_Uid = sSymbolUid |
||
564 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
565 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
566 | ElseIf dConn4_x = dSymbolConn2_x And dConn4_y = dSymbolConn2_y Then |
||
567 | sConn4_Uid = sSymbolUid |
||
568 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
569 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
570 | ElseIf dConn4_x = dSymbolConn3_x And dConn4_y = dSymbolConn3_y Then |
||
571 | sConn4_Uid = sSymbolUid |
||
572 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
573 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
574 | ElseIf dConn4_x = dSymbolConn4_x And dConn4_y = dSymbolConn4_y Then |
||
575 | sConn4_Uid = sSymbolUid |
||
576 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
577 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
578 | End If |
||
579 | End If |
||
580 | |||
581 | |||
582 | End If |
||
583 | End If |
||
584 | Next |
||
585 | Next |
||
586 | |||
587 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sConn1_Uid |
||
588 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sConn2_Uid |
||
589 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sConn3_Uid |
||
590 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sConn4_Uid |
||
591 | Next |
||
592 | Catch ex As Exception |
||
593 | Return False |
||
594 | End Try |
||
595 | |||
596 | Return True |
||
597 | End Function |
||
598 | |||
599 | |||
600 | Public Function CalcSymbolConnectionItem_NonEqual(ByRef oLinelist_Dt_Symbol As DataTable, ByRef oLineLists As List(Of Line_no)) As Boolean |
||
601 | Try |
||
602 | |||
603 | Dim dPlusMinusValue = 10 |
||
604 | |||
605 | For Each oSymbolRow In oLinelist_Dt_Symbol.Rows |
||
606 | Dim sUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
607 | |||
608 | Dim dConn1_x As Double = 0.0 |
||
609 | Dim dConn1_y As Double = 0.0 |
||
610 | Dim dConn2_x As Double = 0.0 |
||
611 | Dim dConn2_y As Double = 0.0 |
||
612 | Dim dConn3_x As Double = 0.0 |
||
613 | Dim dConn3_y As Double = 0.0 |
||
614 | Dim dConn4_x As Double = 0.0 |
||
615 | Dim dConn4_y As Double = 0.0 |
||
616 | Dim sConnPoint As String = oSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString() |
||
617 | Dim sConnSplit As String() = sConnPoint.Split("/") |
||
618 | Dim sConn1Point As String = "" |
||
619 | Dim sConn2Point As String = "" |
||
620 | Dim sConn3Point As String = "" |
||
621 | Dim sConn4Point As String = "" |
||
622 | |||
623 | Dim sConn1_Uid As String = oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString() |
||
624 | Dim sConn2_Uid As String = oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString() |
||
625 | Dim sConn3_Uid As String = oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString() |
||
626 | Dim sConn4_Uid As String = oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString() |
||
627 | |||
628 | sConn1Point = sConnSplit(0) |
||
629 | |||
630 | If sConnSplit.Length > 1 Then |
||
631 | sConn2Point = sConnSplit(1) |
||
632 | If sConnSplit.Length > 2 Then |
||
633 | sConn3Point = sConnSplit(2) |
||
634 | If sConnSplit.Length > 3 Then |
||
635 | sConn4Point = sConnSplit(3) |
||
636 | End If |
||
637 | End If |
||
638 | End If |
||
639 | |||
640 | If sConn1Point <> "" Then |
||
641 | ConvertPointBystring(sConn1Point, dConn1_x, dConn1_y) |
||
642 | End If |
||
643 | |||
644 | If sConn2Point <> "" Then |
||
645 | ConvertPointBystring(sConn2Point, dConn2_x, dConn2_y) |
||
646 | End If |
||
647 | |||
648 | If sConn3Point <> "" Then |
||
649 | ConvertPointBystring(sConn3Point, dConn3_x, dConn3_y) |
||
650 | End If |
||
651 | |||
652 | If sConn4Point <> "" Then |
||
653 | ConvertPointBystring(sConn4Point, dConn4_x, dConn4_y) |
||
654 | End If |
||
655 | For Each oLinelist In oLineLists |
||
656 | For Each oConnSymbolRow In oLinelist.Dt_Symbol.Rows |
||
657 | Dim sSymbolUid As String = oConnSymbolRow(_XML_SYMBOL_UID).ToString() |
||
658 | If sUid <> sSymbolUid Then |
||
659 | Dim sSymbolName As String = oConnSymbolRow(_XML_SYMBOL_NAME).ToString() |
||
660 | Dim sSymbolConnPoint As String = oConnSymbolRow(_XML_SYMBOL_CONNECTIONPOINT).ToString() |
||
661 | Dim sRelConnSplit As String() = sSymbolConnPoint.Split("/") |
||
662 | If sSymbolConnPoint <> "" Then |
||
663 | Dim dSymbolConn1_x As Double = 0.0 |
||
664 | Dim dSymbolConn1_y As Double = 0.0 |
||
665 | Dim dSymbolConn2_x As Double = 0.0 |
||
666 | Dim dSymbolConn2_y As Double = 0.0 |
||
667 | Dim dSymbolConn3_x As Double = 0.0 |
||
668 | Dim dSymbolConn3_y As Double = 0.0 |
||
669 | Dim dSymbolConn4_x As Double = 0.0 |
||
670 | Dim dSymbolConn4_y As Double = 0.0 |
||
671 | Dim sRelConn1Point As String = "" |
||
672 | Dim sRelConn2Point As String = "" |
||
673 | Dim sRelConn3Point As String = "" |
||
674 | Dim sRelConn4Point As String = "" |
||
675 | sRelConn1Point = sRelConnSplit(0) |
||
676 | If sRelConnSplit.Length > 1 Then |
||
677 | sRelConn2Point = sRelConnSplit(1) |
||
678 | If sRelConnSplit.Length > 2 Then |
||
679 | sRelConn3Point = sRelConnSplit(2) |
||
680 | If sRelConnSplit.Length > 3 Then |
||
681 | sRelConn4Point = sRelConnSplit(3) |
||
682 | End If |
||
683 | End If |
||
684 | End If |
||
685 | ConvertPointBystring(sRelConn1Point, dSymbolConn1_x, dSymbolConn1_y) |
||
686 | If sConn2Point <> "" Then |
||
687 | ConvertPointBystring(sRelConn2Point, dSymbolConn2_x, dSymbolConn2_y) |
||
688 | End If |
||
689 | If sConn3Point <> "" Then |
||
690 | ConvertPointBystring(sRelConn3Point, dSymbolConn3_x, dSymbolConn3_y) |
||
691 | End If |
||
692 | If sConn4Point <> "" Then |
||
693 | ConvertPointBystring(sRelConn4Point, dSymbolConn4_x, dSymbolConn4_y) |
||
694 | End If |
||
695 | If sConn1_Uid = "" Then |
||
696 | If dConn1_x > 0 And dConn1_y > 0 Then |
||
697 | If dConn1_x - dPlusMinusValue <= dSymbolConn1_x And dConn1_x + dPlusMinusValue >= dSymbolConn1_x And |
||
698 | dConn1_y - dPlusMinusValue <= dSymbolConn1_y And dConn1_y + dPlusMinusValue >= dSymbolConn1_y Then |
||
699 | sConn1_Uid = sSymbolUid |
||
700 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
701 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
702 | ElseIf dConn1_x - dPlusMinusValue <= dSymbolConn2_x And dConn1_x + dPlusMinusValue >= dSymbolConn2_x And |
||
703 | dConn1_y - dPlusMinusValue <= dSymbolConn2_y And dConn1_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
704 | sConn1_Uid = sSymbolUid |
||
705 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
706 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
707 | ElseIf dConn1_x - dPlusMinusValue <= dSymbolConn3_x And dConn1_x + dPlusMinusValue >= dSymbolConn3_x And |
||
708 | dConn1_y - dPlusMinusValue <= dSymbolConn3_y And dConn1_y + dPlusMinusValue >= dSymbolConn3_y Then |
||
709 | sConn1_Uid = sSymbolUid |
||
710 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
711 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
712 | ElseIf dConn1_x - dPlusMinusValue <= dSymbolConn4_x And dConn1_x + dPlusMinusValue >= dSymbolConn4_x And |
||
713 | dConn1_y - dPlusMinusValue <= dSymbolConn2_y And dConn1_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
714 | sConn1_Uid = sSymbolUid |
||
715 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
716 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sSymbolUid |
||
717 | End If |
||
718 | End If |
||
719 | End If |
||
720 | |||
721 | If sConn2_Uid = "" Then |
||
722 | If dConn2_x > 0 And dConn2_y > 0 Then |
||
723 | If dConn2_x - dPlusMinusValue <= dSymbolConn1_x And dConn2_x + dPlusMinusValue >= dSymbolConn1_x And |
||
724 | dConn2_y - dPlusMinusValue <= dSymbolConn1_y And dConn2_y + dPlusMinusValue >= dSymbolConn1_y Then |
||
725 | sConn2_Uid = sSymbolUid |
||
726 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
727 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
728 | ElseIf dConn2_x - dPlusMinusValue <= dSymbolConn2_x And dConn2_x + dPlusMinusValue >= dSymbolConn2_x And |
||
729 | dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
730 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
731 | sConn2_Uid = sSymbolUid |
||
732 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
733 | ElseIf dConn2_x - dPlusMinusValue <= dSymbolConn3_x And dConn2_x + dPlusMinusValue >= dSymbolConn3_x And |
||
734 | dConn2_y - dPlusMinusValue <= dSymbolConn3_y And dConn2_y + dPlusMinusValue >= dSymbolConn3_y Then |
||
735 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
736 | sConn2_Uid = sSymbolUid |
||
737 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
738 | ElseIf dConn2_x - dPlusMinusValue <= dSymbolConn4_x And dConn2_x + dPlusMinusValue >= dSymbolConn4_x And |
||
739 | dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
740 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
741 | sConn2_Uid = sSymbolUid |
||
742 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sSymbolUid |
||
743 | End If |
||
744 | End If |
||
745 | End If |
||
746 | |||
747 | |||
748 | If sConn3_Uid = "" Then |
||
749 | If dConn3_x > 0 And dConn3_y > 0 Then |
||
750 | If dConn3_x - dPlusMinusValue <= dSymbolConn1_x And dConn3_x + dPlusMinusValue >= dSymbolConn1_x And |
||
751 | dConn2_y - dPlusMinusValue <= dSymbolConn1_y And dConn2_y + dPlusMinusValue >= dSymbolConn1_y Then |
||
752 | sConn2_Uid = sSymbolUid |
||
753 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
754 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
755 | |||
756 | ElseIf dConn3_x - dPlusMinusValue <= dSymbolConn2_x And dConn3_x + dPlusMinusValue >= dSymbolConn2_x And |
||
757 | dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
758 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
759 | sConn2_Uid = sSymbolUid |
||
760 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
761 | ElseIf dConn3_x - dPlusMinusValue <= dSymbolConn3_x And dConn3_x + dPlusMinusValue >= dSymbolConn3_x And |
||
762 | dConn2_y - dPlusMinusValue <= dSymbolConn3_y And dConn2_y + dPlusMinusValue >= dSymbolConn3_y Then |
||
763 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
764 | sConn2_Uid = sSymbolUid |
||
765 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
766 | ElseIf dConn3_x - dPlusMinusValue <= dSymbolConn4_x And dConn3_x + dPlusMinusValue >= dSymbolConn4_x And |
||
767 | dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
768 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
769 | sConn2_Uid = sSymbolUid |
||
770 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sSymbolUid |
||
771 | End If |
||
772 | End If |
||
773 | End If |
||
774 | |||
775 | |||
776 | If sConn4_Uid = "" Then |
||
777 | If dConn4_x > 0 And dConn4_y > 0 Then |
||
778 | If dConn4_x - dPlusMinusValue <= dSymbolConn1_x And dConn4_x + dPlusMinusValue >= dSymbolConn1_x And |
||
779 | dConn2_y - dPlusMinusValue <= dSymbolConn1_y And dConn2_y + dPlusMinusValue >= dSymbolConn1_y Then |
||
780 | sConn2_Uid = sSymbolUid |
||
781 | oConnSymbolRow(_XML_SYMBOL_Conn1_Uid) = sUid |
||
782 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
783 | ElseIf dConn4_x - dPlusMinusValue <= dSymbolConn2_x And dConn4_x + dPlusMinusValue >= dSymbolConn2_x And |
||
784 | dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
785 | oConnSymbolRow(_XML_SYMBOL_Conn2_Uid) = sUid |
||
786 | sConn2_Uid = sSymbolUid |
||
787 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
788 | ElseIf dConn4_x - dPlusMinusValue <= dSymbolConn3_x And dConn4_x + dPlusMinusValue >= dSymbolConn3_x And |
||
789 | dConn2_y - dPlusMinusValue <= dSymbolConn3_y And dConn2_y + dPlusMinusValue >= dSymbolConn3_y Then |
||
790 | oConnSymbolRow(_XML_SYMBOL_Conn3_Uid) = sUid |
||
791 | sConn2_Uid = sSymbolUid |
||
792 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
793 | ElseIf dConn4_x - dPlusMinusValue <= dSymbolConn4_x And dConn4_x + dPlusMinusValue >= dSymbolConn4_x And |
||
794 | dConn2_y - dPlusMinusValue <= dSymbolConn2_y And dConn2_y + dPlusMinusValue >= dSymbolConn2_y Then |
||
795 | oConnSymbolRow(_XML_SYMBOL_Conn4_Uid) = sUid |
||
796 | sConn2_Uid = sSymbolUid |
||
797 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sSymbolUid |
||
798 | End If |
||
799 | End If |
||
800 | End If |
||
801 | |||
802 | End If |
||
803 | End If |
||
804 | |||
805 | Next |
||
806 | Next |
||
807 | |||
808 | oSymbolRow(_XML_SYMBOL_Conn1_Uid) = sConn1_Uid |
||
809 | oSymbolRow(_XML_SYMBOL_Conn2_Uid) = sConn2_Uid |
||
810 | oSymbolRow(_XML_SYMBOL_Conn3_Uid) = sConn3_Uid |
||
811 | oSymbolRow(_XML_SYMBOL_Conn4_Uid) = sConn4_Uid |
||
812 | Next |
||
813 | Catch ex As Exception |
||
814 | Return False |
||
815 | End Try |
||
816 | |||
817 | Return True |
||
818 | End Function |
||
819 | |||
820 | |||
821 | |||
822 | #End Region |
||
823 | |||
824 | |||
825 | |||
826 | Private Function ConvertPointBystring(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean |
||
827 | Try |
||
828 | Dim opointstr As String() = Split(sPoint, ",") |
||
829 | If (opointstr.Length > 1) Then |
||
830 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
831 | dX = opointstr(0) |
||
832 | dY = opointstr(1) |
||
833 | Else |
||
834 | dX = 0 |
||
835 | dY = 0 |
||
836 | Return False |
||
837 | End If |
||
838 | End If |
||
839 | Return True |
||
840 | Catch ex As Exception |
||
841 | Return False |
||
842 | End Try |
||
843 | End Function |
||
844 | Private Function CheckDuplicatePoint(ByVal dLineStart_x As Double, ByVal dLineStart_y As Double, ByVal dLineEnd_x As Double, ByVal dLineEnd_y As Double, |
||
845 | ByVal dConnLineStart_x As Double, ByVal dConnLineStart_y As Double, ByVal dConnLineEnd_x As Double, ByVal dConnLineEnd_y As Double) |
||
846 | If dLineStart_x = dConnLineStart_x And dLineStart_y = dConnLineStart_y And |
||
847 | dLineEnd_x = dConnLineEnd_x And dLineEnd_y = dConnLineEnd_y Then |
||
848 | Return False |
||
849 | ElseIf dLineStart_x = dConnLineEnd_x And dLineStart_y = dConnLineEnd_y And |
||
850 | dLineEnd_x = dConnLineStart_x And dLineEnd_y = dConnLineStart_y Then |
||
851 | Return False |
||
852 | Else |
||
853 | Return True |
||
854 | End If |
||
855 | End Function |
||
856 | End Class |