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