프로젝트

일반

사용자정보

개정판 26c6f818

ID26c6f8187bce12846fb259ed360db768cd60e72e
상위 7b7b0383
하위 e8ada349

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

dev issue #000 : fix bug

Change-Id: I27925c467c388516b67ecccef13d9539f0b0dda1

차이점 보기:

DTI_PID/BaseModel/Model/Document.cs
121 121
                else if (sType == "Black Box System" ||
122 122
                    sType == "GGO_Equipment" ||
123 123
                    sType == "Heat Transfer Equipment" ||
124
                    sType == "Labels - Equipment" ||
125 124
                    sType == "Mechanical" ||
126 125
                    sType == "Other Equipment" ||
127 126
                    sType == "Vessels")
DTI_PID/SPPIDConverter/AutoModeling.cs
120 120
                    {
121 121
                        SPPIDSymbolInfo info = item.SPPID;
122 122
                        Array points = new double[] { 0, item.SPPID.ORIGINAL_X, item.SPPID.ORIGINAL_Y };
123
                        string symbolUID = item.ATTRIBUTES.Find(x => x.ATTRIBUTE == "SYMBOLOWNER").VALUE;
124
                        Symbol symbol = SPPIDUtil.FindObjectByUID(document, symbolUID) as Symbol;
125
                        if (symbol != null)
123
                        string symbolUID = item.ATTRIBUTES.Find(x => x.ATTRIBUTE == "OWNERSYMBOL").VALUE;
124
                        object objectItem = SPPIDUtil.FindObjectByUID(document, symbolUID);
125
                        if (objectItem != null)
126 126
                        {
127
                            LMSymbol _TargetItem = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
128
                            LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(item.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: _TargetItem.AsLMRepresentation(), IsLeaderVisible: true);
129
                            LMModelItem _LMModelItem = _TargetItem.ModelItemObject;
130
                            LMAAttributes _Attributes = _LMModelItem.Attributes;
131 127

  
132
                            foreach (var attribute in item.ATTRIBUTES)
128
                            string sRep = null;
129
                            if (objectItem.GetType() == typeof(Symbol))
130
                                sRep = ((Symbol)objectItem).SPPID.RepresentationId;
131
                            else if (objectItem.GetType() == typeof(Equipment))
132
                                sRep = ((Equipment)objectItem).SPPID.RepresentationId;
133

  
134
                            if (!string.IsNullOrEmpty(sRep))
133 135
                            {
134
                                AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID);
135
                                if (mapping != null)
136
                                LMSymbol _TargetItem = dataSource.GetSymbol(sRep);
137
                                LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(item.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: _TargetItem.AsLMRepresentation(), IsLeaderVisible: true);
138
                                LMModelItem _LMModelItem = _TargetItem.ModelItemObject;
139
                                LMAAttributes _Attributes = _LMModelItem.Attributes;
140

  
141
                                foreach (var attribute in item.ATTRIBUTES)
136 142
                                {
137
                                    LMAAttribute _LMAAttribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
138
                                    if (_LMAAttribute != null)
139
                                        _LMAAttribute.set_Value(attribute.VALUE);
143
                                    if (!string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
144
                                    {
145
                                        AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID);
146
                                        if (mapping != null)
147
                                        {
148
                                            LMAAttribute _LMAAttribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
149
                                            if (mapping.SPPIDATTRIBUTENAME.Contains("Description"))
150
                                            {
151
                                                if (!DBNull.Value.Equals(_LMAAttribute.get_Value()) && !string.IsNullOrEmpty(_LMAAttribute.get_Value()))
152
                                                {
153
                                                    string value = _LMAAttribute.get_Value() + "\n" + attribute.VALUE;
154
                                                    _LMAAttribute.set_Value(value);
155
                                                }
156
                                                else
157
                                                {
158
                                                    _LMAAttribute.set_Value(attribute.VALUE);
159
                                                }
160
                                            }
161
                                            else if (_LMAAttribute != null)
162
                                                _LMAAttribute.set_Value(attribute.VALUE);
163
                                        }
164
                                    }
140 165
                                }
166
                                _LMModelItem.Commit();
167
                                _LMLabelPresist.Commit();
168
                                ReleaseCOMObjects(_TargetItem);
169
                                ReleaseCOMObjects(_LMLabelPresist);
170
                                ReleaseCOMObjects(_LMModelItem);
171
                                ReleaseCOMObjects(_Attributes);
141 172
                            }
142
                            _LMModelItem.Commit();
143
                            _LMLabelPresist.Commit();
144
                            ReleaseCOMObjects(_TargetItem);
145
                            ReleaseCOMObjects(_LMLabelPresist);
146
                            ReleaseCOMObjects(_LMModelItem);
147
                            ReleaseCOMObjects(_Attributes);
148 173
                        }
149 174
                    }
150 175
                }
......
851 876
                double distance = double.MaxValue;
852 877
                foreach (LMConnector connector in _LMSymbol.Avoid1Connectors)
