프로젝트

일반

사용자정보

개정판 3939eebf

ID3939eebf0f1ee5e4d7f9a63a0b1c8c52867aaff5
상위 4c1bc127
하위 ca214bc3

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

dev issue #000 : JoinRun bug 수정

Change-Id: Icb2dbe53d63b5555cc6cf08407805bb8b4e1d14e

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
71 71
                        maxY = Math.Max(y2, maxY);
72 72
                    }
73 73
                }
74

  
75
                document.SetSPPIDLocation(maxX, maxY);
76

  
77
                // Equipment Modeling
78
                foreach (Equipment equipment in document.Equipments)
79
                    EquipmentModeling(equipment);
80
                
81
                // LineRun Symbol Modeling
82
                foreach (LineNumber lineNumber in document.LINENUMBERS)
83
                    foreach (LineRun run in lineNumber.RUNS)
84
                        SymbolModelingByRun(run);
85
                
86
                // TrimLineRun Symbol Modeling
87
                foreach (TrimLine trimLine in document.TRIMLINES)
88
                    foreach (LineRun run in trimLine.RUNS)
89
                        SymbolModelingByRun(run);
90
                
91
                // LineRun Line Modeling
92
                foreach (LineNumber lineNumber in document.LINENUMBERS)
93
                    foreach (LineRun run in lineNumber.RUNS)
94
                        LineModelingByRun(run);
95
                
96
                // TrimLineRun Line Modeling
97
                foreach (TrimLine trimLine in document.TRIMLINES)
98
                    foreach (LineRun run in trimLine.RUNS)
99
                        LineModelingByRun(run);
100
                
101
                // Branch Line Modeling
102
                foreach (var item in BranchLines)
103
                    BranchLineModeling(item);
104
                
105
                // EndBreak Modeling
106
                foreach (var item in document.EndBreaks)
107
                    EndBreakModeling(item);
108
                
109
                // LineNumber Modeling
110
                foreach (var item in document.LINENUMBERS)
111
                    LineNumberModeling(item);
112

  
113
                // Note Modeling
114
                foreach (var item in document.NOTES)
115
                    NoteModeling(item);
116

  
117
                // Text Modeling
118
                foreach (var item in document.TEXTINFOS)
119
                    TextModeling(item);
120

  
121
                // Input LineNumber Attribute
122
                foreach (var item in document.LINENUMBERS)
123
                    InputLineNumberAttribute(item);
124

  
125
                // Input Symbol Attribute
126
                foreach (var item in document.SYMBOLS)
127
                    InputSymbolAttribute(item);
128

  
129
                #region 임시 Label
130
                foreach (var item in document.SYMBOLS)
74
                if (maxX != 0 && maxY != 0)
