프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / DTI_PID / SPPIDConverter / BaseModel / Document.cs @ 1ed39474

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

1 96a2080c gaqhf
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.IO;
7
using System.Xml.Linq;
8
using System.Windows.Forms;
9
10
namespace Converter.BaseModel
11
{
12
    public class Document
13
    {
14
        private string _DWGNAME;
15
        private string _SIZE;
16 39a2a688 gaqhf
        private double _SIZE_WIDTH;
17
        private double _SIZE_HEIGHT;
18 60244a8b gaqhf
        private List<Symbol> _SYMBOLS = new List<Symbol>();
19
        private List<Text> _TEXTINFOS = new List<Text>();
20
        private List<Note> _NOTES = new List<Note>();
21
        private List<Line> _LINES = new List<Line>();
22
        private List<LineNumber> _LINENUMBERS = new List<LineNumber>();
23 8aa6f2db gaqhf
        private List<TrimLine> _TRIMLINES = new List<TrimLine>();
24 f1c9dbaa gaqhf
        private List<EndBreak> _EndBreaks = new List<EndBreak>();
25 53c81765 gaqhf
        private List<SpecBreak> _SpecBreaks = new List<SpecBreak>();
26 f1c9dbaa gaqhf
        private List<Equipment> _Equipments = new List<Equipment>();
27 60244a8b gaqhf
        private bool _Enable;
28
29
        public bool Enable { get { return _Enable; } }
30 96a2080c gaqhf
31
        public List<Symbol> SYMBOLS { get => _SYMBOLS; set => _SYMBOLS = value; }
32
        public List<Text> TEXTINFOS { get => _TEXTINFOS; set => _TEXTINFOS = value; }
33
        public List<Note> NOTES { get => _NOTES; set => _NOTES = value; }
34
        public List<Line> LINES { get => _LINES; set => _LINES = value; }
35
        public List<LineNumber> LINENUMBERS { get => _LINENUMBERS; set => _LINENUMBERS = value; }
36 f1c9dbaa gaqhf
        public List<EndBreak> EndBreaks { get => _EndBreaks; set => _EndBreaks = value; }
37 53c81765 gaqhf
        public List<SpecBreak> SpecBreaks { get => _SpecBreaks; set => _SpecBreaks = value; }
38 f1c9dbaa gaqhf
        public List<Equipment> Equipments { get => _Equipments; set => _Equipments = value; }
39 96a2080c gaqhf
        public string DWGNAME { get => _DWGNAME; set => _DWGNAME = value; }
40 39a2a688 gaqhf
        public string SIZE
41
        {
42
            get
43
            {
44
                return _SIZE;
45
            }
46
            set
47
            {
48
                _SIZE = value;
49
                string[] pointArr = _SIZE.Split(new char[] { ',' });
50
                if (pointArr.Length == 2)
51
                {
52
                    _SIZE_WIDTH = Convert.ToDouble(pointArr[0]);
53
                    _SIZE_HEIGHT = Convert.ToDouble(pointArr[1]);
54
                }
55
            }
56
        }
57
        public double SIZE_WIDTH { get => _SIZE_WIDTH; }
58
        public double SIZE_HEIGHT { get => _SIZE_HEIGHT; }
59 8aa6f2db gaqhf
        public List<TrimLine> TRIMLINES { get => _TRIMLINES; set => _TRIMLINES = value; }
60 e8536f2b gaqhf
        public string PATH { get; set; }
61 96a2080c gaqhf
62
        public Document(string xmlPath)
63
        {
64
            try
65
            {
66 e8536f2b gaqhf
                PATH = xmlPath;
67 96a2080c gaqhf
                XElement xml = XElement.Load(xmlPath);
68
                DWGNAME = xml.Element("DWGNAME").Value;
69
                SIZE = xml.Element("SIZE").Value;
70
71 ea80efaa gaqhf
                SetText(xml.Element("TEXTINFOS"));
72
                SetNote(xml.Element("NOTES"));
73 96a2080c gaqhf
                SetSymbol(xml.Element("SYMBOLS"));
74
                SetLine(xml.Element("LINEINFOS"));
75
                SetLineNumber(xml.Element("LINENOS"));
76 8aa6f2db gaqhf
                SetTrimLine(xml.Element("TRIMLINENOS"));
77 60244a8b gaqhf
78
                _Enable = true;
79 96a2080c gaqhf
            }
80
            catch (Exception ex)
81
            {
82 60244a8b gaqhf
                _Enable = false;
83 96a2080c gaqhf
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
84
            }
85
        }
86
87 60244a8b gaqhf
        #region READ XML
88 96a2080c gaqhf
        private void SetSymbol(XElement node)
89
        {
90
            foreach (XElement item in node.Elements("SYMBOL"))
91
            {
92 f1c9dbaa gaqhf
                string sType = item.Element("TYPE").Value;
93
                if (sType == "Segment Breaks")
94 96a2080c gaqhf
                {
95 53c81765 gaqhf
                    SpecBreak specBreak = new SpecBreak()
96
                    {
97
                        UID = item.Element("UID").Value,
98
                        DBUID = item.Element("DBUID").Value,
99
                        NAME = item.Element("NAME").Value,
100
                        TYPE = item.Element("TYPE").Value,
101
                        OWNER = item.Element("OWNER").Value,
102
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
103
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
104
                        LOCATION = item.Element("LOCATION").Value,
105
                        SIZE = item.Element("SIZE").Value,
106
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
107
                        PARENT = item.Element("PARENT").Value,
108
                        CHILD = item.Element("CHILD").Value,
109
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
110
                        AREA = item.Element("AREA").Value,
111
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
112
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
113
                    };
114
                    SetAssociations(item.Element("ASSOCIATIONS"), specBreak.ASSOCIATIONS);
115
                    SetSymbolConnectors(item.Element("CONNECTORS"), specBreak.CONNECTORS, specBreak.CONNECTIONPOINT);
116
                    SetProperties(item.Element("PROPERTIES"), specBreak.PROPERTIES);
117
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), specBreak.ATTRIBUTES);
118
                    SetSpecBreakAttribute(specBreak);
119
120
                    SpecBreaks.Add(specBreak);
121 f1c9dbaa gaqhf
                }
122
                else if (sType == "End Break")
123
                {
124
                    EndBreak endBreak = new EndBreak()
125
                    {
126
                        UID = item.Element("UID").Value,
127
                        DBUID = item.Element("DBUID").Value,
128
                        NAME = item.Element("NAME").Value,
129
                        TYPE = item.Element("TYPE").Value,
130
                        OWNER = item.Element("OWNER").Value,
131
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
132
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
133
                        LOCATION = item.Element("LOCATION").Value,
134
                        SIZE = item.Element("SIZE").Value,
135
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
136
                        PARENT = item.Element("PARENT").Value,
137
                        CHILD = item.Element("CHILD").Value,
138
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
139
                        AREA = item.Element("AREA").Value,
140
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
141
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
142
                    };
143
                    SetAssociations(item.Element("ASSOCIATIONS"), endBreak.ASSOCIATIONS);
144
                    SetSymbolConnectors(item.Element("CONNECTORS"), endBreak.CONNECTORS, endBreak.CONNECTIONPOINT);
145
                    SetProperties(item.Element("PROPERTIES"), endBreak.PROPERTIES);
146
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), endBreak.ATTRIBUTES);
147
148
                    EndBreaks.Add(endBreak);
149
                }
