개정판 1ecaaba8
dev issue #1286 : attribute -> default text modeling 기능 완료
Change-Id: I92473f235658620ed36b67d0a0eba6dd81ae721b
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
871 | 871 |
} |
872 | 872 |
private void RunInputSymbolAttribute() |
873 | 873 |
{ |
874 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count); |
|
874 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count + document.Equipments.Count);
|
|
875 | 875 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute"); |
876 | 876 |
foreach (var item in document.SYMBOLS) |
877 | 877 |
try |
... | ... | |
886 | 886 |
Log.Write(ex.Message); |
887 | 887 |
Log.Write(ex.StackTrace); |
888 | 888 |
} |
889 |
|
|
890 |
foreach (var item in document.Equipments) |
|
891 |
try |
|
892 |
{ |
|
893 |
InputSymbolAttribute(item, item.ATTRIBUTES); |
|
894 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
895 |
} |
|
896 |
catch (Exception ex) |
|
897 |
{ |
|
898 |
Log.Write("Error in InputSymbolAttribute"); |
|
899 |
Log.Write("UID : " + item.UID); |
|
900 |
Log.Write(ex.Message); |
|
901 |
Log.Write(ex.StackTrace); |
|
902 |
} |
|
889 | 903 |
} |
890 | 904 |
private void RunInputSpecBreakAttribute() |
891 | 905 |
{ |
... | ... | |
4622 | 4636 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID); |
4623 | 4637 |
if (mapping != null && !string.IsNullOrEmpty(item.VALUE) && item.VALUE != "None") |
4624 | 4638 |
{ |
4625 |
LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
4626 |
if (_Attribute != null) |
|
4639 |
if (!mapping.IsText) |
|
4627 | 4640 |
{ |
4628 |
//object associItem = SPPIDUtil.FindObjectByUID(document, item.ASSOCITEM); |
|
4629 |
//if (associItem != null) |
|
4630 |
//{ |
|
4631 |
// if (associItem.GetType() == typeof(Text)) |
|
4632 |
// { |
|
4633 |
// Text text = associItem as Text; |
|
4634 |
// text.SPPID.RepresentationId = "Attribute"; |
|
4635 |
// } |
|
4636 |
// else if (associItem.GetType() == typeof(Note)) |
|
4637 |
// { |
|
4638 |
// Note note = associItem as Note; |
|
4639 |
// note.SPPID.RepresentationId = "Attribute"; |
|
4640 |
// } |
|
4641 |
//} |
|
4642 |
_Attribute.set_Value(item.VALUE); |
|
4643 |
// OPC 일경우 Attribute 저장 |
|
4644 |
if (targetItem.GetType() == typeof(Symbol)) |
|
4641 |
LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
4642 |
if (_Attribute != null) |
|
4645 | 4643 |
{ |
4646 |
Symbol symbol = targetItem as Symbol; |
|
4647 |
if (symbol.TYPE == "Piping OPC's" || symbol.TYPE == "Instrument OPC's") |
|
4648 |
symbol.SPPID.Attributes.Add(new string[] { mapping.SPPIDATTRIBUTENAME, item.VALUE }); |
|
4644 |
_Attribute.set_Value(item.VALUE); |
|
4645 |
// OPC 일경우 Attribute 저장 |
|
4646 |
if (targetItem.GetType() == typeof(Symbol)) |
|
4647 |
{ |
|
4648 |
Symbol symbol = targetItem as Symbol; |
|
4649 |
if (symbol.TYPE == "Piping OPC's" || symbol.TYPE == "Instrument OPC's") |
|
4650 |
symbol.SPPID.Attributes.Add(new string[] { mapping.SPPIDATTRIBUTENAME, item.VALUE }); |
|
4651 |
} |
|
4649 | 4652 |
} |
4650 | 4653 |
} |
4654 |
else |
|
4655 |
DefaultTextModeling(item.VALUE, _LMSymbol.get_XCoordinate(), _LMSymbol.get_YCoordinate()); |
|
4651 | 4656 |
} |
4652 | 4657 |
} |
4653 | 4658 |
_LMModelItem.Commit(); |
... | ... | |
5087 | 5092 |
ReleaseCOMObjects(_LMSymbol); |
5088 | 5093 |
} |
5089 | 5094 |
|
5095 |
private void DefaultTextModeling(string value, double x, double y) |
|
5096 |
{ |
|
5097 |
LMSymbol _LMSymbol = null; |
|
5098 |
|
|
5099 |
LMItemNote _LMItemNote = null; |
|
5100 |
LMAAttribute _LMAAttribute = null; |
|
5101 |
|
|
5102 |
_LMSymbol = _placement.PIDPlaceSymbol(_ETCSetting.TextSymbolPath, x, y, Rotation: 0); |
|
5103 |
if (_LMSymbol != null) |
|
5104 |
{ |
|
5105 |
_LMSymbol.Commit(); |
|
5106 |
_LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID); |
|
5107 |
if (_LMItemNote != null) |
|
5108 |
{ |
|
5109 |
_LMItemNote.Commit(); |
|
5110 |
_LMAAttribute = _LMItemNote.Attributes["Note.Body"]; |
|
5111 |
if (_LMAAttribute != null) |
|
5112 |
{ |
|
5113 |
_LMAAttribute.set_Value(value); |
|
5114 |
_LMItemNote.Commit(); |
|
5115 |
|
|
5116 |
if (_LMAAttribute != null) |
|
5117 |
ReleaseCOMObjects(_LMAAttribute); |
|
5118 |
if (_LMItemNote != null) |
|
5119 |
ReleaseCOMObjects(_LMItemNote); |
|
5120 |
} |
|
5121 |
} |
|
5122 |
} |
|
5123 |
if (_LMSymbol != null) |
|
5124 |
ReleaseCOMObjects(_LMSymbol); |
|
5125 |
} |
|
5126 |
|
|
5090 | 5127 |
private void AssociationTextModeling(Text text) |
5091 | 5128 |
{ |
5092 | 5129 |
LMSymbol _LMSymbol = null; |
내보내기 Unified diff