개정판 fae4f386
dev issue #507 : join 방식 변경 / ZeroLength 사용위치 변경
Change-Id: I4ad49cc865f173cadbb1f88dc41444dab34aba13
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
99 | 99 |
RunLineModeling(); |
100 | 100 |
// Clear Attribute |
101 | 101 |
RunClearNominalDiameter(); |
102 |
//// Clear Attribute |
|
103 |
//RunClearValueInconsistancy(); |
|
104 |
// EndBreak Modeling |
|
105 |
RunEndBreakModeling(); |
|
106 |
// SpecBreak Modeling |
|
107 |
RunSpecBreakModeling(); |
|
108 | 102 |
// Join SameConnector |
109 | 103 |
RunJoinRunForSameConnector(); |
110 | 104 |
// Join Run |
111 | 105 |
RunJoinRun(); |
112 | 106 |
// Check FlowDirection |
113 | 107 |
RunFlowDirection(); |
108 |
// EndBreak Modeling |
|
109 |
RunEndBreakModeling(); |
|
110 |
// SpecBreak Modeling |
|
111 |
RunSpecBreakModeling(); |
|
114 | 112 |
//Line Number Modeling |
115 | 113 |
RunLineNumberModeling(); |
116 | 114 |
// Note Modeling |
... | ... | |
559 | 557 |
} |
560 | 558 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
561 | 559 |
} |
560 |
|
|
561 |
foreach (var line in document.LINES) |
|
562 |
line.SPPID.Representations = GetRepresentations(line.SPPID.ModelItemId); |
|
562 | 563 |
} |
563 | 564 |
private void RunJoinRun() |
564 | 565 |
{ |
... | ... | |
1061 | 1062 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: _TargetItem); |
1062 | 1063 |
|
1063 | 1064 |
if (_LMSymbol != null && _TargetItem != null) |
1064 |
{ |
|
1065 | 1065 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id; |
1066 | 1066 |
|
1067 |
if (SPPIDUtil.IsSegment(document, symbol, targetSymbol)) |
|
1068 |
{ |
|
1069 |
LMConnector reModelingConnector = FindBreakLineTarget(symbol, targetSymbol); |
|
1070 |
if (reModelingConnector != null) |
|
1071 |
ReModelingLMConnector(reModelingConnector); |
|
1072 |
} |
|
1073 |
} |
|
1074 |
|
|
1075 | 1067 |
ReleaseCOMObjects(_TargetItem); |
1076 | 1068 |
} |
1077 | 1069 |
else |
... | ... | |
1918 | 1910 |
{ |
1919 | 1911 |
_lMConnector.Commit(); |
1920 | 1912 |
groupLine.SPPID.ModelItemId = _lMConnector.ModelItemID; |
1913 |
|
|
1921 | 1914 |
bool bRemodelingStart = false; |
1922 | 1915 |
if (_LMSymbolStart != null) |
1923 | 1916 |
NeedReModeling(groupLine, _LMSymbolStart, ref bRemodelingStart); |
... | ... | |
2439 | 2432 |
{ |
2440 | 2433 |
object ownerObj = SPPIDUtil.FindObjectByUID(document, endBreak.OWNER); |
2441 | 2434 |
object connectedItem = SPPIDUtil.FindObjectByUID(document, endBreak.PROPERTIES.Find(x => x.ATTRIBUTE == "Connected Item").VALUE); |
2435 |
|
|
2442 | 2436 |
LMConnector targetLMConnector = FindBreakLineTarget(ownerObj, connectedItem); |
2437 |
if (ownerObj.GetType() == typeof(Symbol) && connectedItem.GetType() == typeof(Symbol) && targetLMConnector != null) |
|
2438 |
targetLMConnector = ReModelingZeroLengthLMConnectorForSegment(targetLMConnector); |
|
2443 | 2439 |
|
2444 | 2440 |
if (targetLMConnector != null) |
2445 | 2441 |
{ |
... | ... | |
2463 | 2459 |
} |
2464 | 2460 |
} |
2465 | 2461 |
|
2466 |
private LMConnector ReModelingLMConnector(LMConnector connector, string changeSymbolPath = null)
|
|
2462 |
private LMConnector ReModelingZeroLengthLMConnectorForSegment(LMConnector connector, string changeSymbolPath = null)
|
|
2467 | 2463 |
{ |
2468 | 2464 |
string symbolPath = string.Empty; |
2469 | 2465 |
#region get symbol path |
... | ... | |
2510 | 2506 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, x, y); |
2511 | 2507 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, x, y); |
2512 | 2508 |
} |
2513 |
|
|
2509 |
string oldModelItemId = connector.ModelItemID; |
|
2514 | 2510 |
_placement.PIDRemovePlacement(connector.AsLMRepresentation()); |
2515 | 2511 |
newConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
2516 | 2512 |
newConnector.Commit(); |
2517 | 2513 |
ZeroLengthSymbolToSymbolModelItemID.Add(newConnector.ModelItemID); |
2518 | 2514 |
if (!string.IsNullOrEmpty(flowDirection)) |
2519 | 2515 |
newConnector.ModelItemObject.Attributes["FlowDirection"].set_Value(flowDirection); |
2520 |
} |
|
2521 |
else |
|
2522 |
{ |
|
2523 |
List<double[]> vertices = new List<double[]>(); |
|
2524 |
for (int i = 1; i <= verticesCount; i++) |
|
2525 |
{ |
|
2526 |
double x = 0; |
|
2527 |
double y = 0; |
|
2528 |
lineStringGeometry.GetVertex(i, ref x, ref y); |
|
2529 |
vertices.Add(new double[] { x, y }); |
|
2530 |
} |
|
2516 |
ReleaseCOMObjects(connector); |
|
2531 | 2517 |
|
2532 |
for (int i = 0; i < vertices.Count; i++)
|
|
2518 |
foreach (var line in document.LINES.FindAll(z => z.SPPID.ModelItemId == oldModelItemId))
|
|
2533 | 2519 |
{ |
2534 |
double[] points = vertices[i]; |
|
2535 |
if (i == 0) |
|
2536 |
{ |
|
2537 |
if (connector.ConnectItem1SymbolObject != null) |
|
2538 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, points[0], points[1]); |
|
2539 |
else |
|
2540 |
placeRunInputs.AddPoint(points[0], points[1]); |
|
2541 |
} |
|
2542 |
else if (i == vertices.Count - 1) |
|
2520 |
foreach (var repId in line.SPPID.Representations) |
|
2543 | 2521 |
{ |
2544 |
if (connector.ConnectItem2SymbolObject != null) |
|
2545 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, points[0], points[1]); |
|
2546 |
else |
|
2547 |
placeRunInputs.AddPoint(points[0], points[1]); |
|
2522 |
LMConnector _connector = dataSource.GetConnector(repId); |
|
2523 |
if (_connector != null && _connector.get_ItemStatus() == "Active") |
|
2524 |
{ |
|
2525 |
if (line.SPPID.ModelItemId != _connector.ModelItemID) |
|
2526 |
{ |
|
2527 |
line.SPPID.ModelItemId = _connector.ModelItemID; |
|
2528 |
line.SPPID.Representations = GetRepresentations(line.SPPID.ModelItemId); |
|
2529 |
} |
|
2530 |
} |
|
2531 |
ReleaseCOMObjects(_connector); |
|
2532 |
_connector = null; |
|
2548 | 2533 |
} |
2549 |
else |
|
2550 |
placeRunInputs.AddPoint(points[0], points[1]); |
|
2551 | 2534 |
} |
2552 |
|
|
2553 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, connector.ModelItemID); |
|
2554 |
|
|
2555 |
_placement.PIDRemovePlacement(connector.AsLMRepresentation()); |
|
2556 |
newConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
|
2557 |
newConnector.Commit(); |
|
2558 |
foreach (var line in lines) |
|
2559 |
line.SPPID.ModelItemId = newConnector.ModelItemID; |
|
2560 | 2535 |
} |
2561 | 2536 |
|
2562 |
|
|
2563 | 2537 |
return newConnector; |
2564 | 2538 |
} |
2565 | 2539 |
|
... | ... | |
2576 | 2550 |
downStreamObj != null) |
2577 | 2551 |
{ |
2578 | 2552 |
LMConnector targetLMConnector = FindBreakLineTarget(upStreamObj, downStreamObj); |
2553 |
if (upStreamObj.GetType() == typeof(Symbol) && downStreamObj.GetType() == typeof(Symbol) && targetLMConnector != null) |
|
2554 |
targetLMConnector = ReModelingZeroLengthLMConnectorForSegment(targetLMConnector); |
|
2555 |
|
|
2579 | 2556 |
if (targetLMConnector != null) |
2580 | 2557 |
{ |
2581 | 2558 |
foreach (var attribute in specBreak.ATTRIBUTES) |
... | ... | |
3021 | 2998 |
|
3022 | 2999 |
private List<string> FindOtherModelItemBySymbolWhereTypePipeRun(LMSymbol symbol, string modelId) |
3023 | 3000 |
{ |
3024 |
List<string> modelItemIDs = new List<string>(); |
|
3001 |
List<string> temp = new List<string>(); |
|
3002 |
List<LMConnector> connectors = new List<LMConnector>(); |
|
3025 | 3003 |
foreach (LMConnector connector in symbol.Avoid1Connectors) |
3026 | 3004 |
{ |
3005 |
if (connector.get_ItemStatus() != "Active") |
|
3006 |
continue; |
|
3007 |
|
|
3027 | 3008 |
LMModelItem modelItem = connector.ModelItemObject; |
3028 |
if (modelItem.get_ItemStatus() == "Active" && modelItem.get_ItemTypeName().ToString() == "PipeRun" && modelItem.Id != modelId) |
|
3029 |
modelItemIDs.Add(modelItem.Id); |
|
3009 |
LMSymbol connOtherSymbol = FindOtherConnectedSymbol(connector); |
|
3010 |
if (modelItem.get_ItemStatus() == "Active" && modelItem.get_ItemTypeName().ToString() == "PipeRun" && modelItem.Id != modelId && !temp.Contains(modelItem.Id)) |
|
3011 |
temp.Add(modelItem.Id); |
|
3012 |
|
|
3013 |
if (temp.Contains(modelItem.Id) && |
|
3014 |
connOtherSymbol != null && |
|
3015 |
connOtherSymbol.get_RepresentationType() == "Branch" && |
|
3016 |
Convert.ToBoolean(connector.get_IsZeroLength())) |
|
3017 |
temp.Remove(modelItem.Id); |
|
3018 |
|
|
3019 |
|
|
3020 |
if (temp.Contains(modelItem.Id)) |
|
3021 |
connectors.Add(connector); |
|
3022 |
ReleaseCOMObjects(connOtherSymbol); |
|
3023 |
connOtherSymbol = null; |
|
3030 | 3024 |
ReleaseCOMObjects(modelItem); |
3031 |
ReleaseCOMObjects(connector);
|
|
3025 |
modelItem = null;
|
|
3032 | 3026 |
} |
3033 | 3027 |
|
3034 | 3028 |
foreach (LMConnector connector in symbol.Avoid2Connectors) |
3035 | 3029 |
{ |
3030 |
if (connector.get_ItemStatus() != "Active") |
|
3031 |
continue; |
|
3032 |
|
|
3036 | 3033 |
LMModelItem modelItem = connector.ModelItemObject; |
3037 |
if (modelItem.get_ItemStatus() == "Active" && modelItem.get_ItemTypeName().ToString() == "PipeRun" && modelItem.Id != modelId) |
|
3038 |
modelItemIDs.Add(modelItem.Id); |
|
3034 |
LMSymbol connOtherSymbol = FindOtherConnectedSymbol(connector); |
|
3035 |
if (modelItem.get_ItemStatus() == "Active" && modelItem.get_ItemTypeName().ToString() == "PipeRun" && modelItem.Id != modelId && !temp.Contains(modelItem.Id)) |
|
3036 |
temp.Add(modelItem.Id); |
|
3037 |
|
|
3038 |
if (temp.Contains(modelItem.Id) && |
|
3039 |
connOtherSymbol != null && |
|
3040 |
connOtherSymbol.get_RepresentationType() == "Branch" && |
|
3041 |
Convert.ToBoolean(connector.get_IsZeroLength())) |
|
3042 |
temp.Remove(modelItem.Id); |
|
3043 |
|
|
3044 |
if (temp.Contains(modelItem.Id)) |
|
3045 |
connectors.Add(connector); |
|
3046 |
ReleaseCOMObjects(connOtherSymbol); |
|
3047 |
connOtherSymbol = null; |
|
3039 | 3048 |
ReleaseCOMObjects(modelItem); |
3040 |
ReleaseCOMObjects(connector);
|
|
3049 |
modelItem = null;
|
|
3041 | 3050 |
} |
3042 | 3051 |
|
3043 | 3052 |
|
3044 | 3053 |
List<string> result = new List<string>(); |
3045 |
modelItemIDs = modelItemIDs.Distinct().ToList(); |
|
3046 | 3054 |
string originalName = GetSPPIDFileName(modelId); |
3047 |
bool existZeroLength = false; |
|
3048 |
foreach (var item in modelItemIDs) |
|
3055 |
foreach (var connector in connectors) |
|
3049 | 3056 |
{ |
3050 |
string fileName = GetSPPIDFileName(item);
|
|
3057 |
string fileName = GetSPPIDFileName(connector.ModelItemID);
|
|
3051 | 3058 |
if (originalName == fileName) |
3052 |
result.Add(item);
|
|
3059 |
result.Add(connector.ModelItemID);
|
|
3053 | 3060 |
else |
3054 | 3061 |
{ |
3055 |
LMConnector connector = GetLMConnectorOnlyOne(item); |
|
3056 |
if (connector != null && Convert.ToBoolean(connector.get_IsZeroLength()) && connector.LabelPersists.Count == 0) |
|
3062 |
if (document.LINES.Find(x => x.SPPID.ModelItemId == connector.ModelItemID) == null && Convert.ToBoolean(connector.get_IsZeroLength())) |
|
3063 |
result.Add(connector.ModelItemID); |
|
3064 |
else |
|
3057 | 3065 |
{ |
3058 |
result.Add(item); |
|
3059 |
ReleaseCOMObjects(connector); |
|
3060 |
existZeroLength = true; |
|
3066 |
Line line1 = document.LINES.Find(x => x.SPPID.ModelItemId == modelId); |
|
3067 |
Line line2 = document.LINES.Find(x => x.SPPID.ModelItemId == connector.ModelItemID.ToString()); |
|
3068 |
if (line1 != null && line2 != null && line1.TYPE == line2.TYPE) |
|
3069 |
result.Add(connector.ModelItemID); |
|
3061 | 3070 |
} |
3062 | 3071 |
} |
3063 | 3072 |
} |
3064 | 3073 |
|
3065 |
if (result.Count == 1 && existZeroLength) |
|
3066 |
{ |
|
3067 |
LMConnector connector = GetLMConnectorOnlyOne(result[0]); |
|
3068 |
LMConnector newConnector = ReModelingLMConnector(connector, originalName); |
|
3069 |
result.Clear(); |
|
3070 |
if (newConnector != null) |
|
3071 |
result.Add(newConnector.ModelItemID); |
|
3072 |
|
|
3074 |
foreach (var connector in connectors) |
|
3073 | 3075 |
ReleaseCOMObjects(connector); |
3074 |
connector = null; |
|
3075 |
ReleaseCOMObjects(newConnector); |
|
3076 |
newConnector = null; |
|
3077 |
} |
|
3078 | 3076 |
|
3079 | 3077 |
return result; |
3078 |
|
|
3079 |
|
|
3080 |
LMSymbol FindOtherConnectedSymbol(LMConnector connector) |
|
3081 |
{ |
|
3082 |
LMSymbol findResult = null; |
|
3083 |
if (connector.ConnectItem1SymbolObject != null && connector.ConnectItem1SymbolObject.Id != symbol.Id && connector.ConnectItem1SymbolObject.get_ItemStatus() == "Active") |
|
3084 |
findResult = connector.ConnectItem1SymbolObject; |
|
3085 |
else if (connector.ConnectItem2SymbolObject != null && connector.ConnectItem2SymbolObject.Id != symbol.Id && connector.ConnectItem2SymbolObject.get_ItemStatus() == "Active") |
|
3086 |
findResult = connector.ConnectItem2SymbolObject; |
|
3087 |
|
|
3088 |
return findResult; |
|
3089 |
} |
|
3080 | 3090 |
} |
3081 | 3091 |
|
3082 | 3092 |
/// <summary> |
... | ... | |
3494 | 3504 |
return result; |
3495 | 3505 |
} |
3496 | 3506 |
|
3507 |
public List<string> GetRepresentations(string modelItemID) |
|
3508 |
{ |
|
3509 |
List<string> result = new List<string>(); ; |
|
3510 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemID); |
|
3511 |
if (modelItem != null) |
|
3512 |
{ |
|
3513 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
3514 |
{ |
|
3515 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
3516 |
result.Add(rep.Id); |
|
3517 |
} |
|
3518 |
ReleaseCOMObjects(modelItem); |
|
3519 |
} |
|
3520 |
|
|
3521 |
return result; |
|
3522 |
} |
|
3523 |
|
|
3497 | 3524 |
/// <summary> |
3498 | 3525 |
/// Line Number Symbol을 실제로 Modeling하는 메서드 |
3499 | 3526 |
/// </summary> |
DTI_PID/SPPIDConverter/BaseModel/SPPID/SPPIDLineInfo.cs | ||
---|---|---|
15 | 15 |
public double END_X { get; set; } |
16 | 16 |
public double END_Y { get; set; } |
17 | 17 |
public string ModelItemId { get; set; } |
18 |
public List<string> Representations { get => _Representations; set => _Representations = value; } |
|
19 |
|
|
20 |
private List<string> _Representations = new List<string>(); |
|
18 | 21 |
} |
19 | 22 |
} |
내보내기 Unified diff