150
                else if (sType == "Black Box System" ||
151
                    sType == "GGO_Equipment" ||
152
                    sType == "Heat Transfer Equipment" ||
153
                    sType == "Mechanical" ||
154
                    sType == "Other Equipment" ||
155
                    sType == "Vessels")
156
                {
157
                    Equipment equipment = new Equipment()
158
                    {
159
                        UID = item.Element("UID").Value,
160
                        DBUID = item.Element("DBUID").Value,
161
                        NAME = item.Element("NAME").Value,
162
                        TYPE = item.Element("TYPE").Value,
163
                        OWNER = item.Element("OWNER").Value,
164
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
165
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
166
                        LOCATION = item.Element("LOCATION").Value,
167
                        SIZE = item.Element("SIZE").Value,
168
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
169
                        PARENT = item.Element("PARENT").Value,
170
                        CHILD = item.Element("CHILD").Value,
171
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
172
                        AREA = item.Element("AREA").Value,
173
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
174
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
175
                    };
176
                    SetAssociations(item.Element("ASSOCIATIONS"), equipment.ASSOCIATIONS);
177
                    SetSymbolConnectors(item.Element("CONNECTORS"), equipment.CONNECTORS, equipment.CONNECTIONPOINT);
178
                    SetProperties(item.Element("PROPERTIES"), equipment.PROPERTIES);
179
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), equipment.ATTRIBUTES);
180 bca81f4c gaqhf
181 f1c9dbaa gaqhf
                    Equipments.Add(equipment);
