프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / BaseModel / Document.cs @ 8214047e

이력 | 보기 | 이력해설 | 다운로드 (51.8 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
                TEXTINFOS.Add(text);
329
            }
330
        }
331

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

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

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

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

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

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

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

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

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

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

    
460
                attributes.Add(attribute);
461

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
846
            #endregion
847

    
848
            #region Check Flow Direction
849
            List<string[]> flowDirectionCheck = new List<string[]>();
850
            foreach (var line in LINES)
851
            {
852
                if (line.TYPE != "Secondary" && line.TYPE != "Primary")
853
                    continue;
854

    
855
                foreach (var connector in line.CONNECTORS)
856
                {
857
                    if (connector.ConnectedObject != null &&
858
                        connector.ConnectedObject.GetType() == typeof(Line) &&
859
                        !SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line))
860
                    {
861
                        Line connLine = connector.ConnectedObject as Line;
862
                        if (connLine.TYPE != "Secondary" && connLine.TYPE != "Primary")
863
                            continue;
864
                        int lineIndex1 = line.CONNECTORS.IndexOf(connector);
865
                        int lineIndex2 = connLine.CONNECTORS.IndexOf(connLine.CONNECTORS.Find(x => x.ConnectedObject == line));
866
                        if (lineIndex1 == lineIndex2 && flowDirectionCheck.Find(x => (x[0] == line.UID || x[1] == connLine.UID) || (x[1] == line.UID || x[0] == connLine.UID)) == null)
867
                        {
868
                            validationStringBuilder.AppendLine("Check line flow direction!");
869
                            validationStringBuilder.AppendLine("UID : " + line.UID);
870
                            validationStringBuilder.AppendLine("UID : " + connLine.UID);
871
                            validationStringBuilder.AppendLine();
872
                            validationResult = true;
873
                            flowDirectionCheck.Add(new string[] { line.UID, connLine.UID });
874
                        }
875
                    }
876
                }
877
            }
878

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

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

    
914
                        validationStringBuilder.AppendLine();
915
                        validationResult = true;    
916
                    }
917
                }
918
            }
919
            #endregion
920

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

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

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

    
977
                        if (!connectedItem.Contains(connector.CONNECTEDITEM))
978
                            connectedItem.Add(connector.CONNECTEDITEM);
979
                        else
980
                        {
981
                            validationStringBuilder.AppendLine("Check connection!");
982
                            validationStringBuilder.AppendLine("UID : " + item.UID);
983
                            validationStringBuilder.AppendLine();
984
                        }
985
                    }
986
                }
987

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

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

    
1028
                        if (!connectedItem.Contains(connector.CONNECTEDITEM))
1029
                            connectedItem.Add(connector.CONNECTEDITEM);
1030
                        else
1031
                        {
1032
                            validationStringBuilder.AppendLine("Check connection!");
1033
                            validationStringBuilder.AppendLine("UID : " + item.UID);
1034
                            validationStringBuilder.AppendLine();
1035
                        }
1036
                    }
1037
                }
1038

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

    
1049
            if (validationResult)
1050
            {
1051
                Validation = false;
1052
                Enable = false;
1053
                _ValidationMessage += validationStringBuilder.ToString();
1054
            }
1055
            else
1056
            {
1057
                Validation = true;
1058
                Enable = true;
1059
            }
1060
        }
1061

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

    
1081
                            }
1082
                        }
1083
                    }
1084

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