프로젝트

일반

사용자정보

개정판 ea80efaa

IDea80efaa4ce8de758bdd1948619da42be71c2f29
상위 f4880c6a
하위 310aeb31

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #000 : Association Text Item 모델링 안하고 특정 Item으로 Modeling

Change-Id: Ia9a61a4d319c60a53f04abc9e33e11c791f65ea6

차이점 보기:

DTI_PID/BaseModel/Model/Document.cs
64 64
                DWGNAME = xml.Element("DWGNAME").Value;
65 65
                SIZE = xml.Element("SIZE").Value;
66 66

  
67
                SetText(xml.Element("TEXTINFOS"));
68
                SetNote(xml.Element("NOTES"));
67 69
                SetSymbol(xml.Element("SYMBOLS"));
68 70
                SetLine(xml.Element("LINEINFOS"));
69 71
                SetLineNumber(xml.Element("LINENOS"));
70
                SetText(xml.Element("TEXTINFOS"));
71
                SetNote(xml.Element("NOTES"));
72 72
                SetTrimLine(xml.Element("TRIMLINENOS"));
73 73

  
74 74
                _Enable = true;
......
234 234
                Text text = new Text()
235 235
                {
236 236
                    UID = item.Element("UID").Value,
237
                    OWNER = item.Element("OWNER").Value,
237 238
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
238 239
                    NAME = item.Element("NAME").Value,
239 240
                    LOCATION = item.Element("LOCATION").Value,
......
286 287
        {
287 288
            foreach (XElement item in node.Elements("ASSOCIATION"))
288 289
            {
289
                associations.Add(new Association()
290
                Association association = new Association()
290 291
                {
291 292
                    TYPE = item.Attribute("TYPE").Value,
292 293
                    VALUE = item.Value
293
                });
294
                };
295

  
296
                Text text = _TEXTINFOS.Find(x => x.UID == association.VALUE);
297
                if (text != null)
298
                    text.ASSOCIATION = true;
299

  
300
                associations.Add(association);
294 301
            }
295 302
        }
296 303

  
DTI_PID/BaseModel/Model/Text.cs
9 9
    public class Text
10 10
    {
11 11
        private string _UID;
12
        private string _OWNER;
12 13
        private string _ATTRIBUTEVALUE;
13 14
        private string _NAME;
14 15
        private string _LOCATION;
......
18 19
        private string _HEIGHT;
19 20
        private string _AREA;
20 21
        private SPPIDSymbolInfo _SPPID;
22
        private bool _ASSOCIATION;
21 23

  
22 24
        public string UID { get => _UID; set => _UID = value; }
23 25
        public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; }
......
46 48
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
47 49
        public string AREA { get => _AREA; set => _AREA = value; }
48 50
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
51
        public bool ASSOCIATION { get => _ASSOCIATION; set => _ASSOCIATION = value; }
52
        public string OWNER { get => _OWNER; set => _OWNER = value; }
49 53
    }
50 54
}
DTI_PID/SPPIDConverter/AutoModeling.cs
1047 1047
                if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
1048 1048
                {
1049 1049
                    LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
1050
                    LMAAttributes _Attributes = null;
1051
                    LMPipingComp _LMPipingComp = null;
1052
                    LMInstrument _LMInstrument = null;
1053
                    LMOPC _LMOPC = null;
1054
                    LMNozzle _LMNozzle = null;
1055

  
1056
                    if (_LMSymbol.get_FileName().Contains("Instrumentation"))
1057
                    {
1058
                        _LMInstrument = dataSource.GetInstrument(_LMSymbol.ModelItemID);
1059
                        _Attributes = _LMInstrument.Attributes;
1060
                    }
1061
                    else if (_LMSymbol.get_FileName().Contains("OPC"))
1062
                    { 
1063
                        _LMOPC = dataSource.GetOPC(_LMSymbol.ModelItemID);
1064
                        _Attributes = _LMOPC.Attributes;
1065
                    }
1066
                    else if (_LMSymbol.get_FileName().Contains("Nozzle"))
1067
                    {
1068
                        _LMNozzle = dataSource.GetNozzle(_LMSymbol.ModelItemID);
1069
                        _Attributes = _LMNozzle.Attributes;
1070
                    }
1071
                    else
1072
                    {
1073
                        _LMPipingComp = dataSource.GetPipingComp(_LMSymbol.ModelItemID);
1074
                        _Attributes = _LMPipingComp.Attributes;
1075
                    }
1050
                    dynamic _LMModelItem = ((dynamic)_LMSymbol).ModelItemObject;
1051
                    LMAAttributes _Attributes = _LMModelItem.Attributes;
1076 1052

  
1077 1053
                    foreach (var item in symbol.PROPERTIES)
1078 1054
                    {
......
1097 1073
                    }
1098 1074

  
1099 1075
                    ReleaseCOMObjects(_LMSymbol);
1100
                    if (_LMPipingComp != null)
1101
                    {
1102
                        _LMPipingComp.Commit();
1103
                        ReleaseCOMObjects(_LMPipingComp);
1104
                    }
1105
                    if (_LMInstrument != null)
1106
                    {
1107
                        _LMInstrument.Commit();
1108
                        ReleaseCOMObjects(_LMInstrument);
1109
                    }
1110
                    if (_LMOPC != null)
1111
                    {
1112
                        _LMOPC.Commit();
1113
                        ReleaseCOMObjects(_LMOPC);
1114
                    }
1115
                    if (_LMNozzle != null)
1116
                    {
1117
                        _LMNozzle.Commit();
1118
                        ReleaseCOMObjects(_LMNozzle);
1119
                    }
1120

  
1121

  
1076
                    ReleaseCOMObjects(_Attributes);
1077
                    ReleaseCOMObjects(_LMModelItem);
1122 1078
                }
