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