182
                }
183
                else
184
                {
185
                    Symbol symbol = new Symbol()
186
                    {
187
                        UID = item.Element("UID").Value,
188
                        DBUID = item.Element("DBUID").Value,
189
                        NAME = item.Element("NAME").Value,
190
                        TYPE = item.Element("TYPE").Value,
191
                        OWNER = item.Element("OWNER").Value,
192
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
193
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
194
                        LOCATION = item.Element("LOCATION").Value,
195
                        SIZE = item.Element("SIZE").Value,
196
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
197
                        PARENT = item.Element("PARENT").Value,
198
                        CHILD = item.Element("CHILD").Value,
199
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
200
                        AREA = item.Element("AREA").Value,
201
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
202
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
203
                    };
204 8aa6f2db gaqhf
205 f1c9dbaa gaqhf
                    SetAssociations(item.Element("ASSOCIATIONS"), symbol.ASSOCIATIONS);
206
                    SetSymbolConnectors(item.Element("CONNECTORS"), symbol.CONNECTORS, symbol.CONNECTIONPOINT);
207
                    SetProperties(item.Element("PROPERTIES"), symbol.PROPERTIES);
208
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), symbol.ATTRIBUTES);
209
                    SetChildSymbol(symbol);
210
211
                    SYMBOLS.Add(symbol);
212
                }
213 96a2080c gaqhf
            }
214
        }
215
216
        private void SetLine(XElement node)
217
        {
218
            foreach (XElement item in node.Elements("LINE"))
219
            {
220 60244a8b gaqhf
                Line line = new Line()
221 96a2080c gaqhf
                {
222 60244a8b gaqhf
                    OWNER = item.Attribute("OWNER").Value,
223
                    UID = item.Element("UID").Value,
224
                    STARTPOINT = item.Element("STARTPOINT").Value,
225
                    ENDPOINT = item.Element("ENDPOINT").Value,
226
                    TYPE = item.Element("TYPE").Value,
227 30d2cfcc gaqhf
                    TYPEUID = item.Element("TYPE").Attribute("TYPEUID").Value,
228 60244a8b gaqhf
                    AREA = item.Element("AREA").Value,
229
                    THICKNESS = item.Element("THICKNESS").Value,
230
                };
231 b2d1c1aa gaqhf
                int flowMarkPercent = 0;
232
                if (int.TryParse(item.Element("FLOWMARK").Value, out flowMarkPercent))
233
                {
234
                    line.FLOWMARK = true;
235
                    line.FLOWMARK_PERCENT = flowMarkPercent;
236
                }
237
                else
238
                    line.FLOWMARK = false;
239
240 cfda1fed gaqhf
                SetConnectors(item.Element("CONNECTORS"), line.CONNECTORS);
241 60244a8b gaqhf
                LINES.Add(line);
242 96a2080c gaqhf
            }
243
        }
244
245
        private void SetLineNumber(XElement node)
