개정판 644f40b3
dev issue #1169 : flow direction check 완료
Change-Id: I038cd308a9f9bbaf2adacc03158e88ad141c73cd
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
39 | 39 |
|
40 | 40 |
List<Line> NewBranchLines = new List<Line>(); |
41 | 41 |
List<Tuple<string, Line, Line>> BranchLines = new List<Tuple<string, Line, Line>>(); |
42 |
List<string> ZeroLengthSymbolToSymbolModelItemID = new List<string>(); |
|
42 | 43 |
List<string> ZeroLengthModelItemID = new List<string>(); |
43 | 44 |
List<string> ZeroLengthModelItemIDReverse = new List<string>(); |
44 | 45 |
List<Symbol> prioritySymbols; |
... | ... | |
642 | 643 |
} |
643 | 644 |
private void RunFlowDirection() |
644 | 645 |
{ |
645 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count + ZeroLengthModelItemID.Count + ZeroLengthModelItemIDReverse.Count); |
|
646 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, |
|
647 |
document.LINES.Count + ZeroLengthModelItemID.Count + ZeroLengthModelItemIDReverse.Count + ZeroLengthSymbolToSymbolModelItemID.Count); |
|
646 | 648 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Check Flow Direction"); |
647 | 649 |
foreach (var line in document.LINES) |
648 | 650 |
{ |
651 |
if (line.UID == "87017512-2c8a-4a55-930e-4c0cdb4cd050") |
|
652 |
{ |
|
653 |
|
|
654 |
} |
|
649 | 655 |
if (!string.IsNullOrEmpty(line.SPPID.ModelItemId)) |
650 | 656 |
{ |
651 | 657 |
LMModelItem modelItem = dataSource.GetModelItem(line.SPPID.ModelItemId); |
652 |
if (modelItem != null) |
|
658 |
if (modelItem != null && modelItem.get_ItemStatus() == "Active")
|
|
653 | 659 |
{ |
654 | 660 |
LMAAttribute attribute = modelItem.Attributes["FlowDirection"]; |
655 | 661 |
if (attribute != null) |
... | ... | |
670 | 676 |
{ |
671 | 677 |
LMModelItem zeroLengthModelItem = dataSource.GetModelItem(modelId); |
672 | 678 |
LMAAttribute attribute = zeroLengthModelItem.Attributes["FlowDirection"]; |
673 |
if (attribute != null) |
|
679 |
if (attribute != null && zeroLengthModelItem.get_ItemStatus() == "Active")
|
|
674 | 680 |
{ |
675 | 681 |
attribute.set_Value("End 1 is upstream (Inlet)"); |
676 | 682 |
zeroLengthModelItem.Commit(); |
... | ... | |
685 | 691 |
{ |
686 | 692 |
LMModelItem zeroLengthModelItem = dataSource.GetModelItem(modelId); |
687 | 693 |
LMAAttribute attribute = zeroLengthModelItem.Attributes["FlowDirection"]; |
688 |
if (attribute != null) |
|
694 |
if (attribute != null && zeroLengthModelItem.get_ItemStatus() == "Active")
|
|
689 | 695 |
{ |
690 | 696 |
attribute.set_Value("End 1 is downstream (Outlet)"); |
691 | 697 |
zeroLengthModelItem.Commit(); |
... | ... | |
696 | 702 |
ReleaseCOMObjects(zeroLengthModelItem); |
697 | 703 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
698 | 704 |
} |
705 |
foreach (var modelId in ZeroLengthSymbolToSymbolModelItemID) |
|
706 |
{ |
|
707 |
SetFlowDirectionByLine(modelId); |
|
708 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
709 |
} |
|
699 | 710 |
} |
700 | 711 |
|
701 | 712 |
private void SetFlowDirectionByLine(string lineModelItemID) |
702 | 713 |
{ |
703 | 714 |
LMModelItem modelItem = dataSource.GetModelItem(lineModelItemID); |
704 |
if (modelItem != null) |
|
715 |
if (modelItem != null && modelItem.get_ItemStatus() == "Active")
|
|
705 | 716 |
{ |
706 | 717 |
LMAAttribute attribute = modelItem.Attributes["FlowDirection"]; |
707 | 718 |
if (attribute != null && !DBNull.Value.Equals(attribute.get_Value())) |
... | ... | |
2265 | 2276 |
|
2266 | 2277 |
_placement.PIDRemovePlacement(connector.AsLMRepresentation()); |
2267 | 2278 |
newConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
2279 |
ZeroLengthSymbolToSymbolModelItemID.Add(newConnector.ModelItemID); |
|
2268 | 2280 |
} |
2269 | 2281 |
else |
2270 | 2282 |
{ |
... | ... | |
2538 | 2550 |
/// <summary> |
2539 | 2551 |
/// FromModelItem을 ToModelItem으로 PipeRunJoin하는 메서드 |
2540 | 2552 |
/// </summary> |
2541 |
/// <param name="fromModelItemId"></param>
|
|
2542 |
/// <param name="toModelItemId"></param>
|
|
2543 |
private void JoinPipeRun(string fromModelItemId, string toModelItemId)
|
|
2553 |
/// <param name="modelItemID1"></param>
|
|
2554 |
/// <param name="modelItemID2"></param>
|
|
2555 |
private void JoinPipeRun(string modelItemID1, string modelItemID2)
|
|
2544 | 2556 |
{ |
2545 |
LMModelItem modelItem1 = dataSource.GetModelItem(toModelItemId);
|
|
2557 |
LMModelItem modelItem1 = dataSource.GetModelItem(modelItemID2);
|
|
2546 | 2558 |
_LMAItem item1 = modelItem1.AsLMAItem(); |
2547 |
LMModelItem modelItem2 = dataSource.GetModelItem(fromModelItemId);
|
|
2559 |
LMModelItem modelItem2 = dataSource.GetModelItem(modelItemID1);
|
|
2548 | 2560 |
_LMAItem item2 = modelItem2.AsLMAItem(); |
2549 | 2561 |
|
2550 | 2562 |
// item2가 item1으로 조인 |
... | ... | |
2552 | 2564 |
item1.Commit(); |
2553 | 2565 |
item2.Commit(); |
2554 | 2566 |
|
2555 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, fromModelItemId); |
|
2567 |
string beforeID = string.Empty; |
|
2568 |
string afterID = string.Empty; |
|
2569 |
|
|
2570 |
if (modelItem1.get_ItemStatus() == "Active" && modelItem2.get_ItemStatus() != "Active") |
|
2571 |
{ |
|
2572 |
beforeID = modelItem2.Id; |
|
2573 |
afterID = modelItem1.Id; |
|
2574 |
} |
|
2575 |
else if (modelItem1.get_ItemStatus() != "Active" && modelItem2.get_ItemStatus() == "Active") |
|
2576 |
{ |
|
2577 |
beforeID = modelItem1.Id; |
|
2578 |
afterID = modelItem2.Id; |
|
2579 |
} |
|
2580 |
else |
|
2581 |
{ |
|
2582 |
throw new Exception("확인 필요한 케이스"); |
|
2583 |
} |
|
2584 |
|
|
2585 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, beforeID); |
|
2556 | 2586 |
foreach (var line in lines) |
2557 |
line.SPPID.ModelItemId = toModelItemId;
|
|
2587 |
line.SPPID.ModelItemId = afterID;
|
|
2558 | 2588 |
|
2559 | 2589 |
ReleaseCOMObjects(modelItem1); |
2560 | 2590 |
ReleaseCOMObjects(item1); |
내보내기 Unified diff