프로젝트

일반

사용자정보

개정판 6b298450

ID6b298450d72b88cca14835acb0921ccf17345a2f
상위 b600a2ea
하위 77cd89d6

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

dev issue #000 : text, note modeling && Branch line bug fix

Change-Id: Id6292a903cfe144a0f35839a74fc769feaff8849

차이점 보기:

DTI_PID/BaseModel/Model/Note.cs
17 17
        private string _WIDTH;
18 18
        private string _HEIGHT;
19 19
        private string _AREA;
20
        private SPPIDSymbolInfo _SPPID;
20 21

  
21 22
        public string UID { get => _UID; set => _UID = value; }
22 23
        public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; }
23 24
        public string NAME { get => _NAME; set => _NAME = value; }
24 25
        public string LOCATION { get => _LOCATION; set => _LOCATION = value; }
25 26
        public string VALUE { get => _VALUE; set => _VALUE = value; }
26
        public double ANGLE { get => _ANGLE; set => _ANGLE = value; }
27
        public double ANGLE
28
        {
29
            get
30
            {
31
                return _ANGLE;
32
            }
33
            set
34
            {
35
                if (value == 1.57)
36
                    value = 90 * Math.PI / 180;
37
                else if (value == 3.14)
38
                    value = Math.PI;
39
                else if (value == 4.71)
40
                    value = 270 * Math.PI / 180;
41

  
42
                _ANGLE = value;
43
            }
44
        }
27 45
        public string WIDTH { get => _WIDTH; set => _WIDTH = value; }
28 46
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
29 47
        public string AREA { get => _AREA; set => _AREA = value; }
48
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
30 49
    }
31 50
}
DTI_PID/BaseModel/Model/Text.cs
17 17
        private string _WIDTH;
18 18
        private string _HEIGHT;
19 19
        private string _AREA;
20
        private SPPIDSymbolInfo _SPPID;
20 21

  
21 22
        public string UID { get => _UID; set => _UID = value; }
22 23
        public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; }
23 24
        public string NAME { get => _NAME; set => _NAME = value; }
24 25
        public string LOCATION { get => _LOCATION; set => _LOCATION = value; }
25 26
        public string VALUE { get => _VALUE; set => _VALUE = value; }
26
        public double ANGLE { get => _ANGLE; set => _ANGLE = value; }
27
        public double ANGLE
28
        {
29
            get
30
            {
31
                return _ANGLE;
32
            }
33
            set
34
            {
35
                if (value == 1.57)
36
                    value = 90 * Math.PI / 180;
37
                else if (value == 3.14)
38
                    value = Math.PI;
39
                else if (value == 4.71)
40
                    value = 270 * Math.PI / 180;
41

  
42
                _ANGLE = value;
43
            }
44
        }
27 45
        public string WIDTH { get => _WIDTH; set => _WIDTH = value; }
28 46
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
29 47
        public string AREA { get => _AREA; set => _AREA = value; }
48
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
30 49
    }
31 50
}
DTI_PID/SPPIDConverter/AutoModeling.cs
51 51
            {
52 52
                // Equipment Modeling
53 53
                foreach (Equipment equipment in document.Equipments)
54
                {
55 54
                    SymbolModeling(equipment as Symbol, null, null);
56
                }
57 55
                // LineRun Symbol Modeling
58 56
                foreach (LineNumber lineNumber in document.LINENUMBERS)
59
                {
60 57
                    foreach (LineRun run in lineNumber.RUNS)
61
                    {
62 58
                        SymbolModelingByRun(run);
63
                    }
64
                }
65 59
                // TrimLineRun Symbol Modeling
66 60
                foreach (TrimLine trimLine in document.TRIMLINES)
67
                {
68 61
                    foreach (LineRun run in trimLine.RUNS)
69
                    {
70 62
                        SymbolModelingByRun(run);
71
                    }
72
                }
73 63
                // LineRun Line Modeling
74 64
                foreach (LineNumber lineNumber in document.LINENUMBERS)
75
                {
76 65
                    foreach (LineRun run in lineNumber.RUNS)
77
                    {
78 66
                        LineModelingByRun(run);
79
                    }
80
                }
81 67
                // TrimLineRun Line Modeling
82 68
                foreach (TrimLine trimLine in document.TRIMLINES)
83
                {
84 69
                    foreach (LineRun run in trimLine.RUNS)
85
                    {
86 70
                        LineModelingByRun(run);
87
                    }
88
                }
89 71
                // Branch Line Modeling
90 72
                foreach (var item in BranchLines)
91
                {
92 73
                    BranchLineModeling(item);
93
                }
94 74
                // EndBreak Modeling
95 75
                foreach (var item in document.EndBreaks)
96
                {
97 76
                    EndBreakModeling(item);
98
                }
99 77
                // LineNumber Modeling
100 78
                foreach (var item in document.LINENUMBERS)
101
                {
102 79
                    LineNumberModeling(item);
103
                }
104 80
                // Input Symbol Attribute
105 81
                foreach (var item in document.SYMBOLS)
106
                {
107 82
                    InputSymbolAttribute(item);
108
                }
109 83
                // Input Line Attribute
110 84

  
111 85
                // Input LineNumber Attribute
112 86

  
113 87
                // Note Modeling
114

  
88
                foreach (var item in document.NOTES)
89
                    NoteModeling(item);
115 90
                // Text Modeling
116

  
91
                foreach (var item in document.TEXTINFOS)
92
                    TextModeling(item);
117 93
                // LineRun Line Join
118 94
                foreach (LineNumber lineNumber in document.LINENUMBERS)
119 95
                {
......
264 240
            }
265 241
        }
