프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / BaseModel / Document.cs @ 91b703af

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

1
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
using Converter.SPPID.Util;
10
using System.Data;
11

    
12
namespace Converter.BaseModel
13
{
14
    public class Document
15
    {
16
        public List<Line> VentDrainLine = new List<Line>();
17
        public List<Symbol> VentDrainSymbol = new List<Symbol>();
18

    
19
        private string _DWGNAME;
20
        private string _SIZE;
21
        private double _SIZE_WIDTH;
22
        private double _SIZE_HEIGHT;
23
        private string _UID;
24
        private List<Symbol> _SYMBOLS = new List<Symbol>();
25
        private List<Text> _TEXTINFOS = new List<Text>();
26
        private List<Note> _NOTES = new List<Note>();
27
        private List<Line> _LINES = new List<Line>();
28
        private List<LineNumber> _LINENUMBERS = new List<LineNumber>();
29
        private List<TrimLine> _TRIMLINES = new List<TrimLine>();
30
        private List<EndBreak> _EndBreaks = new List<EndBreak>();
31
        private List<SpecBreak> _SpecBreaks = new List<SpecBreak>();
32
        private List<Equipment> _Equipments = new List<Equipment>();
33
        private List<VendorPackage> _VendorPackages = new List<VendorPackage>();
34
        private bool _Enable;
35
        private bool _Validation;
36
        private bool _MappingValidation;
37
        private string _ValidationMessage = string.Empty;
38
        bool validationResult = false;
39
        private DataTable ID2SymbolTypeDT;
40

    
41
        public string ValidationMessage { get => _ValidationMessage; set => _ValidationMessage = value; }
42

    
43
        public List<Symbol> SYMBOLS { get => _SYMBOLS; set => _SYMBOLS = value; }
44
        public List<Text> TEXTINFOS { get => _TEXTINFOS; set => _TEXTINFOS = value; }
45
        public List<Note> NOTES { get => _NOTES; set => _NOTES = value; }
46
        public List<Line> LINES { get => _LINES; set => _LINES = value; }
47
        public List<LineNumber> LINENUMBERS { get => _LINENUMBERS; set => _LINENUMBERS = value; }
48
        public List<EndBreak> EndBreaks { get => _EndBreaks; set => _EndBreaks = value; }
49
        public List<SpecBreak> SpecBreaks { get => _SpecBreaks; set => _SpecBreaks = value; }
50
        public List<Equipment> Equipments { get => _Equipments; set => _Equipments = value; }
51
        public List<VendorPackage> VendorPackages { get => _VendorPackages; set => _VendorPackages = value; }
52
        public string DWGNAME { get => _DWGNAME; set => _DWGNAME = value; }
53
        public string SIZE
54
        {
55
            get
56
            {
57
                return _SIZE;
58
            }
59
            set
60
            {
61
                _SIZE = value;
62
                string[] pointArr = _SIZE.Split(new char[] { ',' });
63
                if (pointArr.Length == 2)
64
                {
65
                    _SIZE_WIDTH = Convert.ToDouble(pointArr[0]);
66
                    _SIZE_HEIGHT = Convert.ToDouble(pointArr[1]);
67
                }
68
            }
69
        }
70
        public double SIZE_WIDTH { get => _SIZE_WIDTH; }
71
        public double SIZE_HEIGHT { get => _SIZE_HEIGHT; }
72
        public List<TrimLine> TRIMLINES { get => _TRIMLINES; set => _TRIMLINES = value; }
73
        public string PATH { get; set; }
74
        public bool Enable { get => _Enable; set => _Enable = value; }
75
        public bool Validation { get => _Validation; set => _Validation = value; }
76
        public bool MappingValidation { get => _MappingValidation; set => _MappingValidation = value; }
77
        public string UID { get => _UID; set => _UID = value; }
78

    
79
        StringBuilder validationStringBuilder = new StringBuilder();
80

    
81
        public Document(string xmlPath, DataTable ID2SymbolTypeDT)
82
        {
83
            this.ID2SymbolTypeDT = ID2SymbolTypeDT;
84
            validationStringBuilder.AppendLine("Document Path : " + xmlPath);
85
            validationStringBuilder.AppendLine("");
86
            try
87
            {
88
                if (xmlPath != null)
89
                {
90
                    PATH = xmlPath;
91
                    XElement xml = XElement.Load(xmlPath);
92
                    DWGNAME = xml.Element("DWGNAME").Value;
93
                    SIZE = xml.Element("SIZE").Value;
94

    
95
                    validationStringBuilder.AppendLine("Drawing Name : " + DWGNAME);
96
                    validationStringBuilder.AppendLine("");
97

    
98
                    SetText(xml.Element("TEXTINFOS"));
99
                    SetNote(xml.Element("NOTES"));
100
                    SetSymbol(xml.Element("SYMBOLS"));
101
                    SetLine(xml.Element("LINEINFOS"));
102
                    SetLineNumber(xml.Element("LINENOS"));
103
                    SetTrimLine(xml.Element("TRIMLINENOS"));
104
                    SetVendorPackage(xml.Element("VENDORS"));
105

    
106
                    SetAllConnectors();
107
                    Enable = true;
108
                    ValidationCheck();
109
                    SetVentDrainItem();
110
                }
111
            }
112
            catch (Exception ex)
113
            {
114
                Enable = false;
115
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
116
            }
117
        }
118

    
119
        #region READ XML
120
        private void SetSymbol(XElement node)
121
        {
122
            foreach (XElement item in node.Elements("SYMBOL"))
123
            {
124
                string sType = item.Element("TYPE").Value;
125

    
126
                DataRow[] rows = ID2SymbolTypeDT.Select(string.Format("Type = '{0}'", sType.Replace("'", "''")));
127
                string sCategory = rows[0]["Category"].ToString();
128

    
129
                if (sType == "Segment Breaks")
130
                {
131
                    SpecBreak specBreak = new SpecBreak()
132
                    {
133
                        UID = item.Element("UID").Value,
134
                        DBUID = item.Element("DBUID").Value,
135
                        NAME = item.Element("NAME").Value,
136
                        TYPE = item.Element("TYPE").Value,
137
                        OWNER = item.Element("OWNER").Value,
138
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
139
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
140
                        LOCATION = item.Element("LOCATION").Value,
141
                        SIZE = item.Element("SIZE").Value,
142
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
143
                        PARENT = item.Element("PARENT").Value,
144
                        CHILD = item.Element("CHILD").Value,
145
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
146
                        AREA = item.Element("AREA").Value,
147
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
148
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
149
                    };
150
                    SetAssociations(item.Element("ASSOCIATIONS"), specBreak.ASSOCIATIONS);
151
                    SetSymbolConnectors(item.Element("CONNECTORS"), specBreak.CONNECTORS, specBreak.CONNECTIONPOINT);
152
                    SetProperties(item.Element("PROPERTIES"), specBreak.PROPERTIES);
153
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), specBreak.ATTRIBUTES);
154
                    SetSpecBreakAttribute(specBreak);
155

    
156
                    SpecBreaks.Add(specBreak);
157
                }
158
                else if (sType == "End Break")
159
                {
160
                    EndBreak endBreak = new EndBreak()
161
                    {
162
                        UID = item.Element("UID").Value,
163
                        DBUID = item.Element("DBUID").Value,
164
                        NAME = item.Element("NAME").Value,
165
                        TYPE = item.Element("TYPE").Value,
166
                        OWNER = item.Element("OWNER").Value,
167
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
168
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
169
                        LOCATION = item.Element("LOCATION").Value,
170
                        SIZE = item.Element("SIZE").Value,
171
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
172
                        PARENT = item.Element("PARENT").Value,
173
                        CHILD = item.Element("CHILD").Value,
174
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
175
                        AREA = item.Element("AREA").Value,
176
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
177
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
178
                    };
179
                    SetAssociations(item.Element("ASSOCIATIONS"), endBreak.ASSOCIATIONS);
180
                    SetSymbolConnectors(item.Element("CONNECTORS"), endBreak.CONNECTORS, endBreak.CONNECTIONPOINT);
181
                    SetProperties(item.Element("PROPERTIES"), endBreak.PROPERTIES);
182
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), endBreak.ATTRIBUTES);
183

    
184
                    EndBreaks.Add(endBreak);
185
                }
