프로젝트

일반

사용자정보

개정판 1805d3b7

ID1805d3b74aaede301551bc15947a2456969f6bd9
상위 5173ba5d
하위 b01e7456

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

dev issue #000 : bug fix 및 Branch line target 찾을 때 ZeroLength 검색 추가

Change-Id: I893083efa7aa4735d07e732caa97a80931ce11d3

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
261 261
                        }
262 262
                        SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
263 263
                    }
264
                    
265
                    #region RadApp 방식
266
                    //SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, radApp.ActiveDocument.ActiveSheet.Symbols.Count + radApp.ActiveDocument.ActiveSheet.AllDependencyObjects.Count);
267
                    //SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Attribute");
268
                    //foreach (var item in radApp.ActiveDocument.ActiveSheet.Symbols)
269
                    //{
270
                    //    string modelItemID = string.Empty;
271
                    //    foreach (var attributes in item.AttributeSets)
272
                    //    {
273
                    //        if (!string.IsNullOrEmpty(modelItemID))
274
                    //            break;
275

  
276
                    //        foreach (var attribute in attributes)
277
                    //        {
278
                    //            if (attribute.Name == "ModelID")
279
                    //            {
280
                    //                modelItemID = attribute.GetValue().ToString();
281
                    //                break;
282
                    //            }
283
                    //        }
284
                    //    }
285

  
286
                    //    if (!string.IsNullOrEmpty(modelItemID))
287
                    //    {
288
                    //        LMModelItem modelItem = dataSource.GetModelItem(modelItemID);
289
                    //        if (modelItem != null)
290
                    //        {
291
                    //            LMAAttribute attribute = modelItem.Attributes["NominalDiameter"];
292
                    //            if (attribute != null)
293
                    //                attribute.set_Value(DBNull.Value);
294
                    //            attribute = modelItem.Attributes["PipingPoint1.NominalDiameter"];
295
                    //            if (attribute != null)
296
                    //                attribute.set_Value(DBNull.Value);
297
                    //            attribute = modelItem.Attributes["PipingPoint2.NominalDiameter"];
298
                    //            if (attribute != null)
299
                    //                attribute.set_Value(DBNull.Value);
300

  
301
                    //            modelItem.Commit();
302
                    //            ReleaseCOMObjects(modelItem);
303
                    //        }
304
                    //    }
305

  
306
                    //}
307
                    //foreach (var item in radApp.ActiveDocument.ActiveSheet.AllDependencyObjects)
308
                    //{
309
                    //    string modelItemID = string.Empty;
310
                    //    foreach (var attributes in item.AttributeSets)
311
                    //    {
312
                    //        if (!string.IsNullOrEmpty(modelItemID))
313
                    //            break;
314

  
315
                    //        foreach (var attribute in attributes)
316
                    //        {
317
                    //            if (attribute.Name == "ModelID")
318
                    //            {
319
                    //                modelItemID = attribute.GetValue().ToString();
320
                    //                break;
321
                    //            }
322
                    //        }
323
                    //    }
324

  
325
                    //    if (!string.IsNullOrEmpty(modelItemID))
326
                    //    {
327
                    //        LMModelItem modelItem = dataSource.GetModelItem(modelItemID);
328
                    //        if (modelItem != null)
329
                    //        {
330
                    //            LMAAttribute attribute = modelItem.Attributes["NominalDiameter"];
331
                    //            if (attribute != null)
332
                    //                attribute.set_Value(DBNull.Value);
333

  
334
                    //            modelItem.Commit();
335
                    //            ReleaseCOMObjects(modelItem);
336
                    //        }
337
                    //    }
338
                    //}
339
                    #endregion 
340 264
                    SetSystemEditingCommand(true);
341 265
                    #endregion
342 266

  
......
563 487

  
564 488
                if (radApp.ActiveDocument != null)
565 489
                {
566
                    //radApp.ActiveDocument.Save();
490
                    radApp.ActiveDocument.Save();
567 491
                    //radApp.ActiveDocument.SaveOnClose = false;
568 492
                    //radApp.ActiveDocument.Close(false);
569 493

  
......
1902 1826
            Dictionary<LMConnector, List<double[]>> dicVertices = GetPipeRunVertices(connector.ModelItemID);
1903 1827
            foreach (var item in dicVertices)
1904 1828
            {
1905
                bool result = false;
1906
                foreach (var point in item.Value)
1829
                if (item.Value.Count == 2)
1907 1830
                {
1908
                    if (point[0] < 0 || point[1] < 0)
1831
                    bool result = false;
1832
                    foreach (var point in item.Value)
1909 1833
                    {
1910
                        result = true;
1911
                        _placement.PIDRemovePlacement(item.Key.AsLMRepresentation());
1912
                        break;
1834
                        if (point[0] < 0 || point[1] < 0)
1835
                        {
1836
                            result = true;
1837
                            _placement.PIDRemovePlacement(item.Key.AsLMRepresentation());
1838
                            break;
1839
                        }
1913 1840
                    }
1914
                }
1915 1841

  
1916
                if (result)
1917
                    break;
1842
                    if (result)
1843
                        break;
1844
                }
1918 1845
            }
