프로젝트

일반

사용자정보

개정판 02a45794

ID02a45794afdad2923d6e043ba34c631f205e16c2
상위 c52c1783
하위 83b5c192

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

dev issue #1176 : ValidationCheck 항목 추가

Change-Id: I4fbad8a6095302f1b94d7e6021df95de699ab934

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
206 206
            List<Line> step1_Line = AllLine.FindAll(x => !stepLast_Line.Contains(x));
207 207

  
208 208
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, step1_Line.Count);
209
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling - 1");
209
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Line Modeling - 1");
210 210

  
211 211
            SetPriorityLine(step1_Line);
212 212
            foreach (var item in step1_Line)
......
226 226
            }
227 227

  
228 228
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, BranchLines.Count);
229
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling - 2");
229
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Line Modeling - 2");
230 230
            int branchCount = BranchLines.Count;
231 231
            while (BranchLines.Count > 0)
232 232
            {
......
264 264
            }
265 265

  
266 266
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, stepLast_Line.Count);
267
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling - 3");
267
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Line Modeling - 3");
268 268
            foreach (var item in stepLast_Line)
269 269
            {
270 270
                try
......
2204 2204

  
2205 2205
            if (targetLMConnector != null)
2206 2206
            {
2207
                Array array = new double[] { 0, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y };
2208
                LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, Rotation: 0, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: true);
2207
                double[] point = GetSegmentPoint(ownerObj, connectedItem, targetLMConnector);
2208
                Array array = null;
2209
                if (point != null)
2210
                    array = new double[] { 0, point[0], point[1] };
2211
                else
2212
                    array = new double[] { 0, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y };
2213
                LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: true);
2209 2214
                if (_LmLabelPersist != null)