186
                else if (sCategory == "Equipment" ||
187
                    sCategory == "Equipment Components")
188
                {
189
                    Equipment equipment = new Equipment()
190
                    {
191
                        UID = item.Element("UID").Value,
192
                        DBUID = item.Element("DBUID").Value,
193
                        NAME = item.Element("NAME").Value,
194
                        TYPE = item.Element("TYPE").Value,
195
                        OWNER = item.Element("OWNER").Value,
196
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
197
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
198
                        LOCATION = item.Element("LOCATION").Value,
199
                        SIZE = item.Element("SIZE").Value,
200
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
201
                        PARENT = item.Element("PARENT").Value,
202
                        CHILD = item.Element("CHILD").Value,
203
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
204
                        AREA = item.Element("AREA").Value,
205
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
206
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
207
                    };
208
                    SetAssociations(item.Element("ASSOCIATIONS"), equipment.ASSOCIATIONS);
209
                    SetSymbolConnectors(item.Element("CONNECTORS"), equipment.CONNECTORS, equipment.CONNECTIONPOINT);
210
                    SetProperties(item.Element("PROPERTIES"), equipment.PROPERTIES);
211
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), equipment.ATTRIBUTES);
212

    
213
                    Equipments.Add(equipment);
214
                }
215
                else
216
                {
217
                    Symbol symbol = new Symbol()
218
                    {
219
                        UID = item.Element("UID").Value,
220
                        DBUID = item.Element("DBUID").Value,
221
                        NAME = item.Element("NAME").Value,
222
                        TYPE = item.Element("TYPE").Value,
223
                        OWNER = item.Element("OWNER").Value,
224
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
225
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
226
                        LOCATION = item.Element("LOCATION").Value,
227
                        SIZE = item.Element("SIZE").Value,
228
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
229
                        PARENT = item.Element("PARENT").Value,
230
                        CHILD = item.Element("CHILD").Value,
231
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
232
                        AREA = item.Element("AREA").Value,
233
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
234
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
235
                    };
236

    
237
                    SetAssociations(item.Element("ASSOCIATIONS"), symbol.ASSOCIATIONS);
238
                    SetSymbolConnectors(item.Element("CONNECTORS"), symbol.CONNECTORS, symbol.CONNECTIONPOINT);
239
                    SetProperties(item.Element("PROPERTIES"), symbol.PROPERTIES);
240
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), symbol.ATTRIBUTES);
241
                    SetChildSymbol(symbol);
242

    
243
                    SYMBOLS.Add(symbol);
244
                }
245
            }
246
        }
247

    
248
        private void SetLine(XElement node)