246
        {
247
            foreach (XElement item in node.Elements("LINE_NO"))
248
            {
249 4d2571ab gaqhf
                try
250 96a2080c gaqhf
                {
251 4d2571ab gaqhf
                    LineNumber lineNumber = new LineNumber()
252
                    {
253
                        UID = item.Element("UID").Value,
254
                        TEXT = item.Element("TEXT").Value,
255
                        LOCATION = item.Element("LOCATION").Value,
256
                        WIDTH = item.Element("WIDTH").Value,
257
                        HEIGHT = item.Element("HEIGHT").Value,
258
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
259
                        AREA = item.Element("AREA").Value,
260
                        CONNLINE = item.Element("CONNLINE").Value,
261
                        SCENE = item.Element("SCENE").Value
262
                    };
263
                    SetLineNumberRuns(item, lineNumber.RUNS);
264
                    SetProperties(item.Element("PROPERTIES"), lineNumber.PROPERTIES);
265
                    SetAttributes(item, lineNumber.ATTRIBUTES);
266
                    LINENUMBERS.Add(lineNumber);
267
                }
268
                catch (Exception ex)
269
                {
270
                    StringBuilder sb = new StringBuilder();
271
                    sb.AppendLine(item.Element("UID").Value);
272
                    sb.AppendLine("");
273
                    sb.AppendLine(ex.Message);
274
                    sb.AppendLine(ex.StackTrace);
275
                    MessageBox.Show(sb.ToString());
276
                }
277 96a2080c gaqhf
            }
278
        }
279
280
        private void SetText(XElement node)
281
        {
282
            foreach (XElement item in node.Elements("ATTRIBUTE"))
283
            {
284 60244a8b gaqhf
                Text text = new Text()
285 96a2080c gaqhf
                {
286 60244a8b gaqhf
                    UID = item.Element("UID").Value,
287 ea80efaa gaqhf
                    OWNER = item.Element("OWNER").Value,
288 60244a8b gaqhf
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
289
                    NAME = item.Element("NAME").Value,
290
                    LOCATION = item.Element("LOCATION").Value,
291
                    VALUE = item.Element("VALUE").Value,
292
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
293
                    WIDTH = item.Element("WIDTH").Value,
294
                    HEIGHT = item.Element("HEIGHT").Value,
295 1a3a74a8 gaqhf
                    AREA = item.Element("AREA").Value,
296
                    SCENE = item.Element("SCENE").Value
297 60244a8b gaqhf
                };
298 96a2080c gaqhf
299 60244a8b gaqhf
                TEXTINFOS.Add(text);
300 96a2080c gaqhf
            }
301
        }
302
303
        private void SetNote(XElement node)
304
        {
305
            foreach (XElement item in node.Elements("ATTRIBUTE"))
306
            {
307 60244a8b gaqhf
                Note note = new Note()
308 96a2080c gaqhf
                {
309 60244a8b gaqhf
                    UID = item.Element("UID").Value,
310
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
311
                    NAME = item.Element("NAME").Value,
312
                    LOCATION = item.Element("LOCATION").Value,
313
                    VALUE = item.Element("VALUE").Value,
314
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
315
                    WIDTH = item.Element("WIDTH").Value,
316
                    HEIGHT = item.Element("HEIGHT").Value,
317 1a3a74a8 gaqhf
                    AREA = item.Element("AREA").Value,
318
                    SCENE = item.Element("SCENE").Value
319 60244a8b gaqhf
                };
320 96a2080c gaqhf
321 60244a8b gaqhf
                NOTES.Add(note);
322
            }
323
        }
324 8aa6f2db gaqhf
325
        private void SetTrimLine(XElement node)
326
        {
327
            foreach (XElement item in node.Elements("TRIM_LINE_NO"))
328
            {
329
                TrimLine trimLine = new TrimLine()
330
                {
331
                    UID = item.Element("UID").Value,
332
                };
333
                SetLineNumberRuns(item, trimLine.RUNS);
334
                TRIMLINES.Add(trimLine);
335
            }
336
        }
337
338 60244a8b gaqhf
        private void SetAssociations(XElement node, List<Association> associations)
