프로젝트

일반

사용자정보

개정판 ca6e0f51

IDca6e0f519f64f5772705dea5a85242f593e8b64a
상위 2800c367
하위 24515a3a

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

dev issue #000 : 안정화

Change-Id: I0841f03ded95d09a89f5a939aa0a23ec1e78a5bc

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
87 87
                    Log.Write("Start Modeling");
88 88
                    SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true);
89 89
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd);
90
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 15);
90
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 16);
91 91
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText);
92 92

  
93 93
                    // Equipment Modeling
......
106 106
                    RunSpecBreakModeling();
107 107
                    // Join SameConnector
108 108
                    RunJoinRunForSameConnector();
109
                    // Join Run
110
                    RunJoinRun();
109 111
                    // Check FlowDirection
110 112
                    RunFlowDirection();
111 113
                    // Note Modeling
......
123 125

  
124 126
                    // Result Logging
125 127
                    document.CheckModelingResult();
126
                    
127
                    
128

  
128 129
                    //// LineRun Line Join
129 130
                    //SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Join LineRuns");
130 131
                    //foreach (LineNumber lineNumber in document.LINENUMBERS)
......
155 156
                    //        Log.Write(ex.Message);
156 157
                    //        Log.Write(ex.StackTrace);
157 158
                    //    }
159

  
160

  
161

  
162

  
163

  
158 164
                }
159 165
            }
160 166
            catch (Exception ex)
......
409 415
        private void RunJoinRunForSameConnector()
410 416
        {
411 417
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count);
412
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "PipeRun Join");
418
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "PipeRun Join - 1");
413 419
            foreach (var line in document.LINES)
414 420
            {
415 421
                if (!SPPIDUtil.IsSegmentLine(document, line))
......
418 424
                    {
419 425
                        if (connector.ConnectedObject != null &&
420 426
                            connector.ConnectedObject.GetType() == typeof(Line) &&
421
                            !SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line)) 
427
                            !SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line))
422 428
                        {
423 429
                            Line connLine = connector.ConnectedObject as Line;
424 430
                            if (line.SPPID.ModelItemId != connLine.SPPID.ModelItemId && !string.IsNullOrEmpty(line.SPPID.ModelItemId) && !string.IsNullOrEmpty(connLine.SPPID.ModelItemId))
425
                                JoinPipeRun(connLine.SPPID.ModelItemId, line.SPPID.ModelItemId);
431
                                JoinPipeRunForSameConnector(connLine.SPPID.ModelItemId, line.SPPID.ModelItemId);
426 432
                        }
427 433
                    }
428 434
                }
429 435
                SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
430 436
            }
431 437
        }
438
        private void RunJoinRun()
439
        {
440
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count);
441
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "PipeRun Join - 2");
442
            foreach (var line in document.LINES)
443
            {
444
                JoinRun(line);
445
                SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
446
            }
447
        }
432 448
        private void RunFlowDirection()
433 449
        {
434 450
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, 
......
1524 1540

  
1525 1541
            List<Line> group = new List<Line>();
1526 1542
            GetConnectedLineGroup(line, group);
1543
            //SortGroupLine(group);
1527 1544
            LineCoordinateCorrection(group);
1528 1545

  
1529 1546
            foreach (var groupLine in group)
......
1590 1607
                                else if (groupLine.SlopeType == SlopeType.VERTICAL)
1591 1608
                                    placeRunInputs.AddPoint(-0.1, y);
1592 1609
                                else
1593
                                    placeRunInputs.AddPoint(x, -0.1);
1610
                                {
1611
                                    if (SPPIDUtil.CalcAngle(groupLine.SPPID.START_X, groupLine.SPPID.START_Y, groupLine.SPPID.END_X, groupLine.SPPID.END_Y) < 45)
1612
                                        placeRunInputs.AddPoint(-0.1, y);
1613
                                    else
1614
                                        placeRunInputs.AddPoint(x, -0.1);
1615
                                }
1594 1616
                            }
1595 1617

  
1596 1618
                            placeRunInputs.AddPoint(x, y);
......
1602 1624
                                else if (groupLine.SlopeType == SlopeType.VERTICAL)
1603 1625
                                    placeRunInputs.AddPoint(-0.1, y);
1604 1626
                                else
1605
                                    placeRunInputs.AddPoint(x, -0.1);
1627
                                {
1628
                                    if (SPPIDUtil.CalcAngle(groupLine.SPPID.START_X, groupLine.SPPID.START_Y, groupLine.SPPID.END_X, groupLine.SPPID.END_Y) < 45)
1629
                                        placeRunInputs.AddPoint(-0.1, y);
1630
                                    else
1631
                                        placeRunInputs.AddPoint(x, -0.1);
1632
                                }
1633
                                    