249
        {
250
            foreach (XElement item in node.Elements("LINE"))
251
            {
252
                Line line = new Line()
253
                {
254
                    OWNER = item.Attribute("OWNER").Value,
255
                    UID = item.Element("UID").Value,
256
                    STARTPOINT = item.Element("STARTPOINT").Value,
257
                    ENDPOINT = item.Element("ENDPOINT").Value,
258
                    TYPE = item.Element("TYPE").Value,
259
                    TYPEUID = item.Element("TYPE").Attribute("TYPEUID").Value,
260
                    AREA = item.Element("AREA").Value,
261
                    THICKNESS = item.Element("THICKNESS").Value,
262
                };
263
                int flowMarkPercent = 0;
264
                if (int.TryParse(item.Element("FLOWMARK").Value, out flowMarkPercent))
265
                {
266
                    line.FLOWMARK = true;
267
                    line.FLOWMARK_PERCENT = flowMarkPercent;
268
                }
269
                else
270
                    line.FLOWMARK = false;
271

    
272
                SetAssociations(item.Element("ASSOCIATIONS"), line.ASSOCIATIONS);
273
                SetConnectors(item.Element("CONNECTORS"), line.CONNECTORS);
274
                SetAttributes(item.Element("SYMBOLATTRIBUTES"), line.ATTRIBUTES);
275
                LINES.Add(line);
276
            }
277
        }
278

    
279
        private void SetLineNumber(XElement node)
280
        {
281
            foreach (XElement item in node.Elements("LINE_NO"))
282
            {
283
                LineNumber lineNumber = new LineNumber()
284
                {
285
                    UID = item.Element("UID").Value,
286
                    TEXT = item.Element("TEXT").Value,
287
                    LOCATION = item.Element("LOCATION").Value,
288
                    WIDTH = item.Element("WIDTH").Value,
289
                    HEIGHT = item.Element("HEIGHT").Value,
290
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
291
                    AREA = item.Element("AREA").Value,
292
                    SCENE = item.Element("SCENE").Value
293
                };
294
                if (item.Element("CONNLINE") != null)
295
                    lineNumber.CONNLINE = item.Element("CONNLINE").Value;
296
                else
297
                {
298
                    validationStringBuilder.AppendLine("Not exist CONNLINE!" + "\r\nLineNumber UID : " + lineNumber.UID);
299
                    validationStringBuilder.AppendLine();
300
                    validationResult = true;
301
                }
302

    
303
                SetLineNumberRuns(item, lineNumber.RUNS);
304
                SetProperties(item.Element("PROPERTIES"), lineNumber.PROPERTIES);
305
                SetAttributes(item, lineNumber.ATTRIBUTES);
306
                LINENUMBERS.Add(lineNumber);
307
            }
308
        }
309

    
310
        private void SetText(XElement node)
311
        {
312
            foreach (XElement item in node.Elements("ATTRIBUTE"))
313
            {
314
                Text text = new Text()
315
                {
316
                    UID = item.Element("UID").Value,
317
                    OWNER = item.Element("OWNER").Value,
318
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
319
                    NAME = item.Element("NAME").Value,
320
                    LOCATION = item.Element("LOCATION").Value,
321
                    VALUE = item.Element("VALUE").Value,
322
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
323
                    WIDTH = item.Element("WIDTH").Value,
324
                    HEIGHT = item.Element("HEIGHT").Value,
325
                    AREA = item.Element("AREA").Value,
326
                    SCENE = item.Element("SCENE").Value
327
                };
328

    
329
                TEXTINFOS.Add(text);
330
            }
331
        }
332

    
333
        private void SetNote(XElement node)
334
        {
335
            foreach (XElement item in node.Elements("ATTRIBUTE"))
336
            {
337
                Note note = new Note()
338
                {
339
                    UID = item.Element("UID").Value,
340
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
341
                    NAME = item.Element("NAME").Value,
342
                    LOCATION = item.Element("LOCATION").Value,
343
                    VALUE = item.Element("VALUE").Value,
344
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
345
                    WIDTH = item.Element("WIDTH").Value,
346
                    HEIGHT = item.Element("HEIGHT").Value,
347
                    AREA = item.Element("AREA").Value,
348
                    SCENE = item.Element("SCENE").Value,
349
                    OWNER = item.Element("OWNER").Value
350
                };
351

    
352
                NOTES.Add(note);
353
            }
354
        }
355

    
356
        private void SetTrimLine(XElement node)
357
        {
358
            foreach (XElement item in node.Elements("TRIM_LINE_NO"))
359
            {
360
                TrimLine trimLine = new TrimLine()
361
                {
362
                    UID = item.Element("UID").Value,
363
                };
364
                SetLineNumberRuns(item, trimLine.RUNS);
365
                TRIMLINES.Add(trimLine);
366
            }
367
        }
368

    
369
        private void SetVendorPackage(XElement node)
370
        {
371
            foreach (XElement item in node.Elements("VENDOR"))
372
            {
373
                VendorPackage vendorPackage = new VendorPackage()
374
                {
375
                    UID = item.Element("UID").Value,
376
                    AREA = item.Element("AREA").Value,
377
                    POINT = item.Element("POINT").Value
378
                };
379
                _VendorPackages.Add(vendorPackage);
380
            }
381
        }
382

    
383
        private void SetAssociations(XElement node, List<Association> associations)
384
        {
385
            foreach (XElement item in node.Elements("ASSOCIATION"))
386
            {
387
                Association association = new Association()
388
                {
389
                    TYPE = item.Attribute("TYPE").Value,
390
                    VALUE = item.Value
391
                };
392

    
393
                associations.Add(association);
394
            }
395
        }
396

    
397
        private void SetConnectors(XElement node, List<Connector> connectors)
398
        {
399
            foreach (XElement item in node.Elements("CONNECTOR"))
400
            {
401
                connectors.Add(new Connector()
402
                {
403
                    UID = item.Attribute("UID").Value,
404
                    CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value),
405
                    CONNECTEDITEM = item.Element("CONNECTEDITEM").Value,
406
                    CONNECTPOINT = item.Element("CONNECTPOINT").Value,
407
                    SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value,
408
                });
409
            }
410
        }
