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