개정판 a31a512e
dev issue #000 : minor
Change-Id: Iacf0f5c69ff4e6675a0f771b981e62d62d928aa3
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
267 | 267 |
try |
268 | 268 |
{ |
269 | 269 |
SortBranchLines(); |
270 |
NewLineModeling(item, true); |
|
271 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
270 |
if (EnableBranchModeling(item)) |
|
271 |
{ |
|
272 |
NewLineModeling(item, true); |
|
273 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
274 |
} |
|
275 |
else |
|
276 |
throw new Exception(); |
|
272 | 277 |
} |
273 | 278 |
catch (Exception ex) |
274 | 279 |
{ |
... | ... | |
276 | 281 |
Log.Write("UID : " + item.UID); |
277 | 282 |
Log.Write(ex.Message); |
278 | 283 |
Log.Write(ex.StackTrace); |
284 |
break; |
|
279 | 285 |
} |
280 | 286 |
} |
287 |
|
|
288 |
bool EnableBranchModeling(Line line) |
|
289 |
{ |
|
290 |
bool result = true; |
|
291 |
if (line.CONNECTORS.FindAll(x => x.ConnectedObject != null && |
|
292 |
x.ConnectedObject.GetType() == typeof(Line) && |
|
293 |
string.IsNullOrEmpty(((Line)x.ConnectedObject).SPPID.ModelItemId)).Count > 0) |
|
294 |
result = false; |
|
295 |
|
|
296 |
return result; |
|
297 |
} |
|
281 | 298 |
} |
282 | 299 |
private void RunClearValueInconsistancy() |
283 | 300 |
{ |
... | ... | |
428 | 445 |
{ |
429 | 446 |
Line connLine = connector.ConnectedObject as Line; |
430 | 447 |
if (line.SPPID.ModelItemId != connLine.SPPID.ModelItemId && !string.IsNullOrEmpty(line.SPPID.ModelItemId) && !string.IsNullOrEmpty(connLine.SPPID.ModelItemId)) |
431 |
JoinPipeRunForSameConnector(connLine.SPPID.ModelItemId, line.SPPID.ModelItemId); |
|
448 |
{ |
|
449 |
string survivorId = string.Empty; |
|
450 |
JoinRun(connLine.SPPID.ModelItemId, line.SPPID.ModelItemId, ref survivorId); |
|
451 |
} |
|
452 |
|
|
432 | 453 |
} |
433 | 454 |
} |
434 | 455 |
} |
... | ... | |
439 | 460 |
{ |
440 | 461 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count); |
441 | 462 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "PipeRun Join - 2"); |
463 |
List<string> endModelID = new List<string>(); |
|
442 | 464 |
foreach (var line in document.LINES) |
443 | 465 |
{ |
444 |
JoinRun(line); |
|
466 |
continue; |
|
467 |
if (!endModelID.Contains(line.SPPID.ModelItemId)) |
|
468 |
{ |
|
469 |
while (!endModelID.Contains(line.SPPID.ModelItemId)) |
|
470 |
{ |
|
471 |
string survivorId = string.Empty; |
|
472 |
JoinRunBySameType(line.SPPID.ModelItemId, ref survivorId); |
|
473 |
if (string.IsNullOrEmpty(survivorId)) |
|
474 |
{ |
|
475 |
endModelID.Add(line.SPPID.ModelItemId); |
|
476 |
} |
|
477 |
} |
|
478 |
} |
|
445 | 479 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
446 | 480 |
} |
447 | 481 |
} |
... | ... | |
1924 | 1958 |
string symbolPath = string.Empty; |
1925 | 1959 |
#region get symbol path |
1926 | 1960 |
LMModelItem modelItem = dataSource.GetModelItem(prevLMConnector.ModelItemID); |
1927 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
1928 |
{ |
|
1929 |
if (!DBNull.Value.Equals(rep.get_FileName()) && !string.IsNullOrEmpty(rep.get_FileName())) |
|
1930 |
{ |
|
1931 |
symbolPath = rep.get_FileName(); |
|
1932 |
break; |
|
1933 |
} |
|
1934 |
} |
|
1961 |
symbolPath = GetSPPIDFileName(modelItem); |
|
1935 | 1962 |
#endregion |
1936 | 1963 |
bool diagonal = false; |
1937 | 1964 |
if (line.SlopeType != SlopeType.HORIZONTAL && line.SlopeType != SlopeType.VERTICAL) |
... | ... | |
2182 | 2209 |
string symbolPath = string.Empty; |
2183 | 2210 |
#region get symbol path |
2184 | 2211 |
LMModelItem modelItem = dataSource.GetModelItem(connector.ModelItemID); |
2185 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
2186 |
{ |
|
2187 |
if (!DBNull.Value.Equals(rep.get_FileName()) && !string.IsNullOrEmpty(rep.get_FileName())) |
|
2188 |
{ |
|
2189 |
symbolPath = rep.get_FileName(); |
|
2190 |
break; |
|
2191 |
} |
|
2192 |
} |
|
2212 |
symbolPath = GetSPPIDFileName(modelItem); |
|
2193 | 2213 |
#endregion |
2194 | 2214 |
|
2195 | 2215 |
LMConnector newConnector = null; |
... | ... | |
2496 | 2516 |
/// </summary> |
2497 | 2517 |
/// <param name="modelItemID1"></param> |
2498 | 2518 |
/// <param name="modelItemID2"></param> |
2499 |
private void JoinPipeRunForSameConnector(string modelItemID1, string modelItemID2)
|
|
2519 |
private void JoinRun(string modelId1, string modelId2, ref string survivorId)
|
|
2500 | 2520 |
{ |
2501 | 2521 |
try |
2502 | 2522 |
{ |
2503 |
LMModelItem modelItem1 = dataSource.GetModelItem(modelItemID1);
|
|
2523 |
LMModelItem modelItem1 = dataSource.GetModelItem(modelId1);
|
|
2504 | 2524 |
_LMAItem item1 = modelItem1.AsLMAItem(); |
2505 |
LMModelItem modelItem2 = dataSource.GetModelItem(modelItemID2);
|
|
2525 |
LMModelItem modelItem2 = dataSource.GetModelItem(modelId2);
|
|
2506 | 2526 |
_LMAItem item2 = modelItem2.AsLMAItem(); |
2507 | 2527 |
|
2508 | 2528 |
// item2가 item1으로 조인 |
... | ... | |
2517 | 2537 |
{ |
2518 | 2538 |
beforeID = modelItem2.Id; |
2519 | 2539 |
afterID = modelItem1.Id; |
2540 |
survivorId = afterID; |
|
2520 | 2541 |
} |
2521 | 2542 |
else if (modelItem1.get_ItemStatus() != "Active" && modelItem2.get_ItemStatus() == "Active") |
2522 | 2543 |
{ |
2523 | 2544 |
beforeID = modelItem1.Id; |
2524 | 2545 |
afterID = modelItem2.Id; |
2546 |
survivorId = afterID; |
|
2525 | 2547 |
} |
2548 |
else if (modelItem1.get_ItemStatus() == "Active" && modelItem2.get_ItemStatus() == "Active") |
|
2549 |
survivorId = null; |
|
2526 | 2550 |
else |
2527 | 2551 |
{ |
2528 |
Log.Write("확인 필요한 케이스"); |
|
2552 |
Log.Write("잘못된 경우"); |
|
2553 |
survivorId = null; |
|
2529 | 2554 |
} |
2530 | 2555 |
|
2556 |
|
|
2531 | 2557 |
if (!string.IsNullOrEmpty(beforeID) && !string.IsNullOrEmpty(afterID)) |
2532 | 2558 |
{ |
2533 | 2559 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, beforeID); |
... | ... | |
2547 | 2573 |
} |
2548 | 2574 |
} |
2549 | 2575 |
|
2576 |
private List<string> FindOtherModelItemBySymbolWhereTypePipeRun(LMSymbol symbol, string modelId) |
|
2577 |
{ |
|
2578 |
List<string> modelItemIDs = new List<string>(); |
|
2579 |
foreach (LMConnector connector in symbol.Connect1Connectors) |
|
2580 |
{ |
|
2581 |
LMModelItem modelItem = connector.ModelItemObject; |
|
2582 |
if (modelItem.get_ItemStatus() == "Active" && modelItem.get_ItemTypeName().ToString() == "PipeRun" && modelItem.Id != modelId) |
|
2583 |
modelItemIDs.Add(modelItem.Id); |
|
2584 |
ReleaseCOMObjects(modelItem); |
|
2585 |
ReleaseCOMObjects(connector); |
|
2586 |
} |
|
2587 |
|
|
2588 |
foreach (LMConnector connector in symbol.Connect2Connectors) |
|
2589 |
{ |
|
2590 |
LMModelItem modelItem = connector.ModelItemObject; |
|
2591 |
if (modelItem.get_ItemStatus() == "Active" && modelItem.get_ItemTypeName().ToString() == "PipeRun" && modelItem.Id != modelId) |
|
2592 |
modelItemIDs.Add(modelItem.Id); |
|
2593 |
ReleaseCOMObjects(modelItem); |
|
2594 |
ReleaseCOMObjects(connector); |
|
2595 |
} |
|
2596 |
|
|
2597 |
return modelItemIDs; |
|
2598 |
} |
|
2599 |
|
|
2550 | 2600 |
/// <summary> |
2551 | 2601 |
/// PipeRun의 좌표를 가져오는 메서드 |
2552 | 2602 |
/// </summary> |
... | ... | |
3499 | 3549 |
ReleaseCOMObjects(_LMSymbol); |
3500 | 3550 |
} |
3501 | 3551 |
|
3502 |
private void JoinRun(Line line)
|
|
3552 |
private void JoinRunBySameType(string modelItemId, ref string survivorId)
|
|
3503 | 3553 |
{ |
3504 |
if (!string.IsNullOrEmpty(line.SPPID.ModelItemId)) |
|
3554 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemId); |
|
3555 |
if (modelItem != null) |
|
3505 | 3556 |
{ |
3506 |
//LMModelItem modelItem = dataSource.GetModelItem(line.SPPID.ModelItemId); |
|
3507 |
//foreach (LMRepresentation rep in modelItem.Representations) |
|
3508 |
//{ |
|
3509 |
// if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
3510 |
// { |
|
3511 |
// LMConnector connector = dataSource.GetConnector(rep.Id); |
|
3512 |
// if (connector.ConnectItem1SymbolObject != null && connector.ConnectItem1SymbolObject.get_RepresentationType() != "Branch") |
|
3513 |
// { |
|
3514 |
|
|
3515 |
// } |
|
3516 |
// if (connector.ConnectItem2SymbolObject != null && connector.ConnectItem2SymbolObject.get_RepresentationType() != "Branch") |
|
3517 |
// { |
|
3518 |
|
|
3519 |
// } |
|
3520 |
// } |
|
3521 |
//} |
|
3522 |
|
|
3523 |
|
|
3524 |
////JoinPipeRun() |
|
3557 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
3558 |
{ |
|
3559 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
3560 |
{ |
|
3561 |
LMConnector connector = dataSource.GetConnector(rep.Id); |
|
3562 |
if (connector.ConnectItem1SymbolObject != null && connector.ConnectItem1SymbolObject.get_RepresentationType() != "Branch") |
|
3563 |
{ |
|
3564 |
LMSymbol symbol = connector.ConnectItem1SymbolObject; |
|
3565 |
List<string> modelItemIds = FindOtherModelItemBySymbolWhereTypePipeRun(symbol, modelItem.Id); |
|
3566 |
if (modelItemIds.Count == 1) |
|
3567 |
{ |
|
3568 |
JoinRun(modelItemIds[0], modelItemId, ref survivorId); |
|
3569 |
if (survivorId != null) |
|
3570 |
break; |
|
3571 |
} |
|
3572 |
} |
|
3573 |
if (connector.ConnectItem2SymbolObject != null && connector.ConnectItem2SymbolObject.get_RepresentationType() != "Branch") |
|
3574 |
{ |
|
3575 |
LMSymbol symbol = connector.ConnectItem2SymbolObject; |
|
3576 |
List<string> modelItemIds = FindOtherModelItemBySymbolWhereTypePipeRun(symbol, modelItem.Id); |
|
3577 |
if (modelItemIds.Count == 1) |
|
3578 |
{ |
|
3579 |
JoinRun(modelItemIds[0], modelItemId, ref survivorId); |
|
3580 |
if (survivorId != null) |
|
3581 |
break; |
|
3582 |
} |
|
3583 |
} |
|
3584 |
} |
|
3585 |
} |
|
3525 | 3586 |
} |
3526 | 3587 |
} |
3527 | 3588 |
|
... | ... | |
3755 | 3816 |
return a.SPPID.ORIGINAL_X.CompareTo(b.SPPID.ORIGINAL_X); |
3756 | 3817 |
} |
3757 | 3818 |
|
3819 |
private string GetSPPIDFileName(LMModelItem modelItem) |
|
3820 |
{ |
|
3821 |
string symbolPath = null; |
|
3822 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
3823 |
{ |
|
3824 |
if (!DBNull.Value.Equals(rep.get_FileName()) && !string.IsNullOrEmpty(rep.get_FileName())) |
|
3825 |
{ |
|
3826 |
symbolPath = rep.get_FileName(); |
|
3827 |
break; |
|
3828 |
} |
|
3829 |
} |
|
3830 |
return symbolPath; |
|
3831 |
} |
|
3832 |
|
|
3758 | 3833 |
/// <summary> |
3759 | 3834 |
/// Graphic OID로 해당 Symbol의 크기를 구하여 Zoom |
3760 | 3835 |
/// </summary> |
내보내기 Unified diff