411

    
412
        private void SetSymbolConnectors(XElement node, List<Connector> connectors, string CONNECTIONPOINT)
413
        {
414
            foreach (XElement item in node.Elements("CONNECTOR"))
415
            {
416
                connectors.Add(new Connector()
417
                {
418
                    UID = item.Attribute("UID").Value,
419
                    CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value),
420
                    CONNECTEDITEM = item.Element("CONNECTEDITEM").Value,
421
                    CONNECTPOINT = item.Element("CONNECTPOINT").Value,
422
                    SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value,
423
                });
424
            }
425
        }
426

    
427
        private void SetProperties(XElement node, List<Property> properties)
428
        {
429
            foreach (XElement item in node.Elements("PROPERTY"))
430
            {
431
                properties.Add(new Property()
432
                {
433
                    UID = item.Attribute("UID").Value,
434
                    LENGTH = item.Attribute("Length").Value,
435
                    EXPRESSION = item.Attribute("Expression").Value,
436
                    DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value,
437
                    ATTRIBUTETYPE = item.Attribute("AttributeType").Value,
438
                    ATTRIBUTE = item.Attribute("Attribute").Value,
439
                    VALUE = item.Value
440
                });
441
            }
442
        }
443

    
444
        private void SetAttributes(XElement node, List<Attribute> attributes)
445
        {
446
            foreach (XElement item in node.Elements("ATTRIBUTE"))
447
            {
448
                Attribute attribute = new Attribute()
449
                {
450
                    UID = item.Attribute("UID").Value,
451
                    LENGTH = item.Attribute("Length").Value,
452
                    EXPRESSION = item.Attribute("Expression").Value,
453
                    DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value,
454
                    ATTRIBUTETYPE = item.Attribute("AttributeType").Value,
455
                    ATTRIBUTE = item.Attribute("Attribute").Value,
456
                    ATTRAT = item.Attribute("AttrAt").Value,
457
                    ASSOCITEM = item.Attribute("AssocItem").Value,
458
                    VALUE = item.Value
459
                };
460

    
461
                attributes.Add(attribute);
462

    
463
                if (!string.IsNullOrEmpty(attribute.ASSOCITEM) && attribute.ASSOCITEM != "None")
464
                {
465
                    Text text = _TEXTINFOS.Find(x => x.UID == attribute.ASSOCITEM);
466
                    if (text != null)
467
                        text.ASSOCIATION = true;
468
                }
469
            }
470
        }
471

    
472
        private void SetSpecBreakAttribute(SpecBreak specBreak)
473
        {
474
            string upStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "UpStream").VALUE;
475
            string downStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "DownStream").VALUE;
476

    
477
            specBreak.UpStreamUID = upStream;
478
            specBreak.DownStreamUID = downStream;
479
        }
480

    
481
        private void SetLineNumberRuns(XElement node, List<LineRun> lineNumberRuns)
482
        {
483
            foreach (XElement item in node.Elements("RUN"))
484
            {
485
                LineRun run = new LineRun()
486
                {
487
                    TYPE = item.Attribute("TYPE").Value
488
                };
489

    
490
                foreach (XElement element in item.Elements())
491
                {
492
                    if (element.Name == "SYMBOL")
493
                    {
494
                        Symbol symbol = GetSymbolByUID(element.Element("UID").Value);
495
                        Equipment equipment = GetEquipmentByUID(element.Element("UID").Value);
496
                        if (symbol == null && equipment == null)
497
                        {
498
                            validationStringBuilder.AppendLine("Missing Item!" + "\r\nUID : " + element.Element("UID").Value);
499
                            validationStringBuilder.AppendLine();
500
                            validationResult = true;
501
                        }
502
                        if (symbol != null)
503
                            run.RUNITEMS.Add(symbol);
504
                        else if (equipment != null)
505
                            run.RUNITEMS.Add(equipment);
506
                    }
507
                    else if (element.Name == "LINE")
508
                    {
509
                        Line line = GetLineByUID(element.Element("UID").Value);
510
                        if (line == null)
511
                        {
512
                            validationStringBuilder.AppendLine("Missing Item!" + "\r\nUID : " + element.Element("UID").Value);
513
                            validationStringBuilder.AppendLine();
514
                            validationResult = true;
515
                        }
516
                        run.RUNITEMS.Add(line);
517
                    }
518
                }
519
                lineNumberRuns.Add(run);
520
            }
521
        }
522

    
523
        private void SetChildSymbol(Symbol symbol)
524
        {
525
            List<ChildSymbol> childList = new List<ChildSymbol>();
526
            if (!string.IsNullOrEmpty(symbol.CHILD) && symbol.CHILD != "None")
527
            {
528
                string[] childArray = symbol.CHILD.Split(new char[] { '/' });
529
                foreach (string sChild in childArray)
530
                {
531
                    string[] sChildInfo = sChild.Split(new char[] { ',' });
532
                    childList.Add(new ChildSymbol()
533
                    {
534
                        ParentAt = Convert.ToInt32(sChildInfo[0]),
535
                        Direction = sChildInfo[1],
536
                        NAME = sChildInfo[2]
537
                    });
538
                }
539

    
540
                foreach (ChildSymbol child in childList)
541
                {
542
                    if (child.ParentAt == 0)
543
                        symbol.ChildSymbols.Add(child);
544
                    else
545
                        childList[child.ParentAt - 1].ChildSymbols.Add(child);
546
                }
547
            }
548
            if (!string.IsNullOrEmpty(symbol.CONNECTIONPOINT) && symbol.CONNECTIONPOINT != "None")
549
            {
550
                // 현재 부모 Symbol에 자식 Connector까지 들어가 있음
551
                string[] connectionArray = symbol.CONNECTIONPOINT.Split(new char[] { '/' });
552
                string[] array = symbol.CONNECTIONPOINT.Split(new char[] { '/' });
553
                for (int i = 0; i < array.Length; i++)
554
                {
555
                    string[] arrConn = array[i].Split(new char[] { ',' });
556
                    int connIndex = Convert.ToInt32(arrConn[3]);
557
                    if (connIndex != 0)
558
                    {
559
                        childList[connIndex - 1].Connectors.Add(symbol.CONNECTORS[i]);
560
                        symbol.CONNECTORS[i].Index = connIndex;
561
                    }
562
                }
563
            }
564
        }