1919 1846
            foreach (var item in dicVertices)
1920 1847
                ReleaseCOMObjects(item.Key);
......
2593 2520
                        {
2594 2521
                            LMSymbol connSymbol = targetConnector.ConnectItem1SymbolObject;
2595 2522
                            if (connSymbol == null ||
2596
                                (connSymbol != null && connSymbol.get_ItemStatus() == "Active" && connSymbol.get_RepresentationType() != "Branch"))
2523
                                (connSymbol != null && connSymbol.get_ItemStatus() == "Active"))
2597 2524
                            {
2598
                                bool bCalcX = false;
2599
                                bool bCalcY = false;
2600
                                if (targetLine.SlopeType == SlopeType.HORIZONTAL)
2601
                                    bCalcX = true;
2602
                                else if (targetLine.SlopeType == SlopeType.VERTICAL)
2603
                                    bCalcY = true;
2604
                                else
2525
                                bool containZeroLength = false;
2526
                                foreach (LMConnector connector in connSymbol.Connect1Connectors)
2527
                                {
2528
                                    if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
2529
                                        containZeroLength = true;
2530
                                }
2531
                                foreach (LMConnector connector in connSymbol.Connect2Connectors)
2605 2532
                                {
2606
                                    bCalcX = true;
2607
                                    bCalcY = true;
2533
                                    if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
2534
                                        containZeroLength = true;
2608 2535
                                }
2609 2536

  
2610
                                if (bCalcX)
2537
                                if (connSymbol.get_RepresentationType() != "Branch" ||
2538
                                    containZeroLength)
2611 2539
                                {
2612
                                    double nextX = targetVertices[i + 1][0];
2613
                                    double newX = 0;
2614
                                    if (nextX > tempX)
2615
                                    {
2616
                                        newX = tempX + gridSetting.Length;
2617
                                        if (newX > nextX)
2618
                                            newX = (point[0] + nextX) / 2;
2619
                                    }
2540
                                    bool bCalcX = false;
2541
                                    bool bCalcY = false;
2542
                                    if (targetLine.SlopeType == SlopeType.HORIZONTAL)
2543
                                        bCalcX = true;
2544
                                    else if (targetLine.SlopeType == SlopeType.VERTICAL)
2545
                                        bCalcY = true;
2620 2546
                                    else
2621 2547
                                    {
2622
                                        newX = tempX - gridSetting.Length;
2623
                                        if (newX < nextX)
2624
                                            newX = (point[0] + nextX) / 2;
2548
                                        bCalcX = true;
2549
                                        bCalcY = true;
2625 2550
                                    }
2626
                                    resultPoint = new double[] { newX, resultPoint[1] };
2627
                                }
2628 2551

  
2629
                                if (bCalcY)
2630
                                {
2631
                                    double nextY = targetVertices[i + 1][1];
2632
                                    double newY = 0;
2633
                                    if (nextY > tempY)
2552
                                    if (bCalcX)
2634 2553
                                    {
2635
                                        newY = tempY + gridSetting.Length;
2636
                                        if (newY > nextY)
2637
                                            newY = (point[1] + nextY) / 2;
2554
                                        double nextX = targetVertices[i + 1][0];
2555
                                        double newX = 0;
2556
                                        if (nextX > tempX)
2557
                                        {
2558
                                            newX = tempX + gridSetting.Length;
2559
                                            if (newX > nextX)
2560
                                                newX = (point[0] + nextX) / 2;
2561
                                        }
2562
                                        else
2563
                                        {
2564
                                            newX = tempX - gridSetting.Length;
2565
                                            if (newX < nextX)
2566
                                                newX = (point[0] + nextX) / 2;
2567
                                        }
2568
                                        resultPoint = new double[] { newX, resultPoint[1] };
2638 2569
                                    }
2639
                                    else
2570

  
2571
                                    if (bCalcY)
2640 2572
                                    {
2641
                                        newY = tempY - gridSetting.Length;
2642
                                        if (newY < nextY)
2643
                                            newY = (point[1] + nextY) / 2;
2573
                                        double nextY = targetVertices[i + 1][1];
2574
                                        double newY = 0;
2575
                                        if (nextY > tempY)
2576
                                        {
2577
                                            newY = tempY + gridSetting.Length;
2578
                                            if (newY > nextY)
2579
                                                newY = (point[1] + nextY) / 2;
2580
                                        }
2581
                                        else
2582
                                        {
2583
                                            newY = tempY - gridSetting.Length;
2584
                                            if (newY < nextY)
2585
                                                newY = (point[1] + nextY) / 2;
2586
                                        }
2587
                                        resultPoint = new double[] { resultPoint[0], newY };
2644 2588
                                    }
2645
                                    resultPoint = new double[] { resultPoint[0], newY };
2646 2589
                                }
2647 2590
                            }
