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