개정판 b01e7456
dev issue #000 : Branch Line 수정
Change-Id: If7f360d806c40ab646ae3c6ad7296f32083123e8
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
88 | 88 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText); |
89 | 89 |
|
90 | 90 |
// Equipment Modeling |
91 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Equipments Modeling"); |
|
92 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.Equipments.Count); |
|
93 |
foreach (Equipment item in document.Equipments) |
|
94 |
{ |
|
95 |
try |
|
96 |
{ |
|
97 |
EquipmentModeling(item); |
|
98 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, document.Equipments.FindAll(x => !string.IsNullOrEmpty(x.SPPID.RepresentationId)).Count); |
|
99 |
} |
|
100 |
catch (Exception ex) |
|
101 |
{ |
|
102 |
Log.Write("Error in EquipmentModeling"); |
|
103 |
Log.Write("UID : " + item.UID); |
|
104 |
Log.Write(ex.Message); |
|
105 |
Log.Write(ex.StackTrace); |
|
106 |
} |
|
107 |
} |
|
91 |
RunEquipmentModeling(); |
|
108 | 92 |
|
109 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Symbol Modeling"); |
|
110 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count); |
|
111 |
prioritySymbols = GetPrioritySymbol(); |
|
112 |
foreach (var item in prioritySymbols) |
|
113 |
{ |
|
114 |
try |
|
115 |
{ |
|
116 |
SymbolModelingBySymbol(item); |
|
117 |
} |
|
118 |
catch (Exception ex) |
|
119 |
{ |
|
120 |
Log.Write("Error in SymbolModelingByPriority"); |
|
121 |
Log.Write("UID : " + item.UID); |
|
122 |
Log.Write(ex.Message); |
|
123 |
Log.Write(ex.StackTrace); |
|
124 |
} |
|
125 |
} |
|
93 |
// Symbol Modeling |
|
94 |
RunSymbolModeling(); |
|
126 | 95 |
|
127 | 96 |
// LineRun Line Modeling |
128 |
SetPriorityLine(); |
|
129 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling"); |
|
130 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count); |
|
131 |
foreach (var item in document.LINES) |
|
132 |
{ |
|
133 |
try |
|
134 |
{ |
|
135 |
NewLineModeling(item); |
|
136 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
137 |
} |
|
138 |
catch (Exception ex) |
|
139 |
{ |
|
140 |
Log.Write("Error in NewLineModeling"); |
|
141 |
Log.Write("UID : " + item.UID); |
|
142 |
Log.Write(ex.Message); |
|
143 |
Log.Write(ex.StackTrace); |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Branch Lines Modeling"); |
|
148 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, NewBranchLines.Count); |
|
149 |
int branchCount = NewBranchLines.Count; |
|
150 |
while (NewBranchLines.Count > 0) |
|
151 |
{ |
|
152 |
Line item = NewBranchLines[0]; |
|
153 |
try |
|
154 |
{ |
|
155 |
SortBranchLines(); |
|
156 |
NewLineModeling(item, true); |
|
157 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
158 |
} |
|
159 |
catch (Exception ex) |
|
160 |
{ |
|
161 |
Log.Write("Error in NewLineModeling"); |
|
162 |
Log.Write("UID : " + item.UID); |
|
163 |
Log.Write(ex.Message); |
|
164 |
Log.Write(ex.StackTrace); |
|
165 |
} |
|
166 |
} |
|
167 |
|
|
168 |
#region Clear Nominal Diameter |
|
169 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count + document.LINES.Count); |
|
170 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Attribute"); |
|
171 |
SetSystemEditingCommand(false); |
|
172 |
List<string> endClearModelItemID = new List<string>(); |
|
173 |
for (int i = 0; i < document.LINES.Count; i++) |
|
174 |
{ |
|
175 |
Line item = document.LINES[i]; |
|
176 |
string modelItemID = item.SPPID.ModelItemId; |
|
177 |
if (!string.IsNullOrEmpty(modelItemID)) |
|
178 |
{ |
|
179 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemID); |
|
180 |
if (modelItem != null) |
|
181 |
{ |
|
182 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
183 |
if (attribute != null) |
|
184 |
attribute.set_Value(DBNull.Value); |
|
97 |
RunLineModeling(); |
|
185 | 98 |
|
186 |
modelItem.Commit(); |
|
187 |
ReleaseCOMObjects(modelItem); |
|
188 |
} |
|
189 |
} |
|
190 |
if (!endClearModelItemID.Contains(modelItemID)) |
|
191 |
endClearModelItemID.Add(modelItemID); |
|
192 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
193 |
} |
|
99 |
// Branch Line Modeling |
|
100 |
RunBranchLineModeling(); |
|
194 | 101 |
|
195 |
for (int i = 0; i < document.SYMBOLS.Count; i++) |
|
196 |
{ |
|
197 |
Symbol item = document.SYMBOLS[i]; |
|
198 |
string repID = item.SPPID.RepresentationId; |
|
199 |
string modelItemID = item.SPPID.ModelItemID; |
|
200 |
if (!string.IsNullOrEmpty(modelItemID)) |
|
201 |
{ |
|
202 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemID); |
|
203 |
if (modelItem != null) |
|
204 |
{ |
|
205 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
206 |
if (attribute != null) |
|
207 |
attribute.set_Value(DBNull.Value); |
|
208 |
attribute = modelItem.Attributes["PipingPoint1.NominalDiameter"]; |
|
209 |
if (attribute != null) |
|
210 |
attribute.set_Value(DBNull.Value); |
|
211 |
attribute = modelItem.Attributes["PipingPoint2.NominalDiameter"]; |
|
212 |
if (attribute != null) |
|
213 |
attribute.set_Value(DBNull.Value); |
|
214 |
modelItem.Commit(); |
|
215 |
|
|
216 |
modelItem.Commit(); |
|
217 |
ReleaseCOMObjects(modelItem); |
|
218 |
} |
|
219 |
} |
|
220 |
if (!string.IsNullOrEmpty(repID)) |
|
221 |
{ |
|
222 |
LMSymbol symbol = dataSource.GetSymbol(repID); |
|
223 |
if (symbol != null) |
|
224 |
{ |
|
225 |
foreach (LMConnector connector in symbol.Connect1Connectors) |
|
226 |
{ |
|
227 |
if (connector.get_ItemStatus() == "Active" && !endClearModelItemID.Contains(connector.ModelItemID)) |
|
228 |
{ |
|
229 |
endClearModelItemID.Add(connector.ModelItemID); |
|
230 |
LMModelItem modelItem = connector.ModelItemObject; |
|
231 |
if (modelItem != null) |
|
232 |
{ |
|
233 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
234 |
if (attribute != null) |
|
235 |
attribute.set_Value(DBNull.Value); |
|
102 |
// Clear Attribute |
|
103 |
RunClearAttribute(); |
|
236 | 104 |
|
237 |
modelItem.Commit(); |
|
238 |
ReleaseCOMObjects(modelItem); |
|
239 |
} |
|
240 |
} |
|
241 |
} |
|
242 |
foreach (LMConnector connector in symbol.Connect2Connectors) |
|
243 |
{ |
|
244 |
if (connector.get_ItemStatus() == "Active" && !endClearModelItemID.Contains(connector.ModelItemID)) |
|
245 |
{ |
|
246 |
endClearModelItemID.Add(connector.ModelItemID); |
|
247 |
LMModelItem modelItem = connector.ModelItemObject; |
|
248 |
if (modelItem != null) |
|
249 |
{ |
|
250 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
251 |
if (attribute != null) |
|
252 |
attribute.set_Value(DBNull.Value); |
|
105 |
// EndBreak Modeling |
|
106 |
RunEndBreakModeling(); |
|
253 | 107 |
|
254 |
modelItem.Commit(); |
|
255 |
ReleaseCOMObjects(modelItem); |
|
256 |
} |
|
257 |
} |
|
258 |
} |
|
259 |
ReleaseCOMObjects(symbol); |
|
260 |
} |
|
261 |
} |
|
262 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
263 |
} |
|
264 |
SetSystemEditingCommand(true); |
|
265 |
#endregion |
|
108 |
// SpecBreak Modeling |
|
109 |
RunSpecBreakModeling(); |
|
266 | 110 |
|
267 |
// EndBreak Modeling |
|
268 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.EndBreaks.Count); |
|
269 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "EndBreaks Modeling"); |
|
270 |
foreach (var item in document.EndBreaks) |
|
271 |
try |
|
272 |
{ |
|
273 |
EndBreakModeling(item); |
|
274 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
275 |
if (string.IsNullOrEmpty(item.SPPID.ModelItemID)) |
|
276 |
Log.Write("Fail modeling endbreak UID : " + item.UID); |
|
277 |
} |
|
278 |
catch (Exception ex) |
|
279 |
{ |
|
280 |
Log.Write("Error in EndBreakModeling"); |
|
281 |
Log.Write("UID : " + item.UID); |
|
282 |
Log.Write(ex.Message); |
|
283 |
Log.Write(ex.StackTrace); |
|
284 |
} |
|
111 |
|
|
285 | 112 |
|
286 | 113 |
|
287 |
// SpecBreak Modeling |
|
288 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SpecBreaks.Count); |
|
289 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "SpecBreaks Modeling"); |
|
290 |
foreach (var item in document.SpecBreaks) |
|
291 |
try |
|
292 |
{ |
|
293 |
SpecBreakModeling(item); |
|
294 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
295 |
if (string.IsNullOrEmpty(item.SPPID.ModelItemID)) |
|
296 |
Log.Write("Fail modeling specbreak UID : " + item.UID); |
|
297 |
} |
|
298 |
catch (Exception ex) |
|
299 |
{ |
|
300 |
Log.Write("Error in SpecBreakModeling"); |
|
301 |
Log.Write("UID : " + item.UID); |
|
302 |
Log.Write(ex.Message); |
|
303 |
Log.Write(ex.StackTrace); |
|
304 |
} |
|
114 |
|
|
115 |
|
|
305 | 116 |
|
306 | 117 |
|
307 | 118 |
//// LineNumber Modeling |
... | ... | |
506 | 317 |
} |
507 | 318 |
} |
508 | 319 |
} |
320 |
private void RunEquipmentModeling() |
|
321 |
{ |
|
322 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Equipments Modeling"); |
|
323 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.Equipments.Count); |
|
324 |
foreach (Equipment item in document.Equipments) |
|
325 |
{ |
|
326 |
try |
|
327 |
{ |
|
328 |
EquipmentModeling(item); |
|
329 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, document.Equipments.FindAll(x => !string.IsNullOrEmpty(x.SPPID.RepresentationId)).Count); |
|
330 |
} |
|
331 |
catch (Exception ex) |
|
332 |
{ |
|
333 |
Log.Write("Error in EquipmentModeling"); |
|
334 |
Log.Write("UID : " + item.UID); |
|
335 |
Log.Write(ex.Message); |
|
336 |
Log.Write(ex.StackTrace); |
|
337 |
} |
|
338 |
} |
|
339 |
} |
|
340 |
private void RunSymbolModeling() |
|
341 |
{ |
|
342 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Symbol Modeling"); |
|
343 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count); |
|
344 |
prioritySymbols = GetPrioritySymbol(); |
|
345 |
foreach (var item in prioritySymbols) |
|
346 |
{ |
|
347 |
try |
|
348 |
{ |
|
349 |
SymbolModelingBySymbol(item); |
|
350 |
} |
|
351 |
catch (Exception ex) |
|
352 |
{ |
|
353 |
Log.Write("Error in SymbolModelingByPriority"); |
|
354 |
Log.Write("UID : " + item.UID); |
|
355 |
Log.Write(ex.Message); |
|
356 |
Log.Write(ex.StackTrace); |
|
357 |
} |
|
358 |
} |
|
359 |
} |
|
360 |
private void RunLineModeling() |
|
361 |
{ |
|
362 |
SetPriorityLine(); |
|
363 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling"); |
|
364 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count); |
|
365 |
foreach (var item in document.LINES) |
|
366 |
{ |
|
367 |
try |
|
368 |
{ |
|
369 |
NewLineModeling(item); |
|
370 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
371 |
} |
|
372 |
catch (Exception ex) |
|
373 |
{ |
|
374 |
Log.Write("Error in NewLineModeling"); |
|
375 |
Log.Write("UID : " + item.UID); |
|
376 |
Log.Write(ex.Message); |
|
377 |
Log.Write(ex.StackTrace); |
|
378 |
} |
|
379 |
} |
|
380 |
} |
|
381 |
private void RunBranchLineModeling() |
|
382 |
{ |
|
383 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Branch Lines Modeling"); |
|
384 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, NewBranchLines.Count); |
|
385 |
int branchCount = NewBranchLines.Count; |
|
386 |
while (NewBranchLines.Count > 0) |
|
387 |
{ |
|
388 |
Line item = NewBranchLines[0]; |
|
389 |
try |
|
390 |
{ |
|
391 |
SortBranchLines(); |
|
392 |
NewLineModeling(item, true); |
|
393 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
394 |
} |
|
395 |
catch (Exception ex) |
|
396 |
{ |
|
397 |
Log.Write("Error in NewLineModeling"); |
|
398 |
Log.Write("UID : " + item.UID); |
|
399 |
Log.Write(ex.Message); |
|
400 |
Log.Write(ex.StackTrace); |
|
401 |
} |
|
402 |
} |
|
403 |
} |
|
404 |
private void RunClearAttribute() |
|
405 |
{ |
|
406 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count + document.LINES.Count); |
|
407 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Attribute"); |
|
408 |
SetSystemEditingCommand(false); |
|
409 |
List<string> endClearModelItemID = new List<string>(); |
|
410 |
for (int i = 0; i < document.LINES.Count; i++) |
|
411 |
{ |
|
412 |
Line item = document.LINES[i]; |
|
413 |
string modelItemID = item.SPPID.ModelItemId; |
|
414 |
if (!string.IsNullOrEmpty(modelItemID)) |
|
415 |
{ |
|
416 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemID); |
|
417 |
if (modelItem != null) |
|
418 |
{ |
|
419 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
420 |
if (attribute != null) |
|
421 |
attribute.set_Value(DBNull.Value); |
|
422 |
|
|
423 |
modelItem.Commit(); |
|
424 |
ReleaseCOMObjects(modelItem); |
|
425 |
} |
|
426 |
} |
|
427 |
if (!endClearModelItemID.Contains(modelItemID)) |
|
428 |
endClearModelItemID.Add(modelItemID); |
|
429 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
430 |
} |
|
431 |
for (int i = 0; i < document.SYMBOLS.Count; i++) |
|
432 |
{ |
|
433 |
Symbol item = document.SYMBOLS[i]; |
|
434 |
string repID = item.SPPID.RepresentationId; |
|
435 |
string modelItemID = item.SPPID.ModelItemID; |
|
436 |
if (!string.IsNullOrEmpty(modelItemID)) |
|
437 |
{ |
|
438 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemID); |
|
439 |
if (modelItem != null) |
|
440 |
{ |
|
441 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
442 |
if (attribute != null) |
|
443 |
attribute.set_Value(DBNull.Value); |
|
444 |
attribute = modelItem.Attributes["PipingPoint1.NominalDiameter"]; |
|
445 |
if (attribute != null) |
|
446 |
attribute.set_Value(DBNull.Value); |
|
447 |
attribute = modelItem.Attributes["PipingPoint2.NominalDiameter"]; |
|
448 |
if (attribute != null) |
|
449 |
attribute.set_Value(DBNull.Value); |
|
450 |
modelItem.Commit(); |
|
451 |
|
|
452 |
modelItem.Commit(); |
|
453 |
ReleaseCOMObjects(modelItem); |
|
454 |
} |
|
455 |
} |
|
456 |
if (!string.IsNullOrEmpty(repID)) |
|
457 |
{ |
|
458 |
LMSymbol symbol = dataSource.GetSymbol(repID); |
|
459 |
if (symbol != null) |
|
460 |
{ |
|
461 |
foreach (LMConnector connector in symbol.Connect1Connectors) |
|
462 |
{ |
|
463 |
if (connector.get_ItemStatus() == "Active" && !endClearModelItemID.Contains(connector.ModelItemID)) |
|
464 |
{ |
|
465 |
endClearModelItemID.Add(connector.ModelItemID); |
|
466 |
LMModelItem modelItem = connector.ModelItemObject; |
|
467 |
if (modelItem != null) |
|
468 |
{ |
|
469 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
470 |
if (attribute != null) |
|
471 |
attribute.set_Value(DBNull.Value); |
|
472 |
|
|
473 |
modelItem.Commit(); |
|
474 |
ReleaseCOMObjects(modelItem); |
|
475 |
} |
|
476 |
} |
|
477 |
} |
|
478 |
foreach (LMConnector connector in symbol.Connect2Connectors) |
|
479 |
{ |
|
480 |
if (connector.get_ItemStatus() == "Active" && !endClearModelItemID.Contains(connector.ModelItemID)) |
|
481 |
{ |
|
482 |
endClearModelItemID.Add(connector.ModelItemID); |
|
483 |
LMModelItem modelItem = connector.ModelItemObject; |
|
484 |
if (modelItem != null) |
|
485 |
{ |
|
486 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
487 |
if (attribute != null) |
|
488 |
attribute.set_Value(DBNull.Value); |
|
489 |
|
|
490 |
modelItem.Commit(); |
|
491 |
ReleaseCOMObjects(modelItem); |
|
492 |
} |
|
493 |
} |
|
494 |
} |
|
495 |
ReleaseCOMObjects(symbol); |
|
496 |
} |
|
497 |
} |
|
498 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
499 |
} |
|
500 |
SetSystemEditingCommand(true); |
|
501 |
} |
|
502 |
private void RunEndBreakModeling() |
|
503 |
{ |
|
504 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.EndBreaks.Count); |
|
505 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "EndBreaks Modeling"); |
|
506 |
foreach (var item in document.EndBreaks) |
|
507 |
try |
|
508 |
{ |
|
509 |
EndBreakModeling(item); |
|
510 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
511 |
if (string.IsNullOrEmpty(item.SPPID.ModelItemID)) |
|
512 |
Log.Write("Fail modeling endbreak UID : " + item.UID); |
|
513 |
} |
|
514 |
catch (Exception ex) |
|
515 |
{ |
|
516 |
Log.Write("Error in EndBreakModeling"); |
|
517 |
Log.Write("UID : " + item.UID); |
|
518 |
Log.Write(ex.Message); |
|
519 |
Log.Write(ex.StackTrace); |
|
520 |
} |
|
521 |
} |
|
522 |
private void RunSpecBreakModeling() |
|
523 |
{ |
|
524 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SpecBreaks.Count); |
|
525 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "SpecBreaks Modeling"); |
|
526 |
foreach (var item in document.SpecBreaks) |
|
527 |
try |
|
528 |
{ |
|
529 |
SpecBreakModeling(item); |
|
530 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
531 |
if (string.IsNullOrEmpty(item.SPPID.ModelItemID)) |
|
532 |
Log.Write("Fail modeling specbreak UID : " + item.UID); |
|
533 |
} |
|
534 |
catch (Exception ex) |
|
535 |
{ |
|
536 |
Log.Write("Error in SpecBreakModeling"); |
|
537 |
Log.Write("UID : " + item.UID); |
|
538 |
Log.Write(ex.Message); |
|
539 |
Log.Write(ex.StackTrace); |
|
540 |
} |
|
541 |
} |
|
509 | 542 |
|
510 | 543 |
/// <summary> |
511 | 544 |
/// 도면 생성 메서드 |
... | ... | |
2519 | 2552 |
if (i == 0) |
2520 | 2553 |
{ |
2521 | 2554 |
LMSymbol connSymbol = targetConnector.ConnectItem1SymbolObject; |
2522 |
if (connSymbol == null ||
|
|
2523 |
(connSymbol != null && connSymbol.get_ItemStatus() == "Active"))
|
|
2555 |
bool containZeroLength = false;
|
|
2556 |
if (connSymbol != null)
|
|
2524 | 2557 |
{ |
2525 |
bool containZeroLength = false; |
|
2526 | 2558 |
foreach (LMConnector connector in connSymbol.Connect1Connectors) |
2527 | 2559 |
{ |
2528 |
if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
|
|
2560 |
if (connector.get_ItemStatus() == "Active" && Convert.ToBoolean(connector.get_IsZeroLength()) == true)
|
|
2529 | 2561 |
containZeroLength = true; |
2530 | 2562 |
} |
2531 | 2563 |
foreach (LMConnector connector in connSymbol.Connect2Connectors) |
2532 | 2564 |
{ |
2533 |
if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
|
|
2565 |
if (connector.get_ItemStatus() == "Active" && Convert.ToBoolean(connector.get_IsZeroLength()) == true)
|
|
2534 | 2566 |
containZeroLength = true; |
2535 | 2567 |
} |
2568 |
} |
|
2569 |
|
|
2570 |
if (connSymbol == null || |
|
2571 |
(connSymbol != null && connSymbol.get_ItemStatus() == "Active" && connSymbol.get_RepresentationType() != "Branch") || |
|
2572 |
containZeroLength) |
|
2573 |
{ |
|
2574 |
bool bCalcX = false; |
|
2575 |
bool bCalcY = false; |
|
2576 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
|
2577 |
bCalcX = true; |
|
2578 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
|
2579 |
bCalcY = true; |
|
2580 |
else |
|
2581 |
{ |
|
2582 |
bCalcX = true; |
|
2583 |
bCalcY = true; |
|
2584 |
} |
|
2536 | 2585 |
|
2537 |
if (connSymbol.get_RepresentationType() != "Branch" || |
|
2538 |
containZeroLength) |
|
2586 |
if (bCalcX) |
|
2539 | 2587 |
{ |
2540 |
bool bCalcX = false; |
|
2541 |
bool bCalcY = false; |
|
2542 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
|
2543 |
bCalcX = true; |
|
2544 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
|
2545 |
bCalcY = true; |
|
2588 |
double nextX = targetVertices[i + 1][0]; |
|
2589 |
double newX = 0; |
|
2590 |
if (nextX > tempX) |
|
2591 |
{ |
|
2592 |
newX = tempX + gridSetting.Length; |
|
2593 |
if (newX > nextX) |
|
2594 |
newX = (point[0] + nextX) / 2; |
|
2595 |
} |
|
2546 | 2596 |
else |
2547 | 2597 |
{ |
2548 |
bCalcX = true; |
|
2549 |
bCalcY = true; |
|
2598 |
newX = tempX - gridSetting.Length; |
|
2599 |
if (newX < nextX) |
|
2600 |
newX = (point[0] + nextX) / 2; |
|
2550 | 2601 |
} |
2602 |
resultPoint = new double[] { newX, resultPoint[1] }; |
|
2603 |
} |
|
2551 | 2604 |
|
2552 |
if (bCalcX) |
|
2605 |
if (bCalcY) |
|
2606 |
{ |
|
2607 |
double nextY = targetVertices[i + 1][1]; |
|
2608 |
double newY = 0; |
|
2609 |
if (nextY > tempY) |
|
2553 | 2610 |
{ |
2554 |
double nextX = targetVertices[i + 1][0]; |
|
2555 |
double newX = 0; |
|
2556 |
if (nextX > tempX) |
|
2557 |
{ |
|
2558 |
newX = tempX + gridSetting.Length; |
|
2559 |
if (newX > nextX) |
|
2560 |
newX = (point[0] + nextX) / 2; |
|
2561 |
} |
|
2562 |
else |
|
2563 |
{ |
|
2564 |
newX = tempX - gridSetting.Length; |
|
2565 |
if (newX < nextX) |
|
2566 |
newX = (point[0] + nextX) / 2; |
|
2567 |
} |
|
2568 |
resultPoint = new double[] { newX, resultPoint[1] }; |
|
2611 |
newY = tempY + gridSetting.Length; |
|
2612 |
if (newY > nextY) |
|
2613 |
newY = (point[1] + nextY) / 2; |
|
2569 | 2614 |
} |
2570 |
|
|
2571 |
if (bCalcY) |
|
2615 |
else |
|
2572 | 2616 |
{ |
2573 |
double nextY = targetVertices[i + 1][1]; |
|
2574 |
double newY = 0; |
|
2575 |
if (nextY > tempY) |
|
2576 |
{ |
|
2577 |
newY = tempY + gridSetting.Length; |
|
2578 |
if (newY > nextY) |
|
2579 |
newY = (point[1] + nextY) / 2; |
|
2580 |
} |
|
2581 |
else |
|
2582 |
{ |
|
2583 |
newY = tempY - gridSetting.Length; |
|
2584 |
if (newY < nextY) |
|
2585 |
newY = (point[1] + nextY) / 2; |
|
2586 |
} |
|
2587 |
resultPoint = new double[] { resultPoint[0], newY }; |
|
2617 |
newY = tempY - gridSetting.Length; |
|
2618 |
if (newY < nextY) |
|
2619 |
newY = (point[1] + nextY) / 2; |
|
2588 | 2620 |
} |
2621 |
resultPoint = new double[] { resultPoint[0], newY }; |
|
2589 | 2622 |
} |
2590 | 2623 |
} |
2591 | 2624 |
} |
2592 | 2625 |
else if (i == targetVertices.Count - 1) |
2593 | 2626 |
{ |
2594 | 2627 |
LMSymbol connSymbol = targetConnector.ConnectItem2SymbolObject; |
2595 |
if (connSymbol == null ||
|
|
2596 |
(connSymbol != null && connSymbol.get_ItemStatus() == "Active"))
|
|
2628 |
bool containZeroLength = false;
|
|
2629 |
if (connSymbol != null)
|
|
2597 | 2630 |
{ |
2598 |
bool containZeroLength = false; |
|
2599 | 2631 |
foreach (LMConnector connector in connSymbol.Connect1Connectors) |
2600 | 2632 |
{ |
2601 |
if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
|
|
2633 |
if (connector.get_ItemStatus() == "Active" && Convert.ToBoolean(connector.get_IsZeroLength()) == true)
|
|
2602 | 2634 |
containZeroLength = true; |
2603 | 2635 |
} |
2604 | 2636 |
foreach (LMConnector connector in connSymbol.Connect2Connectors) |
2605 | 2637 |
{ |
2606 |
if (connector.get_ItemStatus() == "Active" && connector.get_IsZeroLength() == true)
|
|
2638 |
if (connector.get_ItemStatus() == "Active" && Convert.ToBoolean(connector.get_IsZeroLength()) == true)
|
|
2607 | 2639 |
containZeroLength = true; |
2608 | 2640 |
} |
2641 |
} |
|
2642 |
|
|
2643 |
if (connSymbol == null || |
|
2644 |
(connSymbol != null && connSymbol.get_ItemStatus() == "Active" && connSymbol.get_RepresentationType() != "Branch") || |
|
2645 |
containZeroLength) |
|
2646 |
{ |
|
2647 |
bool bCalcX = false; |
|
2648 |
bool bCalcY = false; |
|
2649 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
|
2650 |
bCalcX = true; |
|
2651 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
|
2652 |
bCalcY = true; |
|
2653 |
else |
|
2654 |
{ |
|
2655 |
bCalcX = true; |
|
2656 |
bCalcY = true; |
|
2657 |
} |
|
2609 | 2658 |
|
2610 |
if (connSymbol.get_RepresentationType() != "Branch" || |
|
2611 |
containZeroLength) |
|
2659 |
if (bCalcX) |
|
2612 | 2660 |
{ |
2613 |
bool bCalcX = false; |
|
2614 |
bool bCalcY = false; |
|
2615 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
|
2616 |
bCalcX = true; |
|
2617 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
|
2618 |
bCalcY = true; |
|
2661 |
double nextX = targetVertices[i - 1][0]; |
|
2662 |
double newX = 0; |
|
2663 |
if (nextX > tempX) |
|
2664 |
{ |
|
2665 |
newX = tempX + gridSetting.Length; |
|
2666 |
if (newX > nextX) |
|
2667 |
newX = (point[0] + nextX) / 2; |
|
2668 |
} |
|
2619 | 2669 |
else |
2620 | 2670 |
{ |
2621 |
bCalcX = true; |
|
2622 |
bCalcY = true; |
|
2671 |
newX = tempX - gridSetting.Length; |
|
2672 |
if (newX < nextX) |
|
2673 |
newX = (point[0] + nextX) / 2; |
|
2623 | 2674 |
} |
2675 |
resultPoint = new double[] { newX, resultPoint[1] }; |
|
2676 |
} |
|
2624 | 2677 |
|
2625 |
if (bCalcX) |
|
2678 |
if (bCalcY) |
|
2679 |
{ |
|
2680 |
double nextY = targetVertices[i - 1][1]; |
|
2681 |
double newY = 0; |
|
2682 |
if (nextY > tempY) |
|
2626 | 2683 |
{ |
2627 |
double nextX = targetVertices[i - 1][0]; |
|
2628 |
double newX = 0; |
|
2629 |
if (nextX > tempX) |
|
2630 |
{ |
|
2631 |
newX = tempX + gridSetting.Length; |
|
2632 |
if (newX > nextX) |
|
2633 |
newX = (point[0] + nextX) / 2; |
|
2634 |
} |
|
2635 |
else |
|
2636 |
{ |
|
2637 |
newX = tempX - gridSetting.Length; |
|
2638 |
if (newX < nextX) |
|
2639 |
newX = (point[0] + nextX) / 2; |
|
2640 |
} |
|
2641 |
resultPoint = new double[] { newX, resultPoint[1] }; |
|
2684 |
newY = tempY + gridSetting.Length; |
|
2685 |
if (newY > nextY) |
|
2686 |
newY = (point[1] + nextY) / 2; |
|
2642 | 2687 |
} |
2643 |
|
|
2644 |
if (bCalcY) |
|
2688 |
else |
|
2645 | 2689 |
{ |
2646 |
double nextY = targetVertices[i - 1][1]; |
|
2647 |
double newY = 0; |
|
2648 |
if (nextY > tempY) |
|
2649 |
{ |
|
2650 |
newY = tempY + gridSetting.Length; |
|
2651 |
if (newY > nextY) |
|
2652 |
newY = (point[1] + nextY) / 2; |
|
2653 |
} |
|
2654 |
else |
|
2655 |
{ |
|
2656 |
newY = tempY - gridSetting.Length; |
|
2657 |
if (newY < nextY) |
|
2658 |
newY = (point[1] + nextY) / 2; |
|
2659 |
} |
|
2660 |
resultPoint = new double[] { resultPoint[0], newY }; |
|
2690 |
newY = tempY - gridSetting.Length; |
|
2691 |
if (newY < nextY) |
|
2692 |
newY = (point[1] + nextY) / 2; |
|
2661 | 2693 |
} |
2694 |
resultPoint = new double[] { resultPoint[0], newY }; |
|
2662 | 2695 |
} |
2663 | 2696 |
} |
2664 | 2697 |
} |
내보내기 Unified diff