프로젝트

일반

사용자정보

개정판 310aeb31

ID310aeb3143132857810d32123a917039cdcfd1dc
상위 ea80efaa
하위 03a684dd, 8b069d9f

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

dev issue #000 : Instrument Lable 임시 모델링 개발 / Signal Run Branch 안되던 현상 수정

Change-Id: I245c21b40b7e9aa69731f69fb9fc7cc656691121

차이점 보기:

DTI_PID/BaseModel/Model/SPPID/SPPIDLineInfo.cs
15 15
        public double END_X { get; set; }
16 16
        public double END_Y { get; set; }
17 17
        public string ModelItemId { get; set; }
18
        public bool IsGroup { get; set; }
19 18
    }
20 19
}
DTI_PID/BaseModel/Model/SPPID/SPPIDSymbolInfo.cs
12 12
        public double ORIGINAL_X { get; set; }
13 13
        public double ORIGINAL_Y { get; set; }
14 14
        public string RepresentationId { get; set; }
15
        public bool IsGroup { get; set; }
16 15
    }
17 16
}
DTI_PID/BaseModel/Project_DB.cs
221 221
                    using (SQLiteCommand cmd = connection.CreateCommand())
222 222
                    {
223 223
                        cmd.CommandText = string.Format(@"
224
                            SELECT sp.UID, s.Name, st.Type, sp.SPPID_SYMBOL_PATH FROM {1} as st, {0} as s 
224
                            SELECT s.UID, s.Name, st.Type, sp.SPPID_SYMBOL_PATH FROM {1} as st, {0} as s 
225 225
                                LEFT OUTER JOIN {2} as sp 
226 226
                                    ON s.UID = SP.UID 
227 227
                            WHERE s.SymbolType_UID = st.UID 
228 228
                            ORDER BY st.TYPE ASC;", Symbol_TABLE, SymbolType_TABLE, SPPID_SYMBOL_MAPPING_TABLE);
229 229
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
230 230
                            dt.Load(dr);
231

  
232
                        DataTable dtClone = dt.Clone();
233
                        dtClone.Columns["UID"].DataType = typeof(string);
234
                        foreach (DataRow row in dt.Rows)
235
                        {
236
                            dtClone.ImportRow(row);
237
                        }
238
                        dt.Dispose();
239
                        dt = dtClone;
231 240
                    }
232 241
                    connection.Close();
233 242
                }
DTI_PID/SPPIDConverter/AutoModeling.cs
112 112
                // Input Symbol Attribute
113 113
                foreach (var item in document.SYMBOLS)
114 114
                    InputSymbolAttribute(item);
115

  
116
                #region 임시 Label
117
                foreach (var item in document.SYMBOLS)
118
                {
119
                    if (item.TYPE.Contains("Labels"))
120
                    {
121
                        SPPIDSymbolInfo info = item.SPPID;
122
                        Array points = new double[] { 0, item.SPPID.ORIGINAL_X, item.SPPID.ORIGINAL_Y };
123
                        string symbolUID = item.ATTRIBUTES.Find(x => x.ATTRIBUTE == "SYMBOLOWNER").VALUE;
124
                        Symbol symbol = SPPIDUtil.FindObjectByUID(document, symbolUID) as Symbol;
125

  
126
                        LMSymbol _TargetItem = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
127
                        LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(item.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: _TargetItem.AsLMRepresentation(), IsLeaderVisible: true);
128
                        LMModelItem _LMModelItem = _TargetItem.ModelItemObject;
129
                        LMAAttributes _Attributes = _LMModelItem.Attributes;
130

  
131
                        foreach (var attribute in item.ATTRIBUTES)
132
                        {
133
                            AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID);
134
                            if (mapping != null)
135
                            {
136
                                LMAAttribute _LMAAttribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
137
                                if (_LMAAttribute != null)
138
                                    _LMAAttribute.set_Value(attribute.VALUE);
139
                            }
140
                        }
141
                        _LMModelItem.Commit();
142
                        _LMLabelPresist.Commit();
143
                        ReleaseCOMObjects(_TargetItem);
144
                        ReleaseCOMObjects(_LMLabelPresist);
145
                        ReleaseCOMObjects(_LMModelItem);
146
                        ReleaseCOMObjects(_Attributes);
147
                    }
148
                }
149
                #endregion
115 150
            }
