프로젝트

일반

사용자정보

개정판 fb386b8c

IDfb386b8c1409318bc44c9a1cb43fc6f22d7ed676
상위 71ba1ca3
하위 e18d2710, c2ec33f5

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

dev issue #000 : fix bug

Change-Id: I7650b78009812717819b6f9685f80d148cf4189d

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
478 478
#endif
479 479
                // OWNERSYMBOL Attribute, 값을 가지고 있을 경우
480 480
                BaseModel.Attribute itemAttribute = symbol.ATTRIBUTES.Find(attr => attr.ATTRIBUTE == "OWNERSYMBOL");
481
                if (itemAttribute != null && string.IsNullOrEmpty(itemAttribute.VALUE) && itemAttribute.VALUE != "None")
481
                if (itemAttribute != null && (string.IsNullOrEmpty(itemAttribute.VALUE) || itemAttribute.VALUE != "None"))
482 482
                    return;
483 483
                // 이미 모델링 됐을 경우
484 484
                else if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
......
682 682
        /// <param name="symbol"></param>
683 683
        private void LabelSymbolModeling(Symbol symbol)
684 684
        {
685
            BaseModel.Attribute itemAttribute = symbol.ATTRIBUTES.Find(x => x.ATTRIBUTE == "OWNERSYMBOL");
686
            if (itemAttribute == null || string.IsNullOrEmpty(itemAttribute.VALUE))
687
                return;
688

  
689
            Array points = new double[] { 0, symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y };
690
            
691
            string symbolUID = itemAttribute.VALUE;
692
            object targetItem = SPPIDUtil.FindObjectByUID(document, symbolUID);
693
            if (targetItem != null && 
694
                (targetItem.GetType() == typeof(Symbol) ||
695
                targetItem.GetType() == typeof(Equipment)))
685
            if (string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
696 686
            {
697
                // Object 아이템이 Symbol일 경우 Equipment일 경우 
698
                string sRep = null;
699
                if (targetItem.GetType() == typeof(Symbol))
700
                    sRep = ((Symbol)targetItem).SPPID.RepresentationId;
701
                else if (targetItem.GetType() == typeof(Equipment))
702
                    sRep = ((Equipment)targetItem).SPPID.RepresentationId;
703
                if (!string.IsNullOrEmpty(sRep))
704
                {
705
                    // LEADER Line 검사
706
                    bool leaderLine = false;
707
                    SymbolMapping symbolMapping = document.SymbolMappings.Find(x => x.UID == symbol.DBUID);
708
                    if (symbolMapping != null)
709
                        leaderLine = symbolMapping.LEADERLINE;
710

  
711
                    // Target Symbol Item 가져오고 Label Modeling
712
                    LMSymbol _TargetItem = dataSource.GetSymbol(sRep);
713
                    LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(symbol.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: _TargetItem.AsLMRepresentation(), IsLeaderVisible: leaderLine);
714

  
715
                    //Leader 선 센터로
716
                    if (_LMLabelPresist != null)
717
                    {
718
                        // Target Item에 Label의 Attribute Input
719
                        InputSymbolAttribute(targetItem, symbol.ATTRIBUTES);
687
                BaseModel.Attribute itemAttribute = symbol.ATTRIBUTES.Find(x => x.ATTRIBUTE == "OWNERSYMBOL");
688
                if (itemAttribute == null || string.IsNullOrEmpty(itemAttribute.VALUE) || itemAttribute.VALUE == "None")
689
                    return;
690
                Array points = new double[] { 0, symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y };
720 691

  
721
                        string OID = _LMLabelPresist.get_GraphicOID();
722
                        DependencyObject dependency = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID] as DependencyObject;
723
                        if (dependency != null)
692
                string symbolUID = itemAttribute.VALUE;
693
                object targetItem = SPPIDUtil.FindObjectByUID(document, symbolUID);
694
                if (targetItem != null &&
695
                    (targetItem.GetType() == typeof(Symbol) ||
696
                    targetItem.GetType() == typeof(Equipment)))
697
                {
698
                    // Object 아이템이 Symbol일 경우 Equipment일 경우 
699
                    string sRep = null;
700
                    if (targetItem.GetType() == typeof(Symbol))
701
                        sRep = ((Symbol)targetItem).SPPID.RepresentationId;
702
                    else if (targetItem.GetType() == typeof(Equipment))
703
                        sRep = ((Equipment)targetItem).SPPID.RepresentationId;
704
                    if (!string.IsNullOrEmpty(sRep))
705
                    {
706
                        // LEADER Line 검사
707
                        bool leaderLine = false;
708
                        SymbolMapping symbolMapping = document.SymbolMappings.Find(x => x.UID == symbol.DBUID);
709
                        if (symbolMapping != null)
710
                            leaderLine = symbolMapping.LEADERLINE;
711

  
712
                        // Target Symbol Item 가져오고 Label Modeling
713
                        LMSymbol _TargetItem = dataSource.GetSymbol(sRep);
714
                        LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(symbol.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: _TargetItem.AsLMRepresentation(), IsLeaderVisible: leaderLine);
715

  
716
                        //Leader 선 센터로
717
                        if (_LMLabelPresist != null)
724 718
                        {
725
                            bool result = false;
726
                            foreach (var attributes in dependency.AttributeSets)
719
                            // Target Item에 Label의 Attribute Input
720
                            InputSymbolAttribute(targetItem, symbol.ATTRIBUTES);
721

  
722
                            string OID = _LMLabelPresist.get_GraphicOID();
723
                            DependencyObject dependency = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID] as DependencyObject;
724
                            if (dependency != null)
727 725
                            {
728
                                foreach (var attribute in attributes)
726
                                bool result = false;
727
                                foreach (var attributes in dependency.AttributeSets)
729 728
                                {
730
                                    string name = attribute.Name;
731
                                    string value = attribute.GetValue().ToString();
732
                                    if (name == "DrawingItemType" && value == "LabelPersist")
729
                                    foreach (var attribute in attributes)
733 730
                                    {
734
                                        foreach (DrawingObjectBase drawingObject in dependency.DrawingObjects)
731
                                        string name = attribute.Name;
732
                                        string value = attribute.GetValue().ToString();
733
                                        if (name == "DrawingItemType" && value == "LabelPersist")
735 734
                                        {
736
                                            if (drawingObject.Type == Ingr.RAD2D.ObjectType.igLineString2d)
735
                                            foreach (DrawingObjectBase drawingObject in dependency.DrawingObjects)
737 736
                                            {
738
                                                Ingr.RAD2D.LineString2d lineString2D = drawingObject as Ingr.RAD2D.LineString2d;
739
                                                double prevX = _TargetItem.get_XCoordinate();
740
                                                double prevY = _TargetItem.get_YCoordinate();
741
                                                lineString2D.InsertVertex(lineString2D.VertexCount, prevX, prevY);
742
                                                lineString2D.RemoveVertex(lineString2D.VertexCount);
743
                                                result = true;
744
                                                break;
737
                                                if (drawingObject.Type == Ingr.RAD2D.ObjectType.igLineString2d)
738
                                                {
739
                                                    Ingr.RAD2D.LineString2d lineString2D = drawingObject as Ingr.RAD2D.LineString2d;
740
                                                    double prevX = _TargetItem.get_XCoordinate();
741
                                                    double prevY = _TargetItem.get_YCoordinate();
742
                                                    lineString2D.InsertVertex(lineString2D.VertexCount, prevX, prevY);
743
                                                    lineString2D.RemoveVertex(lineString2D.VertexCount);
744
                                                    result = true;
745
                                                    break;
746
                                                }
745 747
                                            }
746 748
                                        }
749

  
750
                                        if (result)
751
                                            break;
747 752
                                    }
748 753

  
749 754
                                    if (result)
750 755
                                        break;
751 756
                                }
752

  
753
                                if (result)
754
                                    break;
755 757
                            }
758

  
759
                            _LMLabelPresist.Commit();
760
                            ReleaseCOMObjects(_LMLabelPresist);
756 761
                        }
757 762

  
758
                        _LMLabelPresist.Commit();
759
                        ReleaseCOMObjects(_LMLabelPresist);
763
                        ReleaseCOMObjects(_TargetItem);
760 764
                    }
761
                    
762
                    ReleaseCOMObjects(_TargetItem);
763 765
                }
764
            }
765
            else if (targetItem != null && targetItem.GetType() == typeof(Line))
766
            {
767
                Line targetLine = targetItem as Line;
768
                Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(targetLine.SPPID.ModelItemId);
769
                LMConnector connectedLMConnector = FindTargetLMConnectorForLabel(connectorVertices, symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y);
770
                if (connectedLMConnector != null)
766
                else if (targetItem != null && targetItem.GetType() == typeof(Line))
771 767
                {
772
                    // LEADER Line 검사
773
                    bool leaderLine = false;
774
                    SymbolMapping symbolMapping = document.SymbolMappings.Find(x => x.UID == symbol.DBUID);
775
                    if (symbolMapping != null)
776
                        leaderLine = symbolMapping.LEADERLINE;
777

  
778
                    LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(symbol.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: leaderLine);
779
                    if (_LMLabelPresist != null)
768
                    Line targetLine = targetItem as Line;
769
                    Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(targetLine.SPPID.ModelItemId);
770
                    LMConnector connectedLMConnector = FindTargetLMConnectorForLabel(connectorVertices, symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y);
771
                    if (connectedLMConnector != null)
780 772
                    {
781
                        _LMLabelPresist.Commit();
782
                        ReleaseCOMObjects(_LMLabelPresist);
773
                        // LEADER Line 검사
774
                        bool leaderLine = false;
775
                        SymbolMapping symbolMapping = document.SymbolMappings.Find(x => x.UID == symbol.DBUID);
776
                        if (symbolMapping != null)
777
                            leaderLine = symbolMapping.LEADERLINE;
778

  
779
                        LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(symbol.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: leaderLine);
780
                        if (_LMLabelPresist != null)
781
                        {
782
                            _LMLabelPresist.Commit();
783
                            ReleaseCOMObjects(_LMLabelPresist);
784
                        }
785
                        ReleaseCOMObjects(connectedLMConnector);
783 786
                    }
784
                    ReleaseCOMObjects(connectedLMConnector);
785
                }
786 787

  
787
                foreach (var item in connectorVertices)
788
                    if (item.Key != null)
789
                        ReleaseCOMObjects(item.Key);
788
                    foreach (var item in connectorVertices)
789
                        if (item.Key != null)
790
                            ReleaseCOMObjects(item.Key);
791
                }
790 792
            }
791 793

  
792 794
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount);
......
1134 1136

  
1135 1137
            if (_lMConnector != null)