2648 2591
                        }
......
2650 2593
                        {
2651 2594
                            LMSymbol connSymbol = targetConnector.ConnectItem2SymbolObject;
2652 2595
                            if (connSymbol == null ||
2653
                                (connSymbol != null && connSymbol.get_ItemStatus() == "Active" && connSymbol.get_RepresentationType() != "Branch"))
2596
                                (connSymbol != null && connSymbol.get_ItemStatus() == "Active"))
2654 2597
                            {
2655
                                bool bCalcX = false;
2656
                                bool bCalcY = false;
2657
                                if (targetLine.SlopeType == SlopeType.HORIZONTAL)
2658
                                    bCalcX = true;
2659
                                else if (targetLine.SlopeType == SlopeType.VERTICAL)
2660
                                    bCalcY = true;
2661
                                else
2598
                                bool containZeroLength = false;
2599
                                foreach (LMConnector connector in connSymbol.Connect1Connectors)
2600
                                {
2601
                                    if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
2602
                                        containZeroLength = true;
2603
                                }
2604
                                foreach (LMConnector connector in connSymbol.Connect2Connectors)
2662 2605
                                {
2663
                                    bCalcX = true;
2664
                                    bCalcY = true;
2606
                                    if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
2607
                                        containZeroLength = true;
2665 2608
                                }
2666 2609

  
2667
                                if (bCalcX)
2610
                                if (connSymbol.get_RepresentationType() != "Branch" ||
2611
                                    containZeroLength)
2668 2612
                                {
2669
                                    double nextX = targetVertices[i - 1][0];
2670
                                    double newX = 0;
2671
                                    if (nextX > tempX)
2672
                                    {
2673
                                        newX = tempX + gridSetting.Length;
2674
                                        if (newX > nextX)
2675
                                            newX = (point[0] + nextX) / 2;
2676
                                    }
2613
                                    bool bCalcX = false;
2614
                                    bool bCalcY = false;
2615
                                    if (targetLine.SlopeType == SlopeType.HORIZONTAL)
2616
                                        bCalcX = true;
2617
                                    else if (targetLine.SlopeType == SlopeType.VERTICAL)
2618
                                        bCalcY = true;
2677 2619
                                    else
2678 2620
                                    {
2679
                                        newX = tempX - gridSetting.Length;
2680
                                        if (newX < nextX)
2681
                                            newX = (point[0] + nextX) / 2;
2621
                                        bCalcX = true;
2622
                                        bCalcY = true;
2682 2623
                                    }
2683
                                    resultPoint = new double[] { newX, resultPoint[1] };
2684
                                }
2685 2624

  
2686
                                if (bCalcY)
2687
                                {
2688
                                    double nextY = targetVertices[i - 1][1];
2689
                                    double newY = 0;
2690
                                    if (nextY > tempY)
2625
                                    if (bCalcX)
2691 2626
                                    {
2692
                                        newY = tempY + gridSetting.Length;
2693
                                        if (newY > nextY)
2694
                                            newY = (point[1] + nextY) / 2;
2627
                                        double nextX = targetVertices[i - 1][0];
2628
                                        double newX = 0;
2629
                                        if (nextX > tempX)
2630
                                        {
2631
                                            newX = tempX + gridSetting.Length;
2632
                                            if (newX > nextX)
2633
                                                newX = (point[0] + nextX) / 2;
2634
                                        }
2635
                                        else
2636
                                        {
2637
                                            newX = tempX - gridSetting.Length;
2638
                                            if (newX < nextX)
2639
                                                newX = (point[0] + nextX) / 2;
2640
                                        }
2641
                                        resultPoint = new double[] { newX, resultPoint[1] };
2695 2642
                                    }
2696
                                    else
2643

  
2644
                                    if (bCalcY)
2697 2645
                                    {
2698
                                        newY = tempY - gridSetting.Length;
2699
                                        if (newY < nextY)
2700
                                            newY = (point[1] + nextY) / 2;
2646
                                        double nextY = targetVertices[i - 1][1];
2647
                                        double newY = 0;
2648
                                        if (nextY > tempY)
2649
                                        {
2650
                                            newY = tempY + gridSetting.Length;
2651
                                            if (newY > nextY)
2652
                                                newY = (point[1] + nextY) / 2;
2653
                                        }
2654
                                        else
2655
                                        {
2656
                                            newY = tempY - gridSetting.Length;
2657
                                            if (newY < nextY)
2658
                                                newY = (point[1] + nextY) / 2;
2659
                                        }
2660
                                        resultPoint = new double[] { resultPoint[0], newY };
2701 2661
                                    }
2702
                                    resultPoint = new double[] { resultPoint[0], newY };
2703 2662
                                }
2704 2663
                            }
2705 2664
                        }

내보내기 Unified diff

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