131 75
                {
132
                    if (item.SPPID.MAPPINGNAME.Contains("Labels - "))
76
                    document.SetSPPIDLocation(maxX, maxY);
77

  
78
                    // Equipment Modeling
79
                    foreach (Equipment equipment in document.Equipments)
80
                        EquipmentModeling(equipment);
81

  
82
                    // LineRun Symbol Modeling
83
                    foreach (LineNumber lineNumber in document.LINENUMBERS)
84
                        foreach (LineRun run in lineNumber.RUNS)
85
                            SymbolModelingByRun(run);
86

  
87
                    // TrimLineRun Symbol Modeling
88
                    foreach (TrimLine trimLine in document.TRIMLINES)
89
                        foreach (LineRun run in trimLine.RUNS)
90
                            SymbolModelingByRun(run);
91

  
92
                    // LineRun Line Modeling
93
                    foreach (LineNumber lineNumber in document.LINENUMBERS)
94
                        foreach (LineRun run in lineNumber.RUNS)
95
                            LineModelingByRun(run);
96

  
97
                    // TrimLineRun Line Modeling
98
                    foreach (TrimLine trimLine in document.TRIMLINES)
99
                        foreach (LineRun run in trimLine.RUNS)
100
                            LineModelingByRun(run);
101

  
102
                    // Branch Line Modeling
103
                    foreach (var item in BranchLines)
104
                        BranchLineModeling(item);
105

  
106
                    // EndBreak Modeling
107
                    foreach (var item in document.EndBreaks)
108
                        EndBreakModeling(item);
109

  
110
                    // LineNumber Modeling
111
                    foreach (var item in document.LINENUMBERS)
112
                        LineNumberModeling(item);
113

  
114
                    // Note Modeling
115
                    foreach (var item in document.NOTES)
116
                        NoteModeling(item);
117

  
118
                    // Text Modeling
119
                    foreach (var item in document.TEXTINFOS)
120
                        TextModeling(item);
121

  
122
                    // LineRun Line Join
123
                    foreach (LineNumber lineNumber in document.LINENUMBERS)
124
                        foreach (LineRun run in lineNumber.RUNS)
125
                            JoinRunLine(run);
126

  
127
                    // TrimLineRun Line Join
128
                    foreach (TrimLine trimLine in document.TRIMLINES)
129
                        foreach (LineRun run in trimLine.RUNS)
130
                            JoinRunLine(run);
131

  
132
                    // Input LineNumber Attribute
133
                    foreach (var item in document.LINENUMBERS)
134
                        InputLineNumberAttribute(item);
135

  
136
                    // Input Symbol Attribute
137
                    foreach (var item in document.SYMBOLS)
138
                        InputSymbolAttribute(item);
139

  
140
                    #region 임시 Label
141
                    foreach (var item in document.SYMBOLS)
133 142
                    {
134
                        SPPIDSymbolInfo info = item.SPPID;
135
                        Array points = new double[] { 0, item.SPPID.ORIGINAL_X, item.SPPID.ORIGINAL_Y };
136
                        BaseModel.Attribute itemAttribute = item.ATTRIBUTES.Find(x => x.ATTRIBUTE == "OWNERSYMBOL");
137
                        if (itemAttribute == null)
138
                            continue;
139
                        string symbolUID = item.ATTRIBUTES.Find(x => x.ATTRIBUTE == "OWNERSYMBOL").VALUE;
140
                        object objectItem = SPPIDUtil.FindObjectByUID(document, symbolUID);
141
                        if (objectItem != null)
143
                        if (item.SPPID.MAPPINGNAME.Contains("Labels - "))
142 144
                        {
145
                            SPPIDSymbolInfo info = item.SPPID;
146
                            Array points = new double[] { 0, item.SPPID.ORIGINAL_X, item.SPPID.ORIGINAL_Y };
147
                            BaseModel.Attribute itemAttribute = item.ATTRIBUTES.Find(x => x.ATTRIBUTE == "OWNERSYMBOL");
148
                            if (itemAttribute == null)
149
                                continue;
150
                            string symbolUID = item.ATTRIBUTES.Find(x => x.ATTRIBUTE == "OWNERSYMBOL").VALUE;
151
                            object objectItem = SPPIDUtil.FindObjectByUID(document, symbolUID);
152
                            if (objectItem != null)
153
                            {
143 154

  
144
                            string sRep = null;
145
                            if (objectItem.GetType() == typeof(Symbol))
146
                                sRep = ((Symbol)objectItem).SPPID.RepresentationId;
147
                            else if (objectItem.GetType() == typeof(Equipment))
148
                                sRep = ((Equipment)objectItem).SPPID.RepresentationId;
155
                                string sRep = null;
156
                                if (objectItem.GetType() == typeof(Symbol))
157
                                    sRep = ((Symbol)objectItem).SPPID.RepresentationId;
158
                                else if (objectItem.GetType() == typeof(Equipment))
159
                                    sRep = ((Equipment)objectItem).SPPID.RepresentationId;
149 160

  
150
                            if (!string.IsNullOrEmpty(sRep))
151
                            {
152
                                LMSymbol _TargetItem = dataSource.GetSymbol(sRep);
153
                                LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(item.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: _TargetItem.AsLMRepresentation(), IsLeaderVisible: true);
154
                                LMModelItem _LMModelItem = _TargetItem.ModelItemObject;
155
                                LMAAttributes _Attributes = _LMModelItem.Attributes;
156
                                
157
                                foreach (var attribute in item.ATTRIBUTES)
161
                                if (!string.IsNullOrEmpty(sRep))
158 162
                                {
159
                                    if (!string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
163
                                    LMSymbol _TargetItem = dataSource.GetSymbol(sRep);
164
                                    LMLabelPersist _LMLabelPresist = _placement.PIDPlaceLabel(item.SPPID.MAPPINGNAME, ref points, Rotation: 0, LabeledItem: _TargetItem.AsLMRepresentation(), IsLeaderVisible: true);
165
                                    LMModelItem _LMModelItem = _TargetItem.ModelItemObject;
166
                                    LMAAttributes _Attributes = _LMModelItem.Attributes;
167

  
168
                                    foreach (var attribute in item.ATTRIBUTES)
160 169
                                    {
161
                                        AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID);
162
                                        if (mapping != null)
170
                                        if (!string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
163 171
                                        {
164
                                            LMAAttribute _LMAAttribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
165
                                            if (mapping.SPPIDATTRIBUTENAME.Contains("Description"))
172
                                            AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID);
173
                                            if (mapping != null)
166 174
                                            {
167
                                                if (!DBNull.Value.Equals(_LMAAttribute.get_Value()) && !string.IsNullOrEmpty(_LMAAttribute.get_Value()))
175
                                                LMAAttribute _LMAAttribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
176
                                                if (mapping.SPPIDATTRIBUTENAME.Contains("Description"))
168 177
                                                {
169
                                                    string value = _LMAAttribute.get_Value() + "\n" + attribute.VALUE;
170
                                                    _LMAAttribute.set_Value(value);
178
                                                    if (!DBNull.Value.Equals(_LMAAttribute.get_Value()) && !string.IsNullOrEmpty(_LMAAttribute.get_Value()))
179
                                                    {
180
                                                        string value = _LMAAttribute.get_Value() + "\n" + attribute.VALUE;
181
                                                        _LMAAttribute.set_Value(value);
182
                                                    }
183
                                                    else
184
                                                    {
185
                                                        _LMAAttribute.set_Value(attribute.VALUE);
186
                                                    }
171 187
                                                }
172
                                                else
173
                                                {
188
                                                else if (_LMAAttribute != null)
174 189
                                                    _LMAAttribute.set_Value(attribute.VALUE);
175
                                                }
176 190
                                            }
177
                                            else if (_LMAAttribute != null)
178
                                                _LMAAttribute.set_Value(attribute.VALUE);
179 191
                                        }
180 192
                                    }
181
                                }
182 193

  
183
                                string OID = _LMLabelPresist.get_GraphicOID();
184
                                DependencyObject dependency = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID] as DependencyObject;
185
                                if (dependency != null)
186
                                {
187
                                    bool result = false;
188
                                    foreach (var attributes in dependency.AttributeSets)
194
                                    string OID = _LMLabelPresist.get_GraphicOID();
195
                                    DependencyObject dependency = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID] as DependencyObject;
196
                                    if (dependency != null)
189 197
                                    {
190
                                        foreach (var attribute in attributes)
198
                                        bool result = false;
199
                                        foreach (var attributes in dependency.AttributeSets)
191 200
                                        {
192
                                            string name = attribute.Name;
193
                                            string value = attribute.GetValue().ToString();
194
                                            if (name == "DrawingItemType" && value == "LabelPersist")
201
                                            foreach (var attribute in attributes)
195 202
                                            {
196
                                                foreach (DrawingObjectBase drawingObject in dependency.DrawingObjects)
203
                                                string name = attribute.Name;
204
                                                string value = attribute.GetValue().ToString();
205
                                                if (name == "DrawingItemType" && value == "LabelPersist")
197 206
                                                {
198
                                                    if (drawingObject.Type == Ingr.RAD2D.ObjectType.igLineString2d)
207
                                                    foreach (DrawingObjectBase drawingObject in dependency.DrawingObjects)
199 208
                                                    {
200
                                                        Ingr.RAD2D.LineString2d lineString2D = drawingObject as Ingr.RAD2D.LineString2d;
201
                                                        double prevX = _TargetItem.get_XCoordinate();
202
                                                        double prevY = _TargetItem.get_YCoordinate();
203
                                                        lineString2D.InsertVertex(lineString2D.VertexCount, prevX, prevY);
204
                                                        lineString2D.RemoveVertex(lineString2D.VertexCount);
205
                                                        result = true;
206
                                                        break;
209
                                                        if (drawingObject.Type == Ingr.RAD2D.ObjectType.igLineString2d)
210
                                                        {
211
                                                            Ingr.RAD2D.LineString2d lineString2D = drawingObject as Ingr.RAD2D.LineString2d;
212
                                                            double prevX = _TargetItem.get_XCoordinate();
213
                                                            double prevY = _TargetItem.get_YCoordinate();
214
                                                            lineString2D.InsertVertex(lineString2D.VertexCount, prevX, prevY);
215
                                                            lineString2D.RemoveVertex(lineString2D.VertexCount);
216
                                                            result = true;
217
                                                            break;
218
                                                        }
207 219
                                                    }
208 220
                                                }
221

  
222
                                                if (result)
223
                                                    break;
209 224
                                            }
210 225

  
211 226
                                            if (result)
212 227
                                                break;
213 228
                                        }
214

  
215
                                        if (result)
216
                                            break;
217 229
                                    }
218
                                }
219 230

  
220 231

  
221
                                _LMModelItem.Commit();
222
                                _LMLabelPresist.Commit();
223
                                ReleaseCOMObjects(_TargetItem);
224
                                ReleaseCOMObjects(_LMLabelPresist);
225
                                ReleaseCOMObjects(_LMModelItem);
226
                                ReleaseCOMObjects(_Attributes);
232
                                    _LMModelItem.Commit();
233
                                    _LMLabelPresist.Commit();
234
                                    ReleaseCOMObjects(_TargetItem);
235
                                    ReleaseCOMObjects(_LMLabelPresist);
236
                                    ReleaseCOMObjects(_LMModelItem);
237
                                    ReleaseCOMObjects(_Attributes);
238
                                }
227 239
                            }
228 240
                        }