266 242

  
267
        private void TestSource()
268
        {
269

  
270
        }
271

  
272
        private void SymbolModeling(Symbol symbol, Symbol prevSymbol, object prevItem, bool IsFirst)
273
        {
274
            if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
275
                return;
276

  
277
            LMSymbol _LMSymbol = null;
278

  
279
            string mappingPath = symbol.SPPID.MAPPINGNAME;
280
            double x = symbol.SPPID.ORIGINAL_X;
281
            double y = symbol.SPPID.ORIGINAL_Y;
282
            int mirror = 0;
283
            double angle = symbol.ANGLE;
284
            LMSymbol _TargetItem = null;
285

  
286
            if (IsFirst)
287
            {
288
                foreach (var connector in symbol.CONNECTORS)
289
                {
290
                    object item = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM);
291
                    if (item != null && 
292
                        (item.GetType() == typeof(Symbol) || item.GetType() == typeof(Equipment)) && 
293
                        !IsSameLineNumber(symbol, item))
294
                    {
295
                        _TargetItem = dataSource.GetSymbol(((Symbol)item).SPPID.RepresentationId);
296
                        break;
297
                    }
298
                }
299
            }
300
            else if (prevItem != null && prevItem.GetType() == typeof(Symbol))
301
                _TargetItem = dataSource.GetSymbol(((Symbol)prevItem).SPPID.RepresentationId);
302
            
303
            if (prevSymbol != null)
304
            {
305
                SlopeType slopeType = SPPIDUtil.CalcSlope(x, y, prevSymbol.SPPID.ORIGINAL_X, prevSymbol.SPPID.ORIGINAL_Y);
306
                LMSymbol prevLMSymbol = dataSource.GetSymbol(prevSymbol.SPPID.RepresentationId);
307
                double prevX = prevLMSymbol.get_XCoordinate();
308
                double prevY = prevLMSymbol.get_YCoordinate();
309
                if (slopeType == SlopeType.HORIZONTAL)
310
                    y = prevY;
311
                else if (slopeType == SlopeType.VERTICAL)
312
                    x = prevX;
313
                
314
                ReleaseCOMObjects(prevLMSymbol);
315
            }
316

  
317
            if (_TargetItem == null)
318
                _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle);
319
            else
320
                _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: _TargetItem);
321

  
322
            if (_LMSymbol != null)
323
            {
324
                _LMSymbol.Commit();
325
                symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id;
326
            }
327

  
328
            if (_TargetItem != null)
329
                ReleaseCOMObjects(_TargetItem);
330
            
331
            ReleaseCOMObjects(_LMSymbol);
332
        }
333

  
334 243
        private void SymbolModeling(Symbol symbol, Symbol targetSymbol, Symbol prevSymbol)