1136 1138
            {
1137
                if (lines.Find(x => x.UID == "d4bea462-44cc-473d-8fe2-fb2e98009578") != null)
1138
                {
1139

  
1140
                }
1141 1139
                bool bStart = false;
1142 1140
                bool bEnd = false;
1143 1141

  
......
1179 1177
        {
1180 1178
            if (symbol != null)
1181 1179
            {
1182
                try
1183
                {
1184
                    string repID = symbol.AsLMRepresentation().Id;
1185
                    string symbolUID = SPPIDUtil.FindSymbolByRepresentationID(document, repID).UID;
1186
                    string lineUID = line.UID;
1180
                string repID = symbol.AsLMRepresentation().Id;
1181
                string symbolUID = SPPIDUtil.FindSymbolByRepresentationID(document, repID).UID;
1182
                string lineUID = line.UID;
1187 1183

  
1188
                    SpecBreak startSpecBreak = document.SpecBreaks.Find(x =>
1189
                    (x.DownStreamUID == symbolUID || x.UpStreamUID == symbolUID) &&
1190
                    (x.DownStreamUID == lineUID || x.UpStreamUID == lineUID));
1184
                SpecBreak startSpecBreak = document.SpecBreaks.Find(x =>
1185
                (x.DownStreamUID == symbolUID || x.UpStreamUID == symbolUID) &&
1186
                (x.DownStreamUID == lineUID || x.UpStreamUID == lineUID));
1191 1187

  
1192
                    EndBreak startEndBreak = document.EndBreaks.Find(x =>
1193
                    (x.OWNER == symbolUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == symbolUID) &&
1194
                    (x.OWNER == lineUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == lineUID));
1188
                EndBreak startEndBreak = document.EndBreaks.Find(x =>
1189
                (x.OWNER == symbolUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == symbolUID) &&
1190
                (x.OWNER == lineUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == lineUID));
1195 1191

  
1196
                    if (startSpecBreak != null || startEndBreak != null)
1197
                        result = true;
1198
                }
1199
                catch (Exception ex)
1200
                {
1201

  
1202
                }
1192
                if (startSpecBreak != null || startEndBreak != null)
1193
                    result = true;
1203 1194
            }
1204 1195
        }
1205 1196
        
......
1212 1203
        /// <param name="endSymbol"></param>
1213 1204
        private void ReModelingLine(List<Line> lines, LMConnector prevLMConnector, LMSymbol startSymbol, LMSymbol endSymbol, bool bStart, bool bEnd)
1214 1205
        {
1215
            
1216 1206
            string symbolPath = string.Empty;
1217 1207
            #region get symbol path
1218 1208
            LMModelItem modelItem = dataSource.GetModelItem(prevLMConnector.ModelItemID);

내보내기 Unified diff

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