1123 1079
            }
1124 1080
            catch (Exception ex)
......
1130 1086
        private void TextModeling(Text text)
1131 1087
        {
1132 1088
            LMSymbol _LMSymbol = null;
1133
            LMItemNote _LMItemNote = null;
1134
            LMAAttribute _LMAAttribute = null;
1135

  
1136 1089
            try
1137 1090
            {
1138
                _LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y);
1139
                _LMSymbol.Commit();
1140
                _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
1141
                _LMItemNote.Commit();
1142
                _LMAAttribute = _LMItemNote.Attributes["Note.Body"];
1143
                _LMAAttribute.set_Value(text.VALUE);
1144
                _LMItemNote.Commit();
1091
                if (text.ASSOCIATION && !string.IsNullOrEmpty(text.OWNER) && text.OWNER != "None")
1092
                {
1093
                    object owner = SPPIDUtil.FindObjectByUID(document, text.OWNER);
1094
                    if (owner.GetType() == typeof(Symbol))
1095
                    {
1096
                        Symbol symbol = owner as Symbol;
1097
                        _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
1098
                        if (_LMSymbol != null)
1099
                        {
1100
                            Association association = symbol.ASSOCIATIONS.Find(x => x.VALUE == text.UID);
1101
                            List<BaseModel.Attribute> attributes = symbol.ATTRIBUTES.FindAll(x => x.ATTRIBUTETYPE == association.TYPE);
1102
                            AttributeMapping mapping = null;
1103
                            foreach (var attribute in attributes)
1104
                            {
1105
                                 mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME));
1106
                                if (mapping != null)
1107
                                    break;  
1108
                            }
1109

  
1110
                            if (mapping != null)
1111
                            {
1112
                                Array array = new double[] { 0, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y };
1113
                                LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: true);
1114
                                if (_LMLabelPersist!=null)
1115
                                {
1116
                                    _LMLabelPersist.Commit();
1117
                                    ReleaseCOMObjects(_LMLabelPersist);
1118
                                }
1119
                            }
1120
                        }
1121
                    }
1122
                    else if (owner.GetType() == typeof(Line))
1123
                    {
1124

  
1125
                    }
1126
                }
1127
                else
1128
                {
1129
                    LMItemNote _LMItemNote = null;
1130
                    LMAAttribute _LMAAttribute = null;
1131

  
1132
                    _LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y);
1133
                    _LMSymbol.Commit();
1134
                    _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
1135
                    _LMItemNote.Commit();
1136
                    _LMAAttribute = _LMItemNote.Attributes["Note.Body"];
1137
                    _LMAAttribute.set_Value(text.VALUE);
1138
                    _LMItemNote.Commit();
1139

  
1140
                    if (_LMAAttribute != null)
1141
                        ReleaseCOMObjects(_LMAAttribute);
1142
                    if (_LMItemNote != null)
1143
                        ReleaseCOMObjects(_LMItemNote);
1144
                }
1145 1145
            }
1146 1146
            catch (Exception ex)
1147 1147
            {
......
1149 1149
            }
1150 1150
            finally
1151 1151
            {
1152
                if (_LMAAttribute != null)
1153
                    ReleaseCOMObjects(_LMAAttribute);
1154
                if (_LMItemNote != null)
1155
                    ReleaseCOMObjects(_LMItemNote);
1156 1152
                if (_LMSymbol != null)
1157 1153
                    ReleaseCOMObjects(_LMSymbol);
1158 1154
            }
DTI_PID/SPPIDConverter/Form/MappingForm.cs
340 340
                    {
341 341
                        textBoxLineNumberPath.Text = node.GetValue("FullPath").ToString();
342 342
                    }
343
                    else if (tabbedControlGroup.SelectedTabPage.Name == "GroupAssociation" && gridViewAssociation.FocusedRowHandle >= 0)
343
                    else if (tabbedControlGroup.SelectedTabPage.Name == "GroupAttribute" && gridViewAssociation.FocusedRowHandle >= 0)
344 344
                    {
345 345
                        gridViewAssociation.SetRowCellValue(gridViewAssociation.FocusedRowHandle, "SPPID_SYMBOL_PATH", node.GetValue("FullPath").ToString());
346 346
                    }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)