565
        #endregion
566

    
567
        public Symbol GetSymbolByUID(string uid)
568
        {
569
            return SYMBOLS.Find(x => x.UID == uid);
570
        }
571

    
572
        public Equipment GetEquipmentByUID(string uid)
573
        {
574
            return Equipments.Find(x => x.UID == uid);
575
        }
576

    
577
        public Line GetLineByUID(string uid)
578
        {
579
            return LINES.Find(x => x.UID == uid);
580
        }
581

    
582
        public void SetAllConnectors()
583
        {
584
            foreach (var item in SYMBOLS)
585
                foreach (var connector in item.CONNECTORS)
586
                    connector.ConnectedObject = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
587

    
588
            foreach (var item in LINES)
589
                foreach (var connector in item.CONNECTORS)
590
                    connector.ConnectedObject = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
591

    
592
            foreach (var item in Equipments)
593
                foreach (var connector in item.CONNECTORS)
594
                    connector.ConnectedObject = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
595
        }
596

    
597
        public void ValidationCheck()
598
        {
599
           
600
            #region Connection Check / Symbol의 SceneConnectPoint Check
601
            foreach (var item in _SYMBOLS)
602
            {
603
                foreach (var connector in item.CONNECTORS)
604
                {
605
                    if (connector.ConnectedObject != null && connector.ConnectedObject.GetType() == typeof(Line))
606
                    {
607
                        Line line = connector.ConnectedObject as Line;
608
                        if (line.CONNECTORS.Find(x => x.ConnectedObject == item) == null)
609
                        {
610
                            validationStringBuilder.AppendLine("Check connection!");
611
                            validationStringBuilder.AppendLine("Symbol UID : " + item.UID);
612
                            validationStringBuilder.AppendLine("Line UID : " + line.UID);
613
                            validationStringBuilder.AppendLine();
614
                            validationResult = true;
615
                        }
616
                    }
617

    
618
                    if (connector.SCENECONNECTPOINT == connector.CONNECTPOINT)
619
                    {
620
                        validationStringBuilder.AppendLine("Check Symbol SceneConnectPoint!");
621
                        validationStringBuilder.AppendLine("Symbol UID : " + item.UID);
622
                        validationStringBuilder.AppendLine();
623
                        validationResult = true;
624
                    }
625
                }
626
            }
627

    
628
            foreach (var item in _LINES)
629
            {
630
                foreach (var connector in item.CONNECTORS)
631
                {
632
                    if (connector.ConnectedObject != null && connector.ConnectedObject.GetType() == typeof(Symbol))
633
                    {
634
                        Symbol symbol = connector.ConnectedObject as Symbol;
635
                        if (symbol.CONNECTORS.Find(x => x.ConnectedObject == item) == null)
636
                        {
637
                            validationStringBuilder.AppendLine("Check connection!");
638
                            validationStringBuilder.AppendLine("Symbol UID : " + symbol.UID);
639
                            validationStringBuilder.AppendLine("Line UID : " + item.UID);
640
                            validationStringBuilder.AppendLine();
641
                            validationResult = true;
642
                        }
643
                    }
644
                }
645
            }
646
            #endregion
647

    
648
            #region Symbol Size Check
649
            foreach (var item in _SYMBOLS)
650
            {
651
                if (item.SIZE == "0,0")
652
                {
653
                    validationStringBuilder.AppendLine("Check symbol size!");
654
                    validationStringBuilder.AppendLine("Symbol UID : " + item.UID);
655
                    validationStringBuilder.AppendLine();
656
                    validationResult = true;
657
                }
658
            }
659
            #endregion
660

    
661
            #region SpecBreak, EndBreak Check
662
            foreach (var item in SpecBreaks)
663
            {
664
                object obj1 = SPPIDUtil.FindObjectByUID(this, item.UpStreamUID);
665
                object obj2 = SPPIDUtil.FindObjectByUID(this, item.DownStreamUID);
666
                if (obj1 == null || obj2 == null)
667
                {
668
                    validationStringBuilder.AppendLine("Check SpecBreak UpStream, DownStream!");
669
                    validationStringBuilder.AppendLine("UID : " + item.UID);
670
                    validationStringBuilder.AppendLine();
671
                    validationResult = true;
672
                }
673
                else
674
                {
675

    
676
                    bool result = false;
677
                    if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Symbol))
678
                    {
679
                        Symbol symbol1 = obj1 as Symbol;
680
                        Symbol symbol2 = obj2 as Symbol;
681
                        if (symbol1.CONNECTORS.Find(x => x.ConnectedObject == symbol2) == null || symbol2.CONNECTORS.Find(x => x.ConnectedObject == symbol1) == null)
682
                            result = true;
683
                    }
684
                    else if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Line))
685
                    {
686
                        Symbol symbol = obj1 as Symbol;
687
                        Line line = obj2 as Line;
688
                        if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null)
689
                            result = true;
690
                    }
691
                    else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Symbol))
692
                    {
693
                        Symbol symbol = obj2 as Symbol;
694
                        Line line = obj1 as Line;
695
                        if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null)
696
                            result = true;
697
                    }
698
                    else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line))
699
                    {
700
                        Line line1 = obj2 as Line;
701
                        Line line2 = obj1 as Line;
702
                        Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2);