116 151
            catch (Exception ex)
117 152
            {
......
809 844

  
810 845
        private void JoinPipeRun(string fromModelItemId, string toModelItemId)
811 846
        {
812
            LMPipeRun run1 = dataSource.GetPipeRun(toModelItemId);
813
            LMPipeRun run2 = dataSource.GetPipeRun(fromModelItemId);
847
            LMModelItem modelItem1 = dataSource.GetModelItem(toModelItemId);
848
            _LMAItem item1 = modelItem1.AsLMAItem();
849
            LMModelItem modelItem2 = dataSource.GetModelItem(fromModelItemId);
850
            _LMAItem item2 = modelItem2.AsLMAItem();
851
            
814 852
            // item2가 item1으로 조인
815 853
            try
816 854
            {
817
                _LMAItem item1 = run1.AsLMAItem();
818
                _LMAItem item2 = run2.AsLMAItem();
819

  
820 855
                _placement.PIDJoinRuns(ref item1, ref item2);
821 856
                item1.Commit();
822 857
                item2.Commit();
......
827 862
            }
828 863
            finally
829 864
            {
830
                ReleaseCOMObjects(run1);
831
                ReleaseCOMObjects(run2);
865
                ReleaseCOMObjects(modelItem1);
866
                ReleaseCOMObjects(item1);
867
                ReleaseCOMObjects(modelItem2);
868
                ReleaseCOMObjects(item2);
832 869
            }
833 870
        }
834 871

  
835 872
        private void AutoJoinPipeRun(string modelItemId)
836 873
        {
837
            LMPipeRun run = dataSource.GetPipeRun(modelItemId);
874
            LMModelItem modelItem = dataSource.GetModelItem(modelItemId);
875
            _LMAItem item = modelItem.AsLMAItem();
838 876
            try
839 877
            {
840
                _LMAItem item = run.AsLMAItem();
841 878
                string modelitemID = item.Id;
842 879
                _placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item);
843 880
                string afterModelItemID = item.Id;
......
855 892
            }
856 893
            finally
857 894
            {
858
                ReleaseCOMObjects(run);
895
                ReleaseCOMObjects(modelItem);
896
                ReleaseCOMObjects(item);
859 897
            }
860 898
        }
861 899

  
......
879 917
        private Dictionary<LMConnector, List<double[]>> GetPipeRunVertices(string modelId)