853 878
                {
854
                    dynamic OID = connector.get_GraphicOID();
855
                    DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
856
                    Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
857
                    int verticesCount = lineStringGeometry.VertexCount;
858
                    double[] vertices = null;
859
                    lineStringGeometry.GetVertices(ref verticesCount, ref vertices);
860
                    for (int i = 0; i < verticesCount; i++)
879
                    if (connector.get_ItemStatus() == "Active")
861 880
                    {
862
                        double x = 0;
863
                        double y = 0;
864
                        lineStringGeometry.GetVertex(i + 1, ref x, ref y);
865

  
866
                        double result = SPPIDUtil.CalcPointToPointdDistance(x, y, ownerSymbol.SPPID.ORIGINAL_X, ownerSymbol.SPPID.ORIGINAL_Y);
867
                        if (result < distance)
881
                        dynamic OID = connector.get_GraphicOID();
882
                        DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
883
                        Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
884
                        int verticesCount = lineStringGeometry.VertexCount;
885
                        double[] vertices = null;
886
                        lineStringGeometry.GetVertices(ref verticesCount, ref vertices);
887
                        for (int i = 0; i < verticesCount; i++)
868 888
                        {
869
                            targetLMConnector = connector;
870
                            distance = result;
889
                            double x = 0;
890
                            double y = 0;
891
                            lineStringGeometry.GetVertex(i + 1, ref x, ref y);
892

  
893
                            double result = SPPIDUtil.CalcPointToPointdDistance(x, y, ownerSymbol.SPPID.ORIGINAL_X, ownerSymbol.SPPID.ORIGINAL_Y);
894
                            if (result < distance)
895
                            {
896
                                targetLMConnector = connector;
897
                                distance = result;
898
                            }
871 899
                        }
872 900
                    }
873 901
                }
......
1166 1194
                    foreach (var item in symbol.ATTRIBUTES)
1167 1195
                    {
1168 1196
                        AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID);
1169
                        if (mapping != null)
1197
                        if (mapping != null && !string.IsNullOrEmpty(item.VALUE) && item.VALUE != "None")
1170 1198
                        {
1171 1199
                            LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
1172 1200
                            if (_Attribute != null)
......
1231 1259
                            AttributeMapping mapping = null;
1232 1260
                            foreach (var attribute in attributes)
1233 1261
                            {
1262
                                if (string.IsNullOrEmpty(attribute.VALUE) || attribute.VALUE == "None")
1263
                                    continue;
1264

  
1234 1265
                                 mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME));
1235 1266
                                if (mapping != null)
1236 1267
                                    break;  
......
1242 1273
                                LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: true);
1243 1274
                                if (_LMLabelPersist!=null)
1244 1275
                                {
1276
                                    //
1277
                                    //radApp.ActiveDocument.ActiveSheet.DrawingObjects[_LMLabelPersist.get_GraphicOID().ToString()];
1278

  
1245 1279
                                    _LMLabelPersist.Commit();
1246 1280
                                    ReleaseCOMObjects(_LMLabelPersist);
1247 1281
                                }
DTI_PID/SPPIDConverter/ConverterForm.cs
466 466
        {
467 467
            SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
468 468

  
469
            _SPPIDSymbolPathDT = new DataTable();
470
            _SPPIDSymbolPathDT.Columns.Add("ID");
471
            _SPPIDSymbolPathDT.Columns.Add("Parent");
472
            _SPPIDSymbolPathDT.Columns.Add("Name");
473
            _SPPIDSymbolPathDT.Columns.Add("FullPath");
469
            try
470
            {
471
                _SPPIDSymbolPathDT = new DataTable();
472
                _SPPIDSymbolPathDT.Columns.Add("ID");
473
                _SPPIDSymbolPathDT.Columns.Add("Parent");
474
                _SPPIDSymbolPathDT.Columns.Add("Name");
475
                _SPPIDSymbolPathDT.Columns.Add("FullPath");
474 476

  
475
            if (_SPPIDInfo.Enable)
477
                if (_SPPIDInfo.Enable)
478
                {
479
                    string symbolPath = SPPID_DB.GetPlantPID_T_OPTIONSETTING_Value("Catalog Explorer root path");
480
                    DirectoryInfo info = new DirectoryInfo(symbolPath);
481
                    _SPPIDSymbolPathDT.Rows.Add(new object[] { "0", "-1", info.Name });
482
                    loop(info, "0", symbolPath);
483
                }
484
            }
485
            catch (Exception ex)
476 486
            {
477
                string symbolPath = SPPID_DB.GetPlantPID_T_OPTIONSETTING_Value("Catalog Explorer root path");
478
                DirectoryInfo info = new DirectoryInfo(symbolPath);
479
                _SPPIDSymbolPathDT.Rows.Add(new object[] { "0", "-1", info.Name });
480
                loop(info, "0", symbolPath);
487
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
481 488
            }
482 489
        }
483 490

  
......
545 552
#if DEBUG
546 553
            this.Visible = false;
547 554

  
548
            SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
549
            //SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml");
555
            //SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
556
            SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\Isocynates-325_Page50.xml");
550 557
            //SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\Isocynates-325_Page49.xml");
551 558
            document.SymbolMappings = symbolMappings;
552 559
            document.ChildSymbolMappings = childSymbolMappings;

내보내기 Unified diff

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