703
                        Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1);
704
                        if (connector1 == null && connector2 == null)
705
                            result = true;
706
                    }
707

    
708
                    if (result)
709
                    {
710
                        validationStringBuilder.AppendLine("Check SpecBreak UpStream, DownStream!");
711
                        validationStringBuilder.AppendLine("UID : " + item.UID);
712
                        validationStringBuilder.AppendLine();
713
                        validationResult = true;
714
                    }
715

    
716
                    // Rule
717
                    if (!result)
718
                    {
719
                        if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line))
720
                        {
721
                            Line line1 = obj1 as Line;
722
                            Line line2 = obj2 as Line;
723

    
724
                            Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2);
725
                            Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1);
726

    
727
                            if (connector1 != null && connector2 != null)
728
                            {
729
                                int connectorIndex = line1.CONNECTORS.IndexOf(connector1);
730
                                if (connectorIndex != 0 && !SPPIDUtil.IsBranchLine(line1))
731
                                    result = true;
732
                                else if (connectorIndex != 0 && SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2))
733
                                    result = true;
734
                                else if (connectorIndex == 0 && !SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2))
735
                                    result = true;
736
                            }
737
                            else if (SPPIDUtil.IsBranchLine(line1, line2))
738
                            {
739
                                if (connector1 == null)
740
                                    result = true;
741
                            }
742

    
743
                            if (result)
744
                            {
745
                                validationStringBuilder.AppendLine("Check Segment Rule!");
746
                                validationStringBuilder.AppendLine("UID : " + item.UID);
747
                                validationStringBuilder.AppendLine();
748
                                validationResult = true;
749
                            }
750
                        }
751
                    }
752
                }
753
            }
754

    
755
            foreach (var item in EndBreaks)
756
            {
757
                object obj1 = SPPIDUtil.FindObjectByUID(this, item.OWNER);
758
                object obj2 = SPPIDUtil.FindObjectByUID(this, item.PROPERTIES.Find(x => x.ATTRIBUTE == "Connected Item").VALUE);
759
                if (obj1 == null || obj2 == null)
760
                {
761
                    validationStringBuilder.AppendLine("Check EndBreak Owner, Connected Item!");
762
                    validationStringBuilder.AppendLine("UID : " + item.UID);
763
                    validationStringBuilder.AppendLine();
764
                    validationResult = true;
765
                }
766
                else
767
                {
768
                    bool result = false;
769
                    if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Symbol))
770
                    {
771
                        Symbol symbol1 = obj1 as Symbol;
772
                        Symbol symbol2 = obj2 as Symbol;
773
                        if (symbol1.CONNECTORS.Find(x => x.ConnectedObject == symbol2) == null || symbol2.CONNECTORS.Find(x => x.ConnectedObject == symbol1) == null)
774
                            result = true;
775
                    }
776
                    else if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Line))
777
                    {
778
                        Symbol symbol = obj1 as Symbol;
779
                        Line line = obj2 as Line;
780
                        if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null)
781
                            result = true;
782
                    }
783
                    else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Symbol))
784
                    {
785
                        Symbol symbol = obj2 as Symbol;
786
                        Line line = obj1 as Line;
787
                        if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null)
788
                            result = true;
789
                    }
790
                    else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line))
791
                    {
792
                        Line line1 = obj2 as Line;
793
                        Line line2 = obj1 as Line;
794
                        Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2);
795
                        Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1);
796
                        if (connector1 == null && connector2 == null)
797
                            result = true;
798
                    }
799

    
800
                    if (result)
801
                    {
802
                        validationStringBuilder.AppendLine("Check EndBreak Owner, Connected Item!");
803
                        validationStringBuilder.AppendLine("UID : " + item.UID);
804
                        validationStringBuilder.AppendLine();
805
                        validationResult = true;
806
                    }
807

    
808
                    // Rule
809
                    if (!result) 
810
                    {
811
                        if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line))
812
                        {
813
                            Line line1 = obj1 as Line;
814
                            Line line2 = obj2 as Line;
815

    
816
                            Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2);
817
                            Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1);
818

    
819
                            if (connector1 != null && connector2 != null)
820
                            {
821
                                int connectorIndex = line1.CONNECTORS.IndexOf(connector1);
822
                                if (connectorIndex != 0 && !SPPIDUtil.IsBranchLine(line1))
823
                                    result = true;
824
                                else if (connectorIndex != 0 && SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2))
825
                                    result = true;
826
                                else if (connectorIndex == 0 && !SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2))
827
                                    result = true;
828
                            }
829
                            else if (SPPIDUtil.IsBranchLine(line1, line2))
830
                            {
831
                                if (connector1 == null)
832
                                    result = true;
833
                            }
834

    
835
                            if (result)
836
                            {
837
                                validationStringBuilder.AppendLine("Check Segment Rule!");
838
                                validationStringBuilder.AppendLine("UID : " + item.UID);
839
                                validationStringBuilder.AppendLine();
840
                                validationResult = true;
841
                            }
842
                        }
843
                    }
844
                }
845
            }
846

    
847
            #endregion
848

    
849
            #region Check Flow Direction
850
            List<string[]> flowDirectionCheck = new List<string[]>();
851
            foreach (var line in LINES)