1606 1634
                            }
1607 1635
                        }
1608 1636
                    }
......
1702 1730
            }
1703 1731
        }
1704 1732

  
1733
        private void SortGroupLine(List<Line> group)
1734
        {
1735
            List<Line> result = new List<Line>();
1736
            result.Add(group[0]);
1737

  
1738
            group.Clear();
1739
            result.AddRange(result);
1740
        }
1741

  
1705 1742
        private void LineCoordinateCorrection(List<Line> group)
1706 1743
        {
1707 1744
            // 순서대로 전 Item 기준 정렬
......
2463 2500
        /// </summary>
2464 2501
        /// <param name="modelItemID1"></param>
2465 2502
        /// <param name="modelItemID2"></param>
2466
        private void JoinPipeRun(string modelItemID1, string modelItemID2)
2503
        private void JoinPipeRunForSameConnector(string modelItemID1, string modelItemID2)
2467 2504
        {
2468
            LMModelItem modelItem1 = dataSource.GetModelItem(modelItemID1);
2469
            _LMAItem item1 = modelItem1.AsLMAItem();
2470
            LMModelItem modelItem2 = dataSource.GetModelItem(modelItemID2);
2471
            _LMAItem item2 = modelItem2.AsLMAItem();
2472

  
2473
            // item2가 item1으로 조인
2474
            _placement.PIDJoinRuns(ref item1, ref item2);
2475
            item1.Commit();
2476
            item2.Commit();
2477

  
2478
            string beforeID = string.Empty;
2479
            string afterID = string.Empty;
2480

  
2481
            if (modelItem1.get_ItemStatus() == "Active" && modelItem2.get_ItemStatus() != "Active")
2482
            {
2483
                beforeID = modelItem2.Id;
2484
                afterID = modelItem1.Id;
2485
            }
2486
            else if (modelItem1.get_ItemStatus() != "Active" && modelItem2.get_ItemStatus() == "Active")
2487
            {
2488
                beforeID = modelItem1.Id;
2489
                afterID = modelItem2.Id;
2490
            }
2491
            else
2505
            try
2492 2506
            {
2493
                throw new Exception("확인 필요한 케이스");
2494
            }
2507
                LMModelItem modelItem1 = dataSource.GetModelItem(modelItemID1);
2508
                _LMAItem item1 = modelItem1.AsLMAItem();
2509
                LMModelItem modelItem2 = dataSource.GetModelItem(modelItemID2);
2510
                _LMAItem item2 = modelItem2.AsLMAItem();
2495 2511

  
2496
            List<Line> lines = SPPIDUtil.FindLinesByModelId(document, beforeID);
2497
            foreach (var line in lines)
2498
                line.SPPID.ModelItemId = afterID;
2512
                // item2가 item1으로 조인
2513
                _placement.PIDJoinRuns(ref item1, ref item2);
2514
                item1.Commit();
2515
                item2.Commit();
2499 2516

  
2500
            ReleaseCOMObjects(modelItem1);
2501
            ReleaseCOMObjects(item1);
2502
            ReleaseCOMObjects(modelItem2);
2503
            ReleaseCOMObjects(item2);
2504
        }
2517
                string beforeID = string.Empty;
2518
                string afterID = string.Empty;
2505 2519

  
2506
        /// <summary>
2507
        /// PipeRun을 자동으로 Join하는 메서드
2508
        /// </summary>
2509
        /// <param name="modelItemId"></param>
2510
        private void AutoJoinPipeRun(string modelItemId)
2511
        {
2512
            LMModelItem modelItem = dataSource.GetModelItem(modelItemId);
2513
            _LMAItem item = modelItem.AsLMAItem();
2514
            if (modelItem.get_ItemStatus() == "Active")
2515
            {
2516
                string modelitemID = item.Id;
2517
                _placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item);
2518
                string afterModelItemID = item.Id;
2520
                if (modelItem1.get_ItemStatus() == "Active" && modelItem2.get_ItemStatus() != "Active")
2521
                {
2522
                    beforeID = modelItem2.Id;
2523
                    afterID = modelItem1.Id;
2524
                }
2525
                else if (modelItem1.get_ItemStatus() != "Active" && modelItem2.get_ItemStatus() == "Active")
2526
                {
2527
                    beforeID = modelItem1.Id;
2528
                    afterID = modelItem2.Id;
2529
                }
2530
                else
2531
                {
2532
                    Log.Write("확인 필요한 케이스");
2533
                }
2519 2534

  
2520
                if (modelitemID != afterModelItemID)
2535
                if (!string.IsNullOrEmpty(beforeID) && !string.IsNullOrEmpty(afterID))
2521 2536
                {
2522
                    List<Line> lines = SPPIDUtil.FindLinesByModelId(document, modelitemID);
2537
                    List<Line> lines = SPPIDUtil.FindLinesByModelId(document, beforeID);
2523 2538
                    foreach (var line in lines)
2524
                        line.SPPID.ModelItemId = afterModelItemID;
2539
                        line.SPPID.ModelItemId = afterID;
2525 2540
                }
2526
                item.Commit();
2527
            }
2528 2541

  
2529
            ReleaseCOMObjects(modelItem);
2530
            ReleaseCOMObjects(item);
2531
        }