335 244
        {
336 245
            if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
......
610 519
            #region 양쪽이 다른 Branch 
611 520
            else
612 521
            {
613
                _LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME);
614
                PlaceRunInputs placeRunInputs = new PlaceRunInputs();
615

  
616 522
                // Branch 시작 Connector
617 523
                if (_StartConnector != null)
618
                {
619
                    LMConnector _EndTargetConnector = null;
620
                    LMSymbol _EndTargetSymbol = null;
621
                    // Branch 반대편이 Line
622
                    foreach (var item in connectorVertices)
623
                    {
624
                        if (item.Key == _StartConnector)
625
                            continue;
524
                    BranchLineModelingByConnector(branch, _StartConnector, startPoints, true);
626 525

  
627
                        if (item.Key.ConnectItem1SymbolID == _StartConnector.ConnectItem2SymbolID)
628
                        {
629
                            _EndTargetConnector = item.Key;
630
                            break;
631
                        }
632
                    }
633
                    // Branch 반대편이 Symbol
634
                    if (_EndTargetConnector == null)
635
                    {
636
                        foreach (var line in lines)
637
                        {
638
                            foreach (var connector in line.CONNECTORS)
639
                            {
640
                                Symbol symbol = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM) as Symbol;
641
                                if (symbol != null)
642
                                {
643
                                    _EndTargetSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
644
                                    break;
645
                                }
646
                            }
647
                        }
648
                    }
526
                // Branch 끝 Connector
527
                if (_EndConnector != null)
528
                    BranchLineModelingByConnector(branch, _EndConnector, endPoints, false);
529
            }
530
            #endregion
649 531

  
650
                    _placement.PIDRemovePlacement(_StartConnector.AsLMRepresentation());
532
            if (_StartConnector != null)
533
                ReleaseCOMObjects(_StartConnector);
534
            if (_EndConnector != null)
535
                ReleaseCOMObjects(_EndConnector);
536
            foreach (var item in connectorVertices)
537
                ReleaseCOMObjects(item.Key);
538
        }
651 539

  
652
                    Dictionary<LMConnector, List<double[]>> startConnectorVertices = GetPipeRunVertices(branch.Item2.SPPID.ModelItemId);
653
                    LMConnector _StartTargetConnector = FindTargetLMConnector(startConnectorVertices, startPoints[0][0], startPoints[0][1], startPoints[1][0], startPoints[1][1]);
540
        private void BranchLineModelingByConnector(Tuple<string, Line, Line> branch, LMConnector _Connector, List<double[]> points, bool IsStart)
541
        {
542
            List<Line> lines = SPPIDUtil.FindLinesByModelId(document, branch.Item1);
543
            Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(branch.Item1);
544
            LMConnector _SameRunTargetConnector = null;
545
            LMSymbol _SameRunTargetSymbol = null;
546
            Dictionary<LMConnector, List<double[]>> branchConnectorVertices = null;
547
            LMConnector _BranchTargetConnector = null;
548
            PlaceRunInputs placeRunInputs = new PlaceRunInputs();
654 549

  
655
                    for (int i = 0; i < startPoints.Count; i++)
656
                    {
657
                        double[] point = startPoints[i];
658
                        if (i == 0)
659
                            placeRunInputs.AddConnectorTarget(_StartTargetConnector, point[0], point[1]);
660
                        else if (i == startPoints.Count - 1)
661
                        {
662
                            if (_EndTargetConnector != null)
663
                                placeRunInputs.AddConnectorTarget(_EndTargetConnector, point[0], point[1]);
664
                            else if (_EndTargetSymbol != null)
665
                                placeRunInputs.AddSymbolTarget(_EndTargetSymbol, point[0], point[1]);
666
                            else
667
                                placeRunInputs.AddPoint(point[0], point[1]);
668
                        }
669
                        else
670
                            placeRunInputs.AddPoint(point[0], point[1]);
671
                    }
550
            // 같은 Line Run의 Connector 찾기
551
            foreach (var item in connectorVertices)
552
            {
553
                if (item.Key == _Connector)
554
                    continue;
672 555

  
673
                    LMConnector _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs);
674
                    if (_LMConnector != null )
556
                if (IsStart &&
557
                    !DBNull.Value.Equals(item.Key.ConnectItem1SymbolID) &&
558
                    !DBNull.Value.Equals(_Connector.ConnectItem2SymbolID)&& 
559
                    item.Key.ConnectItem1SymbolID == _Connector.ConnectItem2SymbolID)
560
                {
561
                    _SameRunTargetConnector = item.Key;
562
                    break;
563
                }
564
                else if (!IsStart &&
565
                    !DBNull.Value.Equals(item.Key.ConnectItem2SymbolID) &&
566
                    !DBNull.Value.Equals(_Connector.ConnectItem1SymbolID) && 
567
                    item.Key.ConnectItem2SymbolID == _Connector.ConnectItem1SymbolID)
568
                {
569
                    _SameRunTargetConnector = item.Key;
570
                    break;
571
                }
572
            }