852
            {
853
                foreach (var connector in line.CONNECTORS)
854
                {
855
                    if (connector.ConnectedObject != null &&
856
                        connector.ConnectedObject.GetType() == typeof(Line) &&
857
                        !SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line))
858
                    {
859
                        Line connLine = connector.ConnectedObject as Line;
860
                        int lineIndex1 = line.CONNECTORS.IndexOf(connector);
861
                        int lineIndex2 = connLine.CONNECTORS.IndexOf(connLine.CONNECTORS.Find(x => x.ConnectedObject == line));
862
                        if (lineIndex1 == lineIndex2 && flowDirectionCheck.Find(x => (x[0] == line.UID || x[1] == connLine.UID) || (x[1] == line.UID || x[0] == connLine.UID)) == null)
863
                        {
864
                            validationStringBuilder.AppendLine("Check line flow direction!");
865
                            validationStringBuilder.AppendLine("UID : " + line.UID);
866
                            validationStringBuilder.AppendLine("UID : " + connLine.UID);
867
                            validationStringBuilder.AppendLine();
868
                            validationResult = true;
869
                            flowDirectionCheck.Add(new string[] { line.UID, connLine.UID });
870
                        }
871
                    }
872
                }
873
            }
874

    
875
            foreach (var item in SYMBOLS.FindAll(x => x.CONNECTORS.Count == 2 &&
876
            x.CONNECTORS[0].ConnectedObject != null && x.CONNECTORS[0].ConnectedObject.GetType() == typeof(Line) &&
877
            x.CONNECTORS[1].ConnectedObject != null && x.CONNECTORS[1].ConnectedObject.GetType() == typeof(Line)))
878
            {
879
                Line line1 = item.CONNECTORS[0].ConnectedObject as Line;
880
                Line line2 = item.CONNECTORS[1].ConnectedObject as Line;
881
                if (line1.TYPE == line2.TYPE)
882
                {
883
                    int index1 = line1.CONNECTORS.IndexOf(line1.CONNECTORS.Find(x => x.ConnectedObject == item));
884
                    int index2 = line2.CONNECTORS.IndexOf(line2.CONNECTORS.Find(x => x.ConnectedObject == item));
885
                    if (index1 == index2)
886
                    {
887
                        validationStringBuilder.AppendLine("Check line flow direction!");
888
                        validationStringBuilder.AppendLine("UID : " + line1.UID);
889
                        validationStringBuilder.AppendLine("UID : " + line2.UID);
890
                        validationStringBuilder.AppendLine();
891
                        validationResult = true;
892
                    }
893
                }
894
            }
895
            #endregion
896

    
897
            #region Association Check
898
            foreach (var item in TEXTINFOS)
899
            {
900
                if (item.ASSOCIATION)
901
                {
902
                    object owner = SPPIDUtil.FindObjectByUID(this, item.OWNER);
903
                    if (owner == null)
904
                    {
905
                        validationStringBuilder.AppendLine("Check text owner!");
906
                        validationStringBuilder.AppendLine("Text UID : " + item.UID);
907
                        foreach (var associationItem in SYMBOLS.FindAll(x => x.ATTRIBUTES.Find(y => y.ASSOCITEM == item.UID) != null))
908
                            validationStringBuilder.AppendLine("Association UID : " + associationItem.UID);
909

    
910
                        validationStringBuilder.AppendLine();
911
                        validationResult = true;    
912
                    }
913
                }
914
            }
915
            #endregion
916

    
917
            #region Line To Line Type Check
918
            List<string[]> typeCheck = new List<string[]>();
919
            foreach (var item in LINES)
920
            {
921
                foreach (var connector in item.CONNECTORS)
922
                {
923
                    Line connLine = connector.ConnectedObject as Line;
924
                    if (connLine != null && connLine.CONNECTORS.Find(x => x.ConnectedObject == item) != null && 
925
                        connLine.TYPE != item.TYPE &&
926
                        typeCheck.Find(x => (x[0] == item.UID || x[1] == connLine.UID) || (x[1] == item.UID || x[0] == connLine.UID)) == null)
927
                    {
928
                        validationStringBuilder.AppendLine("Check line type!");
929
                        validationStringBuilder.AppendLine("UID : " + item.UID);
930
                        validationStringBuilder.AppendLine("UID : " + connLine.UID);
931
                        validationStringBuilder.AppendLine();
932
                        validationResult = true;
933
                        typeCheck.Add(new string[] { item.UID, connLine.UID });
934
                    }
935
                }
936
            }
937
            #endregion
938

    
939
            #region ConnenctionCheck
940
            List<string[]> connectionCheck = new List<string[]>();
941
            foreach (var item in _LINES)
942
            {
943
                List<string> connectedItem = new List<string>();
944
                foreach (var connector in item.CONNECTORS)
945
                {
946
                    if (connector.ConnectedObject != null)
947
                    {
948
                        Symbol connSymbol = connector.ConnectedObject as Symbol;
949
                        Line connLine = connector.ConnectedObject as Line;
950
                        string connUID = string.Empty;
951
                        bool result = false;
952
                        if (connSymbol != null && connSymbol.CONNECTORS.Find(x => x.ConnectedObject == item) == null)
953
                        {
954
                            result = true;
955
                            connUID = connSymbol.UID;
956
                        }
957
                        else if (connLine != null && connLine.CONNECTORS.Find(x => x.ConnectedObject == item) == null && !SPPIDUtil.IsBranchLine(connLine, item))
958
                        {
959
                            result = true;
960
                            connUID = connLine.UID;
961
                        }
962

    
963
                        if (result && connectionCheck.Find(x => (x[0] == item.UID || x[1] == connUID) || (x[1] == item.UID || x[0] == connUID)) == null)
964
                        {
965
                            validationStringBuilder.AppendLine("Check connection!");
966
                            validationStringBuilder.AppendLine("UID : " + item.UID);
967
                            validationStringBuilder.AppendLine("UID : " + connUID);
968
                            validationStringBuilder.AppendLine();
969
                            validationResult = true;
970
                            connectionCheck.Add(new string[] { item.UID, connUID });
971
                        }
972

    
973
                        if (!connectedItem.Contains(connector.CONNECTEDITEM))
974
                            connectedItem.Add(connector.CONNECTEDITEM);
975
                        else
976
                        {
977
                            validationStringBuilder.AppendLine("Check connection!");
978
                            validationStringBuilder.AppendLine("UID : " + item.UID);
979
                            validationStringBuilder.AppendLine();
980
                        }
981
                    }
982
                }
983

    
984
                if (item.CONNECTORS.Find(x => x.CONNECTEDITEM == item.UID) != null)
985
                {
986
                    validationStringBuilder.AppendLine("Check connection!");
987
                    validationStringBuilder.AppendLine("UID : " + item.UID);
988
                    validationStringBuilder.AppendLine();
989
                    validationResult = true;
990
                }
991
            }