229 241
                    }
242
                    #endregion
230 243
                }
231
                #endregion
232

  
233
                // LineRun Line Join
234
                foreach (LineNumber lineNumber in document.LINENUMBERS)
235
                    foreach (LineRun run in lineNumber.RUNS)
236
                        JoinRunLine(run);
237

  
238
                // TrimLineRun Line Join
239
                foreach (TrimLine trimLine in document.TRIMLINES)
240
                    foreach (LineRun run in trimLine.RUNS)
241
                        JoinRunLine(run);
242 244
            }
243 245
            catch (Exception ex)
244 246
            {
......
247 249
            finally
248 250
            {
249 251
                application.ActiveWindow.Fit();
250

  
252
                
251 253
                if (newDrawing != null)
254
                {
255
                    radApp.ActiveDocument.SaveOnClose = false;
256
                    radApp.ActiveDocument.Save();
252 257
                    ReleaseCOMObjects(newDrawing);
258
                }
253 259

  
254 260
                ReleaseCOMObjects(dataSource);
255 261
                ReleaseCOMObjects(_placement);
......
1200 1206
                _placement.PIDRemovePlacement(targetLMConnector.AsLMRepresentation());
1201 1207
                _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs);
1202 1208

  
1203
                foreach (var line in lines)
1204
                    line.SPPID.ModelItemId = _LMConnector.ModelItemID;
1205

  
1206 1209
                array = new double[] { 0, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y };
1207 1210
                _LMLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, Rotation: 0, LabeledItem: _LMConnector.AsLMRepresentation(), IsLeaderVisible: true);