573

  
574
            // Branch 반대편이 Symbol
575
            if (_SameRunTargetConnector == null)
576
            {
577
                foreach (var line in lines)
578
                {
579
                    foreach (var connector in line.CONNECTORS)
675 580
                    {
676
                        if (_EndTargetConnector != null)
581
                        Symbol symbol = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM) as Symbol;
582
                        if (symbol != null)
677 583
                        {
678
                            JoinPipeRun(_LMConnector.ModelItemID, _EndTargetConnector.ModelItemID);
679
                        }
680
                        else
681
                        {
682
                            foreach (var item in lines)
683
                                item.SPPID.ModelItemId = _LMConnector.ModelItemID;
584
                            _SameRunTargetSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
585
                            break;
684 586
                        }
685

  
686
                        _LMConnector.Commit();
687
                        ReleaseCOMObjects(_LMConnector);
688 587
                    }
588
                }
589
            }
689 590

  
690
                    if (_EndTargetConnector != null)
691
                        ReleaseCOMObjects(_EndTargetConnector);
692
                    if (_EndTargetSymbol != null)
693
                        ReleaseCOMObjects(_EndTargetSymbol);
694
                    foreach (var item in startConnectorVertices)
695
                        ReleaseCOMObjects(item.Key);
591
            // 기존 Connector 제거
592
            _placement.PIDRemovePlacement(_Connector.AsLMRepresentation());
593
            
594
            // 시작 Connector일 경우 첫 Point가 TargetConnector를 찾아야함
595
            if (IsStart)
596
            {
597
                branchConnectorVertices = GetPipeRunVertices(branch.Item2.SPPID.ModelItemId);
598
                _BranchTargetConnector = FindTargetLMConnector(branchConnectorVertices, points[0][0], points[0][1], points[1][0], points[1][1]);
599
            }
600
            // 끝 Conenctor일 경우 마지막 Point가 TargetConnector를 찾아야함
601
            else
602
            {
603
                branchConnectorVertices = GetPipeRunVertices(branch.Item3.SPPID.ModelItemId);
604
                _BranchTargetConnector = FindTargetLMConnector(branchConnectorVertices,
605
                    points[points.Count - 1][0],
606
                    points[points.Count - 1][1],
607
                    points[points.Count - 2][0],
608
                    points[points.Count - 2][1]);
609
            }
696 610

  
697
                }
698
                // Branch 끝 Connector
699
                if (_EndConnector != null)
611
            for (int i = 0; i < points.Count; i++)
612
            {
613
                double[] point = points[i];
614
                if (i == 0)
700 615
                {
701
                    LMConnector _StartTargetConnector = null;
702
                    LMSymbol _StartTargetSymbol = null;
703
                    // Branch 반대편이 Line
704
                    foreach (var item in connectorVertices)
616
                    if (IsStart)
705 617
                    {
706
                        if (item.Key == _EndConnector)
707
                            continue;
708

  
709
                        if (item.Key.ConnectItem2SymbolID == _EndConnector.ConnectItem1SymbolID)
710
                        {
711
                            _StartTargetConnector = item.Key;
712
                            break;
713
                        }
618
                        placeRunInputs.AddConnectorTarget(_BranchTargetConnector, point[0], point[1]);
714 619
                    }
715
                    // Branch 반대편이 Symbol
716
                    if (_StartTargetConnector == null)
620
                    else
717 621
                    {
718
                        foreach (var line in lines)
719
                        {
720
                            foreach (var connector in line.CONNECTORS)
721
                            {
722
                                Symbol symbol = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM) as Symbol;
723
                                if (symbol != null)
724
                                {
725
                                    _StartTargetSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
726
                                    break;
727
                                }
728
                            }
729
                        }
622
                        if (_SameRunTargetConnector != null)
623
                            placeRunInputs.AddConnectorTarget(_SameRunTargetConnector, point[0], point[1]);
624
                        else if (_SameRunTargetConnector != null)
625
                            placeRunInputs.AddSymbolTarget(_SameRunTargetSymbol, point[0], point[1]);
626
                        else
627
                            placeRunInputs.AddPoint(point[0], point[1]);
730 628
                    }
731

  
732
                    _placement.PIDRemovePlacement(_EndConnector.AsLMRepresentation());
733

  
734
                    Dictionary<LMConnector, List<double[]>> startConnectorVertices = GetPipeRunVertices(branch.Item3.SPPID.ModelItemId);
735
                    LMConnector _EndTargetConnector = FindTargetLMConnector(startConnectorVertices, 
736
                        endPoints[endPoints.Count - 1][0], 
737
                        endPoints[endPoints.Count - 1][1], 
738
                        endPoints[endPoints.Count - 2][0], 
739
                        endPoints[endPoints.Count - 2][1]);
740

  
741
                    for (int i = 0; i < endPoints.Count; i++)
629
                }