339
        {
340
            foreach (XElement item in node.Elements("ASSOCIATION"))
341
            {
342 ea80efaa gaqhf
                Association association = new Association()
343 60244a8b gaqhf
                {
344
                    TYPE = item.Attribute("TYPE").Value,
345
                    VALUE = item.Value
346 ea80efaa gaqhf
                };
347
348
                associations.Add(association);
349 96a2080c gaqhf
            }
350
        }
351 60244a8b gaqhf
352
        private void SetConnectors(XElement node, List<Connector> connectors)
353
        {
354
            foreach (XElement item in node.Elements("CONNECTOR"))
355
            {
356
                connectors.Add(new Connector()
357
                {
358
                    UID = item.Attribute("UID").Value,
359
                    CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value),
360 bca81f4c gaqhf
                    CONNECTEDITEM = item.Element("CONNECTEDITEM").Value,
361
                    CONNECTPOINT = item.Element("CONNECTPOINT").Value,
362
                    SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value,
363
                });
364
            }
365
        }
366
367
        private void SetSymbolConnectors(XElement node, List<Connector> connectors, string CONNECTIONPOINT)
368
        {
369
            foreach (XElement item in node.Elements("CONNECTOR"))
370
            {
371
                connectors.Add(new Connector()
372
                {
373
                    UID = item.Attribute("UID").Value,
374
                    CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value),
375 60244a8b gaqhf
                    CONNECTEDITEM = item.Element("CONNECTEDITEM").Value,
376
                    CONNECTPOINT = item.Element("CONNECTPOINT").Value,
377
                    SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value,
378
                });
379
            }
380
        }
381
382
        private void SetProperties(XElement node, List<Property> properties)
383
        {
384
            foreach (XElement item in node.Elements("PROPERTY"))
385
            {
386 30d2cfcc gaqhf
                properties.Add(new Property()
387 60244a8b gaqhf
                {
388 30d2cfcc gaqhf
                    UID = item.Attribute("UID").Value,
389
                    LENGTH = item.Attribute("Length").Value,
390
                    EXPRESSION = item.Attribute("Expression").Value,
391
                    DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value,
392
                    ATTRIBUTETYPE = item.Attribute("AttributeType").Value,
393
                    ATTRIBUTE = item.Attribute("Attribute").Value,
394
                    VALUE = item.Value
395
                });
396 60244a8b gaqhf
            }
397
        }
398
399
        private void SetAttributes(XElement node, List<Attribute> attributes)
400
        {
401 30d2cfcc gaqhf
            foreach (XElement item in node.Elements("ATTRIBUTE"))
402 60244a8b gaqhf
            {
403 73415441 gaqhf
                Attribute attribute = new Attribute()
404 60244a8b gaqhf
                {
405
                    UID = item.Attribute("UID").Value,
406
                    LENGTH = item.Attribute("Length").Value,
407
                    EXPRESSION = item.Attribute("Expression").Value,
408
                    DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value,
409
                    ATTRIBUTETYPE = item.Attribute("AttributeType").Value,
410
                    ATTRIBUTE = item.Attribute("Attribute").Value,
411 30d2cfcc gaqhf
                    ATTRAT = item.Attribute("AttrAt").Value,
412 73415441 gaqhf
                    ASSOCITEM = item.Attribute("AssocItem").Value,
413 60244a8b gaqhf
                    VALUE = item.Value
414 73415441 gaqhf
                };
415
416
                attributes.Add(attribute);
417
418
                if (!string.IsNullOrEmpty(attribute.ASSOCITEM) && attribute.ASSOCITEM != "None")
419
                {
420
                    Text text = _TEXTINFOS.Find(x => x.UID == attribute.ASSOCITEM);
421
                    if (text != null)
422
                        text.ASSOCIATION = true;
423
                }
424 60244a8b gaqhf
            }
425
        }
426
427 53c81765 gaqhf
        private void SetSpecBreakAttribute(SpecBreak specBreak)
428
        {
429
            string upStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "UpStream").VALUE;
430
            string downStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "DownStream").VALUE;
431
432
            specBreak.UpStreamUID = upStream;
