프로젝트

일반

사용자정보

개정판 980e8a9d

ID980e8a9df6935e492c1976928870ba05879eeb9c
상위 a00d1cc7
하위 0e6bd98e, bef6b98c

조봉훈이(가) 일년 이상 전에 추가함

Fix Match Up/Down Stream.

Change-Id: Id747b654b66f33bb45e30edb7ad5c2eaf335b0c9

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
787 787
                    Log.Write(ex.Message);
788 788
                    Log.Write(ex.StackTrace);
789 789
                }
790

  
791
            SetFlowAllLine();
790 792
        }
791 793
        private void RunSpecBreakModeling()
792 794
        {
......
1636 1638
                        placeRunInputs.AddSymbolTarget(_TargetItem, lineX, lineY);
1637 1639
                        tempConnector = _placement.PIDPlaceRun(lMAItem, placeRunInputs);
1638 1640
                        if (tempConnector != null)
1641
                        {
1639 1642
                            tempConnector.Commit();
1643
                            SetFlowUpstream(tempConnector.ModelItemID);
1644
                        }
1640 1645
                        ReleaseCOMObjects(lMAItem);
1641 1646
                        lMAItem = null;
1642 1647
                        ReleaseCOMObjects(placeRunInputs);
......
2778 2783

  
2779 2784
                    FlowMarkModeling(currentLine);
2780 2785

  
2786
                    SetFlowUpstream(lMConnector.ModelItemID);
2781 2787
                    ReleaseCOMObjects(lMConnector);
2782

  
2783
                    LMModelItem modelItem = dataSource.GetModelItem(currentLine.SPPID.ModelItemId);
2784
                    if (modelItem != null)
2785
                    {
2786
                        LMAAttribute attribute = modelItem.Attributes["FlowDirection"];
2787
                        if (attribute != null)
2788
                            attribute.set_Value("End 1 is upstream (Inlet)");
2789
                        modelItem.Commit();
2790
                    }
2791
                    ReleaseCOMObjects(modelItem);
2792
                    modelItem = null;
2793 2788
                }
2794 2789
                else if (!isBranchModeling)
2795 2790
                {
......
2880 2875

  
2881 2876
            LMConnector lMConnector = _placement.PIDPlaceRun(lMAItem, placeRunInputs);
2882 2877
            if (lMConnector != null)
2878
            {
2883 2879
                lMConnector.Commit();
2884 2880

  
2881
                SetFlowUpstream(lMConnector.ModelItemID);
2882
            }
2883

  
2885 2884
            ReleaseCOMObjects(lMAItem);
2886 2885
            lMAItem = null;
2887 2886
            ReleaseCOMObjects(placeRunInputs);
......
3220 3219
                        placeFirstRunInputs.AddSymbolTarget(endSymbol, points[0], points[1], diagonal);
3221 3220

  
3222 3221
                        string otherSymbolPath = symbolPath;
3223
                        Symbol symbolDef = document.SYMBOLS.FirstOrDefault(f => f.SPPID.RepresentationId == endSymbol.AsLMRepresentation().Id);
3222
                        Symbol symbolDef = document.SYMBOLS.Find(f => f.SPPID.RepresentationId == endSymbol.AsLMRepresentation().Id);
3224 3223
                        if (symbolDef != null)
3225 3224
                        {
3226
                            Connector otherConn = symbolDef.CONNECTORS.FirstOrDefault(f => f.ConnectedObject != null && f.ConnectedObject.GetType() == typeof(Line) && ((Line)f.ConnectedObject).UID != line.UID);
3225
                            Connector otherConn = symbolDef.CONNECTORS.Find(f => f.ConnectedObject != null && f.ConnectedObject.GetType() == typeof(Line) && ((Line)f.ConnectedObject).UID != line.UID);
3227 3226
                            if (otherConn != null)
3228 3227
                            {
3229 3228
                                otherSymbolPath = ((Line)otherConn.ConnectedObject).SPPID.MAPPINGNAME;
......
3234 3233
                        newFirstConnector = _placement.PIDPlaceRun(lMAFirstItem, placeFirstRunInputs);
3235 3234
                        newFirstConnector.Commit();
3236 3235

  
3236
                        SetFlowUpstream(newFirstConnector.ModelItemID);
3237

  
3237 3238
                        placeRunInputs.AddConnectorTarget(newFirstConnector, points[0], points[1], diagonal);
3238 3239
                        ReleaseCOMObjects(placeFirstRunInputs);
3239 3240
                        ReleaseCOMObjects(lMAFirstItem);
......
3263 3264
            if (newConnector != null)
3264 3265
            {
3265 3266
                newConnector.Commit();
3267
                SetFlowUpstream(newConnector.ModelItemID);
3268

  
3266 3269
                if (startSymbol != null && bStart)
3267 3270
                {
3268 3271
                    lMAItem = _placement.PIDCreateItem(symbolPath);
......
3274 3277
                    {
3275 3278
                        lMConnector.Commit();
3276 3279
                        RemoveConnectorForReModelingLine(newConnector);
3280
                        SetFlowUpstream(lMConnector.ModelItemID);
3281

  
3277 3282
                        ReleaseCOMObjects(lMConnector);
3278 3283
                    }
3279 3284
                    ReleaseCOMObjects(placeRunInputs);
......
3294 3299
            ReleaseCOMObjects(modelItem);
3295 3300
        }
3296 3301

  
3302
        private void SetFlowUpstream(dynamic modelItemID)
3303
        {
3304
            LMModelItem modelItem = dataSource.GetModelItem(modelItemID);
3305
            if (modelItem != null)
3306
            {
3307
                LMAAttribute attribute = modelItem.Attributes["FlowDirection"];
3308
                if (attribute != null)
3309
                    attribute.set_Value("End 1 is upstream (Inlet)");
3310
                modelItem.Commit();
3311
                ReleaseCOMObjects(modelItem);
3312
            }
3313
        }
3314
        private void SetFlowAllLine(string modelItemID = "")
3315
        {
3316
            List<Line> lineList = null;
3317
            if (!string.IsNullOrWhiteSpace(modelItemID))
3318
            {
3319
                lineList = document.LINES.FindAll(z => z.SPPID.ModelItemId == modelItemID).ToList();
3320
            }
3321
            else
3322
            {
3323
                lineList = document.LINES;
3324
            }
3325
            foreach (var line in lineList)
3326
            {
3327
                foreach (var repId in line.SPPID.Representations)
3328
                {
3329
                    LMConnector _connector = dataSource.GetConnector(repId);
3330
                    if (_connector != null && _connector.get_ItemStatus() == "Active")
3331
                    {
3332
                        if (line.SPPID.ModelItemId != _connector.ModelItemID)
3333
                        {
3334
                            line.SPPID.ModelItemId = _connector.ModelItemID;
3335
                            line.SPPID.Representations = GetRepresentations(line.SPPID.ModelItemId);
3336
                        }
3337
                    }
3338
                    SetFlowUpstream(_connector.ModelItemID);
3339
                    ReleaseCOMObjects(_connector);
3340
                }
3341
            }
3342
        }
3297 3343
        /// <summary>
3298 3344
        /// Remodeling 과정에서 생긴 불필요한 Connector 제거
3299 3345
        /// </summary>
......
3526 3572

  
3527 3573
                if (flowDirection == "End 1 is downstream (Outlet)")
3528 3574
                {
3529
                    placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, x, y);
3530 3575
                    placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, x, y);
3531
                    flowDirection = "End 1 is upstream (Inlet)";
3576
                    placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, x, y);
3532 3577
                }
3533 3578
                else
3534 3579
                {
3535
                    placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, x, y);
3536 3580
                    placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, x, y);