630
                else if (i == points.Count - 1)
631
                {
632
                    if (IsStart)
742 633
                    {
743
                        double[] point = endPoints[i];
744
                        if (i == 0)
745
                        {
746
                            if (_StartTargetConnector != null)
747
                                placeRunInputs.AddConnectorTarget(_StartTargetConnector, point[0], point[1]);
748
                            else if (_StartTargetSymbol != null)
749
                                placeRunInputs.AddSymbolTarget(_StartTargetSymbol, point[0], point[1]);
750
                            else
751
                                placeRunInputs.AddPoint(point[0], point[1]);
752
                        }
753
                        else if (i == endPoints.Count - 1)
754
                        {
755
                            placeRunInputs.AddConnectorTarget(_EndTargetConnector, point[0], point[1]);
756
                        }
634
                        if (_SameRunTargetConnector != null)
635
                            placeRunInputs.AddConnectorTarget(_SameRunTargetConnector, point[0], point[1]);
636
                        else if (_SameRunTargetSymbol != null)
637
                            placeRunInputs.AddSymbolTarget(_SameRunTargetSymbol, point[0], point[1]);
757 638
                        else
758 639
                            placeRunInputs.AddPoint(point[0], point[1]);
759 640
                    }
760

  
761
                    LMConnector _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs);
762
                    if (_LMConnector != null)
641
                    else
763 642
                    {
764
                        if (_StartTargetConnector != null)
765
                        {
766
                            JoinPipeRun(_LMConnector.ModelItemID, _StartTargetConnector.ModelItemID);
767
                        }
768
                        else
769
                        {
770
                            foreach (var item in lines)
771
                                item.SPPID.ModelItemId = _LMConnector.ModelItemID;
772
                        }
773

  
774
                        _LMConnector.Commit();
775
                        ReleaseCOMObjects(_LMConnector);
643
                        placeRunInputs.AddConnectorTarget(_BranchTargetConnector, point[0], point[1]);
776 644
                    }
645
                }
646
                else
647
                    placeRunInputs.AddPoint(point[0], point[1]);
648
            }
649
            _LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME);
650
            LMConnector _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs);
777 651

  
778
                    if (_StartTargetConnector != null)
779
                        ReleaseCOMObjects(_StartTargetConnector);
780
                    if (_StartTargetSymbol != null)
781
                        ReleaseCOMObjects(_StartTargetSymbol);
782
                    foreach (var item in startConnectorVertices)
783
                        ReleaseCOMObjects(item.Key);
652
            if (_LMConnector != null)
653
            {
654
                if (_SameRunTargetConnector != null)
655
                {
656
                    JoinPipeRun(_LMConnector.ModelItemID, _SameRunTargetConnector.ModelItemID);
657
                }
658
                else
659
                {
660
                    foreach (var item in lines)
661
                        item.SPPID.ModelItemId = _LMConnector.ModelItemID;
784 662
                }
785 663

  
786
                ReleaseCOMObjects(_LMAItem);
787
                ReleaseCOMObjects(placeRunInputs);
664
                _LMConnector.Commit();
665
                ReleaseCOMObjects(_LMConnector);
788 666
            }
789
            #endregion
790 667

  
791
            if (_StartConnector != null)
792
                ReleaseCOMObjects(_StartConnector);
793
            if (_EndConnector != null)
794
                ReleaseCOMObjects(_EndConnector);
668
            ReleaseCOMObjects(placeRunInputs);
669
            ReleaseCOMObjects(_LMAItem);
670
            if (_BranchTargetConnector != null)
671
                ReleaseCOMObjects(_BranchTargetConnector);
672
            if (_SameRunTargetConnector != null)
673
                ReleaseCOMObjects(_SameRunTargetConnector);
674
            if (_SameRunTargetSymbol != null)
675
                ReleaseCOMObjects(_SameRunTargetSymbol);
795 676
            foreach (var item in connectorVertices)
796 677
                ReleaseCOMObjects(item.Key);