2210 2215
                {
2211 2216
                    endBreak.SPPID.RepresentationId = _LmLabelPersist.AsLMRepresentation().Id;
......
2339 2344
                        if (mapping != null && !string.IsNullOrEmpty(mapping.SPPIDSYMBOLNAME) && mapping.SPPIDSYMBOLNAME != "None")
2340 2345
                        {
2341 2346
                            string MappingPath = mapping.SPPIDSYMBOLNAME;
2342
                            Array array = new double[] { 0, specBreak.SPPID.ORIGINAL_X, specBreak.SPPID.ORIGINAL_Y };
2343
                            LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(MappingPath, ref array, Rotation: specBreak.ANGLE, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
2347
                            double[] point = GetSegmentPoint(upStreamObj, downStreamObj, targetLMConnector);
2348
                            Array array = null;
2349
                            if (point != null)
2350
                                array = new double[] { 0, point[0], point[1] };
2351
                            else
2352
                                array = new double[] { 0, specBreak.SPPID.ORIGINAL_X, specBreak.SPPID.ORIGINAL_Y };
2353
                            LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(MappingPath, ref array, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
2344 2354

  
2345 2355
                            if (_LmLabelPersist != null)
2346 2356
                            {
......
2487 2497
            return targetConnector;
2488 2498
        }
2489 2499

  
2500
        private double[] GetSegmentPoint(object targetObj, object connObj, LMConnector targetConnector)
2501
        {
2502
            double[] result = null;
2503
            if (Convert.ToBoolean(targetConnector.get_IsZeroLength()))
2504
            {
2505
                return GetConnectorVertices(targetConnector)[0];
2506
            }
2507
            else
2508
            {
2509
                if (targetObj.GetType() == typeof(Line) && connObj.GetType() == typeof(Line))
2510
                {
2511
                    Line line = connObj as Line;
2512
                    LMConnector connectedConnector = null;
2513
                    int connIndex = 0;
2514
                    LMModelItem modelItem = dataSource.GetModelItem(line.SPPID.ModelItemId);
2515
                    FindConnectedConnector(targetConnector, modelItem, ref connectedConnector, ref connIndex);
2516

  
2517
                    List<double[]> vertices = GetConnectorVertices(targetConnector);
2518

  
2519
                    ReleaseCOMObjects(modelItem);
2520
                    ReleaseCOMObjects(connectedConnector);
2521

  
2522
                    if (vertices.Count > 0)
2523
                    {
2524
                        if (connIndex == 1)
2525
                            return vertices[0];
2526
                        else if (connIndex == 2)
2527
                            return vertices[vertices.Count - 1];
2528
                    }
2529
                }
2530
                else
2531
                {
2532
                    Log.Write("error in GetSegemtPoint");
2533
                }
2534
            }
2535

  
2536
            return result;
2537
        }
2538

  
2490 2539
        private bool IsConnected(LMConnector connector, LMModelItem modelItem)
2491 2540
        {
2492 2541
            bool result = false;
......
2541 2590
            return result;
2542 2591
        }
2543 2592

  
2593
        private void FindConnectedConnector(LMConnector connector, LMModelItem modelItem, ref LMConnector connectedConnector, ref int connectorIndex)
2594
        {
2595
            foreach (LMRepresentation rep in modelItem.Representations)
2596
            {
2597
                if (connectedConnector != null)
2598
                    break;
2599

  
2600
                if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active")
2601
                {
2602
                    LMConnector _LMConnector = dataSource.GetConnector(rep.Id);
2603

  
2604
                    if (_LMConnector.ConnectItem1SymbolObject != null &&
2605
                        connector.ConnectItem1SymbolObject != null &&
2606
                        _LMConnector.ConnectItem1SymbolObject.Id == connector.ConnectItem1SymbolObject.Id)
2607
                    {
2608
                        connectedConnector = _LMConnector;
2609
                        connectorIndex = 1;
2610
                        break;
2611
                    }
2612
                    else if (_LMConnector.ConnectItem1SymbolObject != null &&
2613
                        connector.ConnectItem2SymbolObject != null &&
2614
                        _LMConnector.ConnectItem1SymbolObject.Id == connector.ConnectItem2SymbolObject.Id)
2615
                    {
2616
                        connectedConnector = _LMConnector;
2617
                        connectorIndex = 2;
2618
                        break;
2619
                    }
2620
                    else if (_LMConnector.ConnectItem2SymbolObject != null &&
2621
                        connector.ConnectItem1SymbolObject != null &&
2622
                        _LMConnector.ConnectItem2SymbolObject.Id == connector.ConnectItem1SymbolObject.Id)
2623
                    {
2624
                        connectedConnector = _LMConnector;
2625
                        connectorIndex = 1;
2626
                        break;
2627
                    }
2628
                    else if (_LMConnector.ConnectItem2SymbolObject != null &&
2629
                        connector.ConnectItem2SymbolObject != null &&
2630
                        _LMConnector.ConnectItem2SymbolObject.Id == connector.ConnectItem2SymbolObject.Id)
2631
                    {
2632
                        connectedConnector = _LMConnector;
2633
                        connectorIndex = 2;
2634
                        break;
2635
                    }
2636

  
2637
                    if (connectedConnector == null)
2638
                        ReleaseCOMObjects(_LMConnector);
2639
                }
2640
            }
2641
        }
2642

  
2544 2643
        /// <summary>
2545 2644
        /// FromModelItem을 ToModelItem으로 PipeRunJoin하는 메서드
2546 2645
        /// </summary>
......
2690 2789
        private List<double[]> GetConnectorVertices(LMConnector connector)
2691 2790
        {
2692 2791
            List<double[]> vertices = new List<double[]>();
2693
            dynamic OID = connector.get_GraphicOID().ToString();
2694
            DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
2695
            Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
2696
            int verticesCount = lineStringGeometry.VertexCount;
2697
            double[] value = null;
2698
            lineStringGeometry.GetVertices(ref verticesCount, ref value);
2699
            for (int i = 0; i < verticesCount; i++)
2792
            if (connector != null)
2700 2793
            {
2701
                double x = 0;
2702
                double y = 0;
2703
                lineStringGeometry.GetVertex(i + 1, ref x, ref y);
2704
                vertices.Add(new double[] { x, y });
2794
                dynamic OID = connector.get_GraphicOID().ToString();
2795
                DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
2796
                Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
2797
                int verticesCount = lineStringGeometry.VertexCount;
2798
                double[] value = null;
2799
                lineStringGeometry.GetVertices(ref verticesCount, ref value);
2800
                for (int i = 0; i < verticesCount; i++)
2801
                {
2802
                    double x = 0;
2803
                    double y = 0;
2804
                    lineStringGeometry.GetVertex(i + 1, ref x, ref y);
2805
                    vertices.Add(new double[] { x, y });
2806
                }
2705 2807
            }
2706 2808
            return vertices;
2707 2809
        }
......
3087 3189
                }
3088 3190
            }
3089 3191
        }
3192

  
3090 3193
        private void LineNumberModeling(LineNumber lineNumber)
3091 3194
        {
3092 3195
            Line line = SPPIDUtil.FindObjectByUID(document, lineNumber.CONNLINE) as Line;
......
3980 4083
        /// <param name="objVars"></param>
3981 4084
        public void ReleaseCOMObjects(params object[] objVars)
3982 4085
        {
3983
            int intNewRefCount = 0;
3984
            foreach (object obj in objVars)
4086
            if (objVars != null)
3985 4087
            {
3986
                if (!Information.IsNothing(obj) && System.Runtime.InteropServices.Marshal.IsComObject(obj))
3987
                    intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj);
4088
                int intNewRefCount = 0;
4089
                foreach (object obj in objVars)
4090
                {
4091
                    if (!Information.IsNothing(obj) && System.Runtime.InteropServices.Marshal.IsComObject(obj))
4092
                        intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj);
4093
                }
3988 4094
            }
3989 4095
        }
3990 4096
    }

내보내기 Unified diff

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