3581
                    placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, x, y);
3537 3582
                }
3538 3583
                string oldModelItemId = connector.ModelItemID;
3539 3584
                _placement.PIDRemovePlacement(connector.AsLMRepresentation());
3540 3585
                newConnector = _placement.PIDPlaceRun(lMAItem, placeRunInputs);
3541 3586
                newConnector.Commit();
3542 3587
                ZeroLengthSymbolToSymbolModelItemID.Add(newConnector.ModelItemID);
3543
                if (!string.IsNullOrEmpty(flowDirection))
3544
                    newConnector.ModelItemObject.Attributes["FlowDirection"].set_Value(flowDirection);
3588
                SetFlowUpstream(newConnector.ModelItemID);
3545 3589
                ReleaseCOMObjects(connector);
3546 3590

  
3547
                foreach (var line in document.LINES.FindAll(z => z.SPPID.ModelItemId == oldModelItemId))
3548
                {
3549
                    foreach (var repId in line.SPPID.Representations)
3550
                    {
3551
                        LMConnector _connector = dataSource.GetConnector(repId);
3552
                        if (_connector != null && _connector.get_ItemStatus() == "Active")
3553
                        {
3554
                            if (line.SPPID.ModelItemId != _connector.ModelItemID)
3555
                            {
3556
                                line.SPPID.ModelItemId = _connector.ModelItemID;
3557
                                line.SPPID.Representations = GetRepresentations(line.SPPID.ModelItemId);
3558
                            }
3559
                        }
3560
                        ReleaseCOMObjects(_connector);
3561
                        _connector = null;
3562
                    }
3563
                }
3591
                SetFlowAllLine(oldModelItemId);
3564 3592
            }
3565 3593

  
3566 3594
            return newConnector;
......
4040 4068
                    if (connector.get_ItemStatus() != "Active")
4041 4069
                        continue;
4042 4070

  
4043
                    if (connector.ConnectItem1SymbolObject.Id == connectedLMSymbol.Id)
4071
                    if (connector.ConnectItem1SymbolObject != null && connector.ConnectItem1SymbolObject.Id == connectedLMSymbol.Id)
4044 4072
                    {
4045 4073
                        targetConnector = connector;
4046 4074
                        break;
4047 4075
                    }
4048
                    else if (connector.ConnectItem2SymbolObject.Id == connectedLMSymbol.Id)
4076
                    else if (connector.ConnectItem2SymbolObject != null && connector.ConnectItem2SymbolObject.Id == connectedLMSymbol.Id)
4049 4077
                    {
4050 4078
                        targetConnector = connector;
4051 4079
                        break;

내보내기 Unified diff

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