433
            specBreak.DownStreamUID = downStream;
434
        }
435
436 8aa6f2db gaqhf
        private void SetLineNumberRuns(XElement node, List<LineRun> lineNumberRuns)
437 60244a8b gaqhf
        {
438
            foreach (XElement item in node.Elements("RUN"))
439
            {
440 8aa6f2db gaqhf
                LineRun run = new LineRun()
441 60244a8b gaqhf
                {
442
                    TYPE = item.Attribute("TYPE").Value
443
                };
444
445
                foreach (XElement element in item.Elements())
446
                {
447
                    if (element.Name == "SYMBOL")
448
                    {
449 c3d2e266 gaqhf
                        Symbol symbol = GetSymbolByUID(element.Element("UID").Value);
450
                        if (symbol == null)
451
                            throw new Exception(element.Element("UID").Value);
452
                        run.RUNITEMS.Add(symbol);
453 60244a8b gaqhf
                    }
454
                    else if (element.Name == "LINE")
455
                    {
456 c3d2e266 gaqhf
                        Line line = GetLineByUID(element.Element("UID").Value);
457
                        if (line == null)
458
                            throw new Exception(element.Element("UID").Value);
459
                        run.RUNITEMS.Add(line);
460 60244a8b gaqhf
                    }
461
                }
462
                lineNumberRuns.Add(run);
463
            }
464
        }
465 30d2cfcc gaqhf
466
        private void SetChildSymbol(Symbol symbol)
467
        {
468
            List<ChildSymbol> childList = new List<ChildSymbol>();
469
            if (!string.IsNullOrEmpty(symbol.CHILD) && symbol.CHILD != "None")
470
            {
471
                string[] childArray = symbol.CHILD.Split(new char[] { '/' });
472
                foreach (string sChild in childArray)
473
                {
474
                    string[] sChildInfo = sChild.Split(new char[] { ',' });
475
                    childList.Add(new ChildSymbol()
476
                    {
477
                        ParentAt = Convert.ToInt32(sChildInfo[0]),
478
                        Direction = sChildInfo[1],
479
                        NAME = sChildInfo[2]
480
                    });
481
                }
482
483
                foreach (ChildSymbol child in childList)
484
                {
485
                    if (child.ParentAt == 0)
486
                        symbol.ChildSymbols.Add(child);
487
                    else
488
                        childList[child.ParentAt - 1].ChildSymbols.Add(child);
489
                }
490
            }
491
            if (!string.IsNullOrEmpty(symbol.CONNECTIONPOINT) && symbol.CONNECTIONPOINT != "None")
492
            {
493 f1c9dbaa gaqhf
                // 현재 부모 Symbol에 자식 Connector까지 들어가 있음
494 30d2cfcc gaqhf
                string[] connectionArray = symbol.CONNECTIONPOINT.Split(new char[] { '/' });
495
                string[] array = symbol.CONNECTIONPOINT.Split(new char[] { '/' });
496
                for (int i = 0; i < array.Length; i++)
497
                {
498
                    string[] arrConn = array[i].Split(new char[] { ',' });
499
                    int connIndex = Convert.ToInt32(arrConn[3]);
500
                    if (connIndex != 0)
501 5dfb8a24 gaqhf
                    {
502 30d2cfcc gaqhf
                        childList[connIndex - 1].Connectors.Add(symbol.CONNECTORS[i]);
503 f1c9dbaa gaqhf
                        symbol.CONNECTORS[i].Index = connIndex;
504 5dfb8a24 gaqhf
                    }
505
                }
506 30d2cfcc gaqhf
            }
507
        }
508 60244a8b gaqhf
        #endregion
509
510
        public Symbol GetSymbolByUID(string uid)
511
        {
512
            return SYMBOLS.Find(x => x.UID == uid);
513
        }
514
515
        public Line GetLineByUID(string uid)
516
        {
517
            return LINES.Find(x => x.UID == uid);
518
        }
519 96a2080c gaqhf
    }
520
}
클립보드 이미지 추가 (최대 크기: 500 MB)