1211

  
1212
                AutoJoinPipeRun(_LMConnector.ModelItemID);
1213
                foreach (var line in lines)
1214
                    line.SPPID.ModelItemId = _LMConnector.ModelItemID;
1208 1215
            }
1209 1216

  
1210 1217

  
......
1236 1243
                _placement.PIDJoinRuns(ref item1, ref item2);
1237 1244
                item1.Commit();
1238 1245
                item2.Commit();
1246

  
1247
                List<Line> lines = SPPIDUtil.FindLinesByModelId(document, fromModelItemId);
1248
                foreach (var line in lines)
1249
                    line.SPPID.ModelItemId = toModelItemId;
1239 1250
            }
1240 1251
            catch (Exception ex)
1241 1252
            {
......
1289 1300
                    Line line = item as Line;
1290 1301
                    AutoJoinPipeRun(line.SPPID.ModelItemId);
1291 1302
                    modelItemId = line.SPPID.ModelItemId;
1292
                    //if (modelItemId != line.SPPID.ModelItemId)
1293
                    //{
1294
                        
1295
                    //}
1296 1303
                }
1297 1304
            }
1298 1305
        }
......
1499 1506

  
1500 1507
                Array points = new double[] { 0, x, y };
1501 1508
                LMLabelPersist _LmLabelPresist = _placement.PIDPlaceLabel(lineNumber.SPPID.MAPPINGNAME, ref points, Rotation: lineNumber.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: false);
1502
                
1503 1509

  
1504 1510
                foreach (var item in connectorVertices)
1505 1511
                    ReleaseCOMObjects(item.Key);

내보내기 Unified diff

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