프로젝트

일반

사용자정보

개정판 d63050d6

IDd63050d63b8bf687393a200428b05f8cecd34a16
상위 b48f882e
하위 31911f94

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

dev issue #706 : Line 우선순위를 정하고 순서대로 Modeling

Change-Id: I9bdb3fd8621579d3cd1255554b38845a34d2ecd1

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
158 158
                        }
159 159
                    }
160 160

  
161
                    SetPriorityLine();
161 162
                    // LineRun Symbol Modeling
162 163
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Symbols Modeling");
163 164
                    foreach (LineNumber lineNumber in document.LINENUMBERS)
......
191 192

  
192 193
                    // LineRun Line Modeling
193 194
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling");
195

  
196
                    foreach (var item in document.LINES)
197
                    {
198

  
199
                    }
194 200
                    foreach (LineNumber lineNumber in document.LINENUMBERS)
195 201
                        try
196 202
                        {
......
237 243
                            Log.Write(ex.Message);
238 244
                            Log.Write(ex.StackTrace);
239 245
                        }
240
                    
241 246

  
242 247
                    // EndBreak Modeling
243 248
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "EndBreaks Modeling");
......
1613 1618
                    if (item.Item1 == "LINE")
1614 1619
                    {
1615 1620
                        LMConnector targetConnector = item.Item3 as LMConnector;
1621
                        if (connectorVertices1.ContainsKey(targetConnector))
1622
                        {
1623
                            List<double[]> vertices = connectorVertices1[targetConnector];
1624

  
1625
                        }
1626
                        else if (connectorVertices2.ContainsKey(targetConnector))
1627
                        {
1628
                            List<double[]> vertices = connectorVertices2[targetConnector];
1629

  
1630
                        }
1616 1631
                        placeRunInputs.AddConnectorTarget(targetConnector, x, y);
1617 1632
                    }
1618 1633

  
......
3656 3671
            return symbols;
3657 3672
        }
3658 3673

  
3674
        private void SetPriorityLine()
3675
        {
3676
            document.LINES.Sort(SortLinePriority);
3677

  
3678
            int SortLinePriority(Line a, Line b)
3679
            {
3680
                // Branch 없는것부터
3681
                int branchRetval = CompareBranchLine(a, b);
3682
                if (branchRetval != 0)
3683
                {
3684
                    return branchRetval;
3685
                }
3686
                else
3687
                {
3688
                    // Symbol 연결 갯수
3689
                    int connSymbolRetval = CompareConnSymbol(a, b);
3690
                    if (connSymbolRetval != 0)
3691
                    {
3692
                        return connSymbolRetval;
3693
                    }
3694
                    else
3695
                    {
3696
                        // 아이템 연결 갯수(심볼, Line이면서 Not Branch)
3697
                        int connItemRetval = CompareConnItem(a, b);
3698
                        if (connItemRetval != 0)
3699
                        {
3700
                            return connItemRetval;
3701
                        }
3702
                        else
3703
                        {
3704
                            // ConnectedItem이 없는것
3705
                            int noneConnRetval = CompareNoneConn(a, b);
3706
                            if (noneConnRetval != 0)
3707
                            {
3708
                                return noneConnRetval;
3709
                            }
3710
                            else
3711
                            {
3712

  
3713
                            }
3714
                        }
3715
                    }
3716
                }
3717

  
3718
                return 0;
3719
            }
3720

  
3721
            int CompareConnSymbol(Line a, Line b)
3722
            {
3723
                List<Connector> connectorsA = a.CONNECTORS
3724
                    .Where(conn => conn.ConnectedObject != null && conn.ConnectedObject.GetType() == typeof(Symbol))
3725
                    .ToList();
3726

  
3727
                List<Connector> connectorsB = b.CONNECTORS
3728
                    .Where(conn => conn.ConnectedObject != null && conn.ConnectedObject.GetType() == typeof(Symbol))
3729
                    .ToList();
3730

  
3731
                // 오름차순
3732
                return connectorsB.Count.CompareTo(connectorsA.Count);
3733
            }
3734

  
3735
            int CompareConnItem(Line a, Line b)
3736
            {
3737
                List<Connector> connectorsA = a.CONNECTORS
3738
                    .Where(conn => conn.ConnectedObject != null && 
3739
                    (conn.ConnectedObject.GetType() == typeof(Symbol) || 
3740
                    (conn.ConnectedObject.GetType() == typeof(Line) && !SPPIDUtil.IsBranchLine((Line)conn.ConnectedObject, a))))
3741
                    .ToList();
3742

  
3743
                List<Connector> connectorsB = b.CONNECTORS
3744
                    .Where(conn => conn.ConnectedObject != null &&
3745
                    (conn.ConnectedObject.GetType() == typeof(Symbol) ||
3746
                    (conn.ConnectedObject.GetType() == typeof(Line) && !SPPIDUtil.IsBranchLine((Line)conn.ConnectedObject, b))))
3747
                    .ToList();
3748

  
3749
                // 오름차순
3750
                return connectorsB.Count.CompareTo(connectorsA.Count);
3751
            }
3752

  
3753
            int CompareBranchLine(Line a, Line b)
3754
            {
3755
                List<Connector> connectorsA = a.CONNECTORS
3756
                    .Where(conn => conn.ConnectedObject != null && conn.ConnectedObject.GetType() == typeof(Line) && SPPIDUtil.IsBranchLine(a, conn.ConnectedObject as Line))
3757
                    .ToList();
3758
                List<Connector> connectorsB = b.CONNECTORS
3759
                    .Where(conn => conn.ConnectedObject != null && conn.ConnectedObject.GetType() == typeof(Line) && SPPIDUtil.IsBranchLine(b, conn.ConnectedObject as Line))
3760
                    .ToList();
3761

  
3762
                // 내림차순
3763
                return connectorsA.Count.CompareTo(connectorsB.Count);
3764
            }
3765

  
3766
            int CompareNoneConn(Line a, Line b)
3767
            {
3768
                List<Connector> connectorsA = a.CONNECTORS
3769
                    .Where(conn => conn.ConnectedObject == null)
3770
                    .ToList();
3771

  
3772
                List<Connector> connectorsB = b.CONNECTORS
3773
                    .Where(conn => conn.ConnectedObject == null)
3774
                    .ToList();
3775

  
3776
                // 오름차순
3777
                return connectorsB.Count.CompareTo(connectorsA.Count);
3778
            }
3779
        }
3780

  
3659 3781
        private static int SortSymbolPriority(Symbol a, Symbol b)
3660 3782
        {
3661 3783
            int countA = a.CONNECTORS.FindAll(x => !string.IsNullOrEmpty(x.CONNECTEDITEM) && x.CONNECTEDITEM != "None").Count;

내보내기 Unified diff

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