2532

  
2533
        /// <summary>
2534
        /// LineRun에 있는 Line들을 Join하는 진입 메서드
2535
        /// </summary>
2536
        /// <param name="run"></param>
2537
        private void JoinRunLine(LineRun run)
2538
        {
2539
            string modelItemId = string.Empty;
2540
            foreach (var item in run.RUNITEMS)
2542
                ReleaseCOMObjects(modelItem1);
2543
                ReleaseCOMObjects(item1);
2544
                ReleaseCOMObjects(modelItem2);
2545
                ReleaseCOMObjects(item2);
2546
            }
2547
            catch (Exception ex)
2541 2548
            {
2542
                if (item.GetType() == typeof(Line))
2543
                {
2544
                    Line line = item as Line;
2545
                    AutoJoinPipeRun(line.SPPID.ModelItemId);
2546
                    modelItemId = line.SPPID.ModelItemId;
2547
                }
2549
                Log.Write("Join Error");
2550
                Log.Write(ex.Message);
2548 2551
            }
2549 2552
        }
2550 2553

  
......
2986 2989
                }
2987 2990
            }
2988 2991
        }
2992

  
2989 2993
        /// <summary>
2990 2994
        /// Flow Mark Modeling
2991 2995
        /// </summary>
......
3107 3111
                LMSymbol _LMSymbol = dataSource.GetSymbol(sRep);
3108 3112
                LMModelItem _LMModelItem = _LMSymbol.ModelItemObject;
3109 3113
                LMAAttributes _Attributes = _LMModelItem.Attributes;
3110

  
3114
                
3111 3115
                foreach (var item in targetAttributes)
3112 3116
                {
3113 3117
                    AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID);
......
3499 3503
                ReleaseCOMObjects(_LMSymbol);
3500 3504
        }
3501 3505

  
3506
        private void JoinRun(Line line)
3507
        {
3508
            if (!string.IsNullOrEmpty(line.SPPID.ModelItemId))
3509
            {
3510
                //LMModelItem modelItem = dataSource.GetModelItem(line.SPPID.ModelItemId);
3511
                //foreach (LMRepresentation rep in modelItem.Representations)
3512
                //{
3513
                //    if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active")
3514
                //    {
3515
                //        LMConnector connector = dataSource.GetConnector(rep.Id);
3516
                //        if (connector.ConnectItem1SymbolObject != null && connector.ConnectItem1SymbolObject.get_RepresentationType() != "Branch")
3517
                //        {
3518

  
3519
                //        }
3520
                //        if (connector.ConnectItem2SymbolObject != null && connector.ConnectItem2SymbolObject.get_RepresentationType() != "Branch")
3521
                //        {
3522

  
3523
                //        }
3524
                //    }
3525
                //}
3526

  
3527

  
3528
                ////JoinPipeRun()
3529
            }
3530
        }
3531

  
3502 3532
        /// <summary>
3503 3533
        /// Label의 좌표를 구하는 메서드(ID2 기준의 좌표 -> SPPID 좌표)
3504 3534
        /// </summary>
......
3613 3643
                    }
3614 3644
                    else
3615 3645
                    {
3616
                        // 아이템 연결 갯수(심볼, Line이면서 Not Branch)
3617
                        int connItemRetval = CompareConnItem(a, b);
3618
                        if (connItemRetval != 0)
3646
                        // ConnectedItem이 없는것
3647
                        int noneConnRetval = CompareNoneConn(a, b);
3648
                        if (noneConnRetval != 0)
3619 3649
                        {
3620
                            return connItemRetval;
3650
                            return noneConnRetval;
3621 3651
                        }
3622 3652
                        else
3623 3653
                        {
3624
                            // ConnectedItem이 없는것
3625
                            int noneConnRetval = CompareNoneConn(a, b);
3626
                            if (noneConnRetval != 0)
3654
                            // 아이템 연결 갯수(심볼, Line이면서 Not Branch)
3655
                            int connItemRetval = CompareConnItem(a, b);
3656
                            if (connItemRetval != 0)
3627 3657
                            {
3628
                                return noneConnRetval;
3658
                                return connItemRetval;
3629 3659
                            }
3630 3660
                            else
3631 3661
                            {

내보내기 Unified diff

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