880 918
        {
881 919
            Dictionary<LMConnector, List<double[]>> connectorVertices = new Dictionary<LMConnector, List<double[]>>();
882
            LMPipeRun _LMPipeRun = dataSource.GetPipeRun(modelId);
883
            if (_LMPipeRun != null)
920
            LMModelItem modelItem = dataSource.GetModelItem(modelId);
921

  
922
            if (modelItem != null)
884 923
            {
885
                foreach (LMRepresentation rep in _LMPipeRun.Representations)
924
                foreach (LMRepresentation rep in modelItem.Representations)
886 925
                {
887 926
                    if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active")
888 927
                    {
......
904 943
                    }
905 944
                }
906 945

  
907
                ReleaseCOMObjects(_LMPipeRun);
946
                ReleaseCOMObjects(modelItem);
908 947
            }
909 948

  
910 949
            return connectorVertices;
......
1047 1086
                if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
1048 1087
                {
1049 1088
                    LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
1050
                    dynamic _LMModelItem = ((dynamic)_LMSymbol).ModelItemObject;
1089
                    LMModelItem _LMModelItem = _LMSymbol.ModelItemObject;
1051 1090
                    LMAAttributes _Attributes = _LMModelItem.Attributes;
1052 1091

  
1053 1092
                    foreach (var item in symbol.PROPERTIES)
DTI_PID/SPPIDConverter/ConverterForm.cs
545 545
#if DEBUG
546 546
            this.Visible = false;
547 547

  
548
            //SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
548
            SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
549 549
            //SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml");
550
            SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\Isocynates-325_Page49.xml");
550
            //SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\Isocynates-325_Page49.xml");
551 551
            document.SymbolMappings = symbolMappings;
552 552
            document.ChildSymbolMappings = childSymbolMappings;
553 553
            document.LineMappings = lineMappings;
DTI_PID/SPPIDConverter/Model/SPPID_Document.cs
226 226

  
227 227
            return true;
228 228
        }
229
        #region Grouping Source
230
        private bool SetGrouping()
231
        {
232
            try
233
            {
234
                // Line 기준으로 묶음
235
                foreach (Line item in LINES)
236
                    if (!item.SPPID.IsGroup)
237
                        SetGroupingByItem(item);
238
                // End
239

  
240
                // Symbol 기준으로 묶음
241
                foreach (Symbol item in SYMBOLS)
242
                    if (!item.SPPID.IsGroup)
243
                        SetGroupingByItem(item);
244
                // End
245
            }
246
            catch (Exception ex)
247
            {
248
                return false;
249
            }
250
            return true;
251
        }
252

  
253
        private void SetGroupingByItem(object item)
254
        {
255
            Group group = new Group();
256
            group.Items.Add(item);
257
            bool forward = true;
258
            SetGroupingByConnectedItem(item, group.Items, ref forward);
259

  
260
            GROUPS.Add(group);
261
        }
262

  
263
        private void SetGroupingByConnectedItem(object item, List<object> list, ref bool IsForward)
264
        {
265
            if (typeof(Line) == item.GetType())
266
            {
267
                Line line = item as Line;
268
                line.SPPID.IsGroup = true;
269
                SetGroupingByConnectedItem_ConnectorsLogic(item, list, ref IsForward, line.CONNECTORS);
270
            }
271
            else if (typeof(Symbol) == item.GetType())
272
            {
273
                Symbol symbol = item as Symbol;
274
                symbol.SPPID.IsGroup = true;
275
                // Symbol의 경우 BaseSymbol Connector가 2개 이하때 진행 / 나머지는 Grouping 종료
276
                int baseSymbolCount = 0;
277
                if (symbol.CONNECTORS.Count > 0)
278
                {
279
                    foreach (Connector symbolConnector in symbol.CONNECTORS)
280
                        if (symbolConnector.Index == 0)
281
                            baseSymbolCount++;
282

  
283
                    if (baseSymbolCount <= 2)
284
                        SetGroupingByConnectedItem_ConnectorsLogic(item, list, ref IsForward, symbol.CONNECTORS);
285
                }
286
            }
287
            IsForward = false;
288
        }
289

  
290
        private void SetGroupingByConnectedItem_ConnectorsLogic(object item, List<object> list, ref bool IsForward, List<Connector> connectors)
291
        {
292
            foreach (Connector connector in connectors)
293
            {
294
                object connItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
295
                if (connItem != null)
296
                {
297
                    bool result = false;
298
                    if (typeof(Line) == connItem.GetType())
299
                    {
300
                        Line connLine = connItem as Line;
301
                        // 연결되는 Item이 전부 Line일 경우 Branch, Line Type을 확인
302
                        if (item.GetType() == connLine.GetType())
303
                        {
304
                            Line line = item as Line;
305
                            if (SPPIDUtil.IsBranchLine(line.UID, connLine) || line.SPPID.MAPPINGNAME != connLine.SPPID.MAPPINGNAME)
306
                                continue;
307
                        }
308

  
309
                        result = true;
310
                    }
311
                    else if (typeof(Symbol) == connItem.GetType())
312
                    {
313
                        Symbol connSymbol = connItem as Symbol;
314
                        // 연결되는 Symbol의 Connector가 부가 심볼일 경우는 result = false
315
                        foreach (Connector symbolConnector in connSymbol.CONNECTORS)
316
                        {
317
                            string itemUID = item as Symbol != null ? ((Symbol)item).UID : ((Line)item).UID;
318

  
319
                            if (symbolConnector.CONNECTEDITEM == itemUID)
320
                            {
321
                                if (symbolConnector.Index == 0)
322
                                    result = true;
323
                                else
324
                                    result = false;
325
                                break;
326
                            }
327
                        }
328
                    }
329

  
330
                    if (!(connItem as Symbol != null ? ((Symbol)connItem).SPPID.IsGroup : ((Line)connItem).SPPID.IsGroup) && result)
331
                    {
332
                        if (IsForward)
333
                            list.Add(connItem);
334
                        else
335
                            list.Insert(0, connItem);
336
                        SetGroupingByConnectedItem(connItem, list, ref IsForward);
337
                    }
338
                }
339
            }
340
        }
341
        #endregion
342 229
    }
343 230
}

내보내기 Unified diff

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