992
            foreach (var item in _SYMBOLS)
993
            {
994
                List<string> connectedItem = new List<string>();
995
                foreach (var connector in item.CONNECTORS)
996
                {
997
                    if (connector.ConnectedObject != null)
998
                    {
999
                        Symbol connSymbol = connector.ConnectedObject as Symbol;
1000
                        Line connLine = connector.ConnectedObject as Line;
1001
                        string connUID = string.Empty;
1002
                        bool result = false;
1003
                        if (connSymbol != null && connSymbol.CONNECTORS.Find(x => x.ConnectedObject == item) == null)
1004
                        {
1005
                            result = true;
1006
                            connUID = connSymbol.UID;
1007
                        }
1008
                        else if (connLine != null && connLine.CONNECTORS.Find(x => x.ConnectedObject == item) == null)
1009
                        {
1010
                            result = true;
1011
                            connUID = connLine.UID;
1012
                        }
1013

    
1014
                        if (result && connectionCheck.Find(x => (x[0] == item.UID || x[1] == connUID) || (x[1] == item.UID || x[0] == connUID)) == null)
1015
                        {
1016
                            validationStringBuilder.AppendLine("Check connection!");
1017
                            validationStringBuilder.AppendLine("UID : " + item.UID);
1018
                            validationStringBuilder.AppendLine("UID : " + connUID);
1019
                            validationStringBuilder.AppendLine();
1020
                            validationResult = true;
1021
                            connectionCheck.Add(new string[] { item.UID, connUID });
1022
                        }
1023

    
1024
                        if (!connectedItem.Contains(connector.CONNECTEDITEM))
1025
                            connectedItem.Add(connector.CONNECTEDITEM);
1026
                        else
1027
                        {
1028
                            validationStringBuilder.AppendLine("Check connection!");
1029
                            validationStringBuilder.AppendLine("UID : " + item.UID);
1030
                            validationStringBuilder.AppendLine();
1031
                        }
1032
                    }
1033
                }
1034

    
1035
                if (item.CONNECTORS.Find(x => x.CONNECTEDITEM == item.UID) != null)
1036
                {
1037
                    validationStringBuilder.AppendLine("Check connection!");
1038
                    validationStringBuilder.AppendLine("UID : " + item.UID);
1039
                    validationStringBuilder.AppendLine();
1040
                    validationResult = true;
1041
                }
1042
            }
1043
            #endregion
1044

    
1045
            if (validationResult)
1046
            {
1047
                Validation = false;
1048
                Enable = false;
1049
                _ValidationMessage += validationStringBuilder.ToString();
1050
            }
1051
            else
1052
            {
1053
                Validation = true;
1054
                Enable = true;
1055
            }
1056
        }
1057

    
1058
        private void SetVentDrainItem()
1059
        {
1060
            foreach (var item in SYMBOLS)
1061
            {
1062
                if (item.TYPE == "Valves")
1063
                {
1064
                    List<Symbol> group = new List<Symbol>();
1065
                    SPPIDUtil.FindConnectedSymbolGroup(this, item, group);
1066
                    List<Line> lines = new List<Line>();
1067
                    foreach (var symbol in group)
1068
                    {
1069
                        foreach (var connector in symbol.CONNECTORS)
1070
                        {
1071
                            if (connector.ConnectedObject != null && connector.ConnectedObject.GetType() == typeof(Line))
1072
                            {
1073
                                Line line = connector.ConnectedObject as Line;
1074
                                if (!lines.Contains(line))
1075
                                    lines.Add(line);
1076

    
1077
                            }
1078
                        }
1079
                    }
1080

    
1081
                    if (lines.Count == 1 && !SPPIDUtil.IsBranchedLine(this, lines[0]) && SPPIDUtil.IsBranchLine(lines[0]))
1082
                    {
1083
                        Line line = lines[0];
1084
                        if (line.TYPE == "Secondary" || line.TYPE == "Primary")
1085
                        {
1086
                            double startX = 0;
1087
                            double startY = 0;
1088
                            double endX = 0;
1089
                            double endY = 0;
1090
                            SPPIDUtil.ConvertPointBystring(line.STARTPOINT, ref startX, ref startY);
1091
                            SPPIDUtil.ConvertPointBystring(line.ENDPOINT, ref endX, ref endY);
1092
                            SlopeType slopeType = SPPIDUtil.CalcSlope(startX, startY, endX, endY);
1093
                            if (slopeType == SlopeType.HORIZONTAL || slopeType == SlopeType.VERTICAL)
1094
                            {
1095
                                foreach (var symbol in group)
1096
                                {
1097
                                    if (!VentDrainSymbol.Contains(symbol))
1098
                                        VentDrainSymbol.Add(symbol);
1099
                                }
1100
                                if (!VentDrainLine.Contains(lines[0]))
1101
                                    VentDrainLine.Add(lines[0]);
1102
                            }
1103
                        }
1104
                    }
1105
                }
1106
            }
1107
        }
1108
    }
1109
}
클립보드 이미지 추가 (최대 크기: 500 MB)