678
            foreach (var item in branchConnectorVertices)
679
                ReleaseCOMObjects(item.Key);
797 680
        }
798 681

  
799 682
        private void EndBreakModeling(EndBreak endBreak)
......
1090 973
            }
1091 974
        }
1092 975

  
1093

  
1094

  
1095 976
        private void TextModeling(Text text)
1096 977
        {
978
            LMSymbol _LMSymbol = null;
979
            LMItemNote _LMItemNote = null;
980
            LMAAttribute _LMAAttribute = null;
981

  
982
            try
983
            {
984
                _LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y);
985
                _LMSymbol.Commit();
986
                _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
987
                _LMItemNote.Commit();
988
                _LMAAttribute = _LMItemNote.Attributes["Note.Body"];
989
                _LMAAttribute.set_Value(text.VALUE);
990
                _LMItemNote.Commit();
991
            }
992
            catch (Exception ex)
993
            {
1097 994

  
995
            }
996
            finally
997
            {
998
                if (_LMAAttribute != null)
999
                    ReleaseCOMObjects(_LMAAttribute);
1000
                if (_LMItemNote != null)
1001
                    ReleaseCOMObjects(_LMItemNote);
1002
                if (_LMSymbol != null)
1003
                    ReleaseCOMObjects(_LMSymbol);
1004
            }
1098 1005
        }
1099 1006

  
1100 1007
        private void NoteModeling(Note note)
1101 1008
        {
1009
            LMSymbol _LMSymbol = null;
1010
            LMItemNote _LMItemNote = null;
1011
            LMAAttribute _LMAAttribute = null;
1012

  
1013
            try
1014
            {
1015
                _LMSymbol = _placement.PIDPlaceSymbol(note.SPPID.MAPPINGNAME, note.SPPID.ORIGINAL_X, note.SPPID.ORIGINAL_Y);
1016
                _LMSymbol.Commit();
1017
                _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
1018
                _LMItemNote.Commit();
1019
                _LMAAttribute = _LMItemNote.Attributes["Note.Body"];
1020
                _LMAAttribute.set_Value(note.VALUE);
1021
                _LMItemNote.Commit();
1022
            }
1023
            catch (Exception ex)
1024
            {
1102 1025

  
1026
            }
1027
            finally
1028
            {
1029
                if (_LMAAttribute != null)
1030
                    ReleaseCOMObjects(_LMAAttribute);
1031
                if (_LMItemNote != null)
1032
                    ReleaseCOMObjects(_LMItemNote);
1033
                if (_LMSymbol != null)
1034
                    ReleaseCOMObjects(_LMSymbol);
1035
            }
1036
            
1103 1037
        }
1104 1038

  
1105 1039
        public void ReleaseCOMObjects(params object[] objVars)
DTI_PID/SPPIDConverter/Model/SPPID_Document.cs
99 99
                item.SPPID.ORIGINAL_X = x;
100 100
                item.SPPID.ORIGINAL_Y = y;
101 101
            }
102

  
103
            foreach (var item in TEXTINFOS)
104
            {
105
                if (item.SPPID == null)
106
                    item.SPPID = new SPPIDSymbolInfo();
107
                double x = double.NaN;
108
                double y = double.NaN;
109
                SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
110
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
111
                item.SPPID.ORIGINAL_X = x;
112
                item.SPPID.ORIGINAL_Y = y;
113
            }
114

  
115
            foreach (var item in NOTES)
116
            {
117
                if (item.SPPID == null)
118
                    item.SPPID = new SPPIDSymbolInfo();
119
                double x = double.NaN;
120
                double y = double.NaN;
121
                SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
122
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
123
                item.SPPID.ORIGINAL_X = x;
124
                item.SPPID.ORIGINAL_Y = y;
125
            }
102 126
        }
103 127
        
104 128
        public bool SetSPPIDMapping()
......
143 167
                    return false;
144 168
            }
145 169

  
170
            ETCSetting etc = ETCSetting.GetInstance();
171
            foreach (var item in NOTES)
172
            {
173
                item.SPPID.MAPPINGNAME = etc.NoteSymbolPath;
174
                if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
175
                    return false;
176
            }
177

  
178
            foreach (var item in TEXTINFOS)
179
            {
180
                item.SPPID.MAPPINGNAME = etc.TextSymbolPath;
181
                if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
182
                    return false;
183
            }
146 184
            return true;
147 185
        }
148 186

  

내보내기 Unified diff

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