개정판 7f00b26c
dev issue #000 : 에러 항목 정리 전
Change-Id: I42c23735071d0e44a9a7d574d70e89f903b0a130
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
62 | 62 |
EquipCount = document.Equipments.Count; |
63 | 63 |
SymbolCount = document.SYMBOLS.Count; |
64 | 64 |
SymbolCount = SymbolCount * 3; |
65 |
|
|
65 |
|
|
66 | 66 |
foreach (LineNumber lineNumber in document.LINENUMBERS) |
67 | 67 |
foreach (LineRun run in lineNumber.RUNS) |
68 | 68 |
foreach (var item in run.RUNITEMS) |
... | ... | |
121 | 121 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd); |
122 | 122 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStep, AllCount); |
123 | 123 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText); |
124 |
|
|
124 |
|
|
125 | 125 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Priority Symbol Modeling"); |
126 | 126 |
List<Symbol> prioritySymbols = GetPrioritySymbol(); |
127 | 127 |
foreach (var item in prioritySymbols) |
... | ... | |
279 | 279 |
{ |
280 | 280 |
LMDrawings drawings = new LMDrawings(); |
281 | 281 |
drawings.Collect(dataSource); |
282 |
|
|
282 |
|
|
283 | 283 |
List<string> drawingNameList = new List<string>(); |
284 | 284 |
List<string> drawingNumberList = new List<string>(); |
285 | 285 |
|
... | ... | |
482 | 482 |
/// <param name="prevSymbol"></param> |
483 | 483 |
private void SymbolModeling(Symbol symbol, Symbol targetSymbol) |
484 | 484 |
{ |
485 |
#if DEBUG |
|
486 |
try |
|
487 |
{ |
|
488 |
#endif |
|
489 |
// OWNERSYMBOL Attribute, 값을 가지고 있을 경우 |
|
490 |
BaseModel.Attribute itemAttribute = symbol.ATTRIBUTES.Find(attr => attr.ATTRIBUTE == "OWNERSYMBOL"); |
|
491 |
if (itemAttribute != null && (string.IsNullOrEmpty(itemAttribute.VALUE) || itemAttribute.VALUE != "None")) |
|
492 |
return; |
|
493 |
// 이미 모델링 됐을 경우 |
|
494 |
else if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId)) |
|
495 |
return; |
|
496 |
|
|
497 |
LMSymbol _LMSymbol = null; |
|
498 |
|
|
499 |
string mappingPath = symbol.SPPID.MAPPINGNAME; |
|
500 |
double x = symbol.SPPID.ORIGINAL_X; |
|
501 |
double y = symbol.SPPID.ORIGINAL_Y; |
|
502 |
int mirror = 0; |
|
503 |
double angle = symbol.ANGLE; |
|
504 |
|
|
505 |
SPPIDUtil.ConvertGridPoint(ref x, ref y); |
|
506 |
|
|
507 |
// OPC 일경우 180도 일때 Mirror |
|
508 |
if (mappingPath.Contains("Piping OPC's") && angle == Math.PI) |
|
509 |
mirror = 1; |
|
485 |
// OWNERSYMBOL Attribute, 값을 가지고 있을 경우 |
|
486 |
BaseModel.Attribute itemAttribute = symbol.ATTRIBUTES.Find(attr => attr.ATTRIBUTE == "OWNERSYMBOL"); |
|
487 |
if (itemAttribute != null && (string.IsNullOrEmpty(itemAttribute.VALUE) || itemAttribute.VALUE != "None")) |
|
488 |
return; |
|
489 |
// 이미 모델링 됐을 경우 |
|
490 |
else if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId)) |
|
491 |
return; |
|
510 | 492 |
|
511 |
// Mirror 계산 |
|
512 |
if (symbol.FLIP == 1) |
|
513 |
{ |
|
514 |
mirror = 1; |
|
515 |
angle += Math.PI; |
|
516 |
} |
|
493 |
LMSymbol _LMSymbol = null; |
|
517 | 494 |
|
518 |
if (targetSymbol != null && !string.IsNullOrEmpty(targetSymbol.SPPID.RepresentationId)) |
|
519 |
{ |
|
520 |
LMSymbol _TargetItem = dataSource.GetSymbol(targetSymbol.SPPID.RepresentationId); |
|
521 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, symbol.UID, targetSymbol); |
|
522 |
if (connector != null) |
|
523 |
GetTargetSymbolConnectorPoint(connector, targetSymbol, ref x, ref y); |
|
495 |
string mappingPath = symbol.SPPID.MAPPINGNAME; |
|
496 |
double x = symbol.SPPID.ORIGINAL_X; |
|
497 |
double y = symbol.SPPID.ORIGINAL_Y; |
|
498 |
int mirror = 0; |
|
499 |
double angle = symbol.ANGLE; |
|
524 | 500 |
|
525 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: _TargetItem);
|
|
501 |
SPPIDUtil.ConvertGridPoint(ref x, ref y);
|
|
526 | 502 |
|
527 |
if (_LMSymbol != null && _TargetItem != null) |
|
528 |
{ |
|
529 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id; |
|
530 |
LMConnector reModelingConnector = FindBreakLineTarget(symbol, targetSymbol); |
|
503 |
// OPC 일경우 180도 일때 Mirror |
|
504 |
if (mappingPath.Contains("Piping OPC's") && angle == Math.PI) |
|
505 |
mirror = 1; |
|
531 | 506 |
|
532 |
if (reModelingConnector != null) |
|
533 |
ReModelingLMConnector(reModelingConnector); |
|
534 |
} |
|
507 |
// Mirror 계산 |
|
508 |
if (symbol.FLIP == 1) |
|
509 |
{ |
|
510 |
mirror = 1; |
|
511 |
angle += Math.PI; |
|
512 |
} |
|
535 | 513 |
|
536 |
ReleaseCOMObjects(_TargetItem); |
|
537 |
} |
|
538 |
else |
|
539 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle); |
|
514 |
if (targetSymbol != null && !string.IsNullOrEmpty(targetSymbol.SPPID.RepresentationId)) |
|
515 |
{ |
|
516 |
LMSymbol _TargetItem = dataSource.GetSymbol(targetSymbol.SPPID.RepresentationId); |
|
517 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, symbol.UID, targetSymbol); |
|
518 |
if (connector != null) |
|
519 |
GetTargetSymbolConnectorPoint(connector, targetSymbol, ref x, ref y); |
|
540 | 520 |
|
521 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: _TargetItem); |
|
541 | 522 |
|
542 |
if (_LMSymbol != null) |
|
523 |
if (_LMSymbol != null && _TargetItem != null)
|
|
543 | 524 |
{ |
544 |
_LMSymbol.Commit(); |
|
545 | 525 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id; |
546 |
symbol.SPPID.ModelItemID = _LMSymbol.ModelItemID; |
|
547 |
symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID(); |
|
526 |
LMConnector reModelingConnector = FindBreakLineTarget(symbol, targetSymbol); |
|
548 | 527 |
|
549 |
foreach (var item in symbol.ChildSymbols)
|
|
550 |
CreateChildSymbol(item, _LMSymbol);
|
|
528 |
if (reModelingConnector != null)
|
|
529 |
ReModelingLMConnector(reModelingConnector);
|
|
551 | 530 |
} |
552 | 531 |
|
553 |
ReleaseCOMObjects(_LMSymbol); |
|
554 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
|
555 |
#if DEBUG |
|
556 |
|
|
532 |
ReleaseCOMObjects(_TargetItem); |
|
557 | 533 |
} |
558 |
catch (Exception ex) |
|
534 |
else |
|
535 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle); |
|
536 |
|
|
537 |
|
|
538 |
if (_LMSymbol != null) |
|
559 | 539 |
{ |
560 |
System.Windows.Forms.MessageBox.Show(ex.StackTrace); |
|
540 |
_LMSymbol.Commit(); |
|
541 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id; |
|
542 |
symbol.SPPID.ModelItemID = _LMSymbol.ModelItemID; |
|
543 |
symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID(); |
|
544 |
|
|
545 |
foreach (var item in symbol.ChildSymbols) |
|
546 |
CreateChildSymbol(item, _LMSymbol); |
|
561 | 547 |
} |
562 |
#endif |
|
548 |
|
|
549 |
ReleaseCOMObjects(_LMSymbol); |
|
550 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
|
563 | 551 |
} |
564 | 552 |
|
565 | 553 |
/// <summary> |
... | ... | |
871 | 859 |
{ |
872 | 860 |
ReleaseCOMObjects(targetItem); |
873 | 861 |
} |
874 |
|
|
862 |
|
|
875 | 863 |
ReleaseCOMObjects(_LMSymbol); |
876 | 864 |
|
877 | 865 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
... | ... | |
935 | 923 |
foreach (var item in childSymbol.ChildSymbols) |
936 | 924 |
CreateChildSymbol(item, _LMSymbol); |
937 | 925 |
} |
938 |
|
|
926 |
|
|
939 | 927 |
|
940 | 928 |
ReleaseCOMObjects(_LMSymbol); |
941 | 929 |
} |
... | ... | |
980 | 968 |
/// <param name="lines"></param> |
981 | 969 |
private void LineModeling(List<Line> lines) |
982 | 970 |
{ |
983 |
try |
|
984 |
{ |
|
985 |
_LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME); |
|
986 |
PlaceRunInputs placeRunInputs = new PlaceRunInputs(); |
|
987 |
LMSymbol _LMSymbol1 = null; |
|
988 |
LMSymbol _LMSymbol2 = null; |
|
989 |
Dictionary<LMConnector, List<double[]>> connectorVertices1 = new Dictionary<LMConnector, List<double[]>>(); |
|
990 |
LMConnector targetConnector1 = null; |
|
991 |
Dictionary<LMConnector, List<double[]>> connectorVertices2 = new Dictionary<LMConnector, List<double[]>>(); |
|
992 |
LMConnector targetConnector2 = null; |
|
993 |
|
|
994 |
Line startBranchLine = null; |
|
995 |
Line endBranchLine = null; |
|
996 |
|
|
997 |
// Type, Line, TargetObjet, x, y |
|
998 |
List<Tuple<string, Line, object, double, double>> linePointInfo = new List<Tuple<string, Line, object, double, double>>(); |
|
999 |
// Point 정리 |
|
1000 |
for (int i = 0; i < lines.Count; i++) |
|
1001 |
{ |
|
1002 |
Line line = lines[i]; |
|
1003 |
if (i == 0 || i + 1 != lines.Count) |
|
1004 |
{ |
|
1005 |
// 시작점에 연결된 Symbol 찾기 |
|
1006 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[0].CONNECTEDITEM); |
|
1007 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
971 |
_LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME); |
|
972 |
PlaceRunInputs placeRunInputs = new PlaceRunInputs(); |
|
973 |
LMSymbol _LMSymbol1 = null; |
|
974 |
LMSymbol _LMSymbol2 = null; |
|
975 |
Dictionary<LMConnector, List<double[]>> connectorVertices1 = new Dictionary<LMConnector, List<double[]>>(); |
|
976 |
LMConnector targetConnector1 = null; |
|
977 |
Dictionary<LMConnector, List<double[]>> connectorVertices2 = new Dictionary<LMConnector, List<double[]>>(); |
|
978 |
LMConnector targetConnector2 = null; |
|
979 |
|
|
980 |
Line startBranchLine = null; |
|
981 |
Line endBranchLine = null; |
|
982 |
|
|
983 |
// Type, Line, TargetObjet, x, y |
|
984 |
List<Tuple<string, Line, object, double, double>> linePointInfo = new List<Tuple<string, Line, object, double, double>>(); |
|
985 |
// Point 정리 |
|
986 |
for (int i = 0; i < lines.Count; i++) |
|
987 |
{ |
|
988 |
Line line = lines[i]; |
|
989 |
if (i == 0 || i + 1 != lines.Count) |
|
990 |
{ |
|
991 |
// 시작점에 연결된 Symbol 찾기 |
|
992 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[0].CONNECTEDITEM); |
|
993 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
994 |
{ |
|
995 |
Symbol symbol1 = connItem as Symbol; |
|
996 |
_LMSymbol1 = GetTargetSymbol(symbol1, line); |
|
997 |
if (_LMSymbol1 != null) |
|
1008 | 998 |
{ |
1009 |
Symbol symbol1 = connItem as Symbol; |
|
1010 |
_LMSymbol1 = GetTargetSymbol(symbol1, line); |
|
1011 |
if (_LMSymbol1 != null) |
|
999 |
double x = line.SPPID.START_X; |
|
1000 |
double y = line.SPPID.START_Y; |
|
1001 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol1); |
|
1002 |
if (connector != null) |
|
1012 | 1003 |
{ |
1013 |
double x = line.SPPID.START_X; |
|
1014 |
double y = line.SPPID.START_Y; |
|
1015 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol1); |
|
1016 |
if (connector != null) |
|
1017 |
{ |
|
1018 |
GetTargetSymbolConnectorPoint(connector, symbol1, ref x, ref y); |
|
1019 |
line.SPPID.START_X = x; |
|
1020 |
line.SPPID.START_Y = y; |
|
1021 |
} |
|
1022 |
|
|
1023 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol1, x, y)); |
|
1004 |
GetTargetSymbolConnectorPoint(connector, symbol1, ref x, ref y); |
|
1005 |
line.SPPID.START_X = x; |
|
1006 |
line.SPPID.START_Y = y; |
|
1024 | 1007 |
} |
1025 |
else |
|
1026 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1027 |
} |
|
1028 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem)) |
|
1029 |
{ |
|
1030 |
connectorVertices1 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId); |
|
1031 |
targetConnector1 = FindTargetLMConnector(connectorVertices1, line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1032 | 1008 |
|
1033 |
if (targetConnector1 != null) |
|
1034 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector1, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1035 |
else |
|
1036 |
{ |
|
1037 |
startBranchLine = connItem as Line; |
|
1038 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1039 |
} |
|
1009 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol1, x, y)); |
|
1040 | 1010 |
} |
1041 | 1011 |
else |
1042 | 1012 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
1043 |
|
|
1044 | 1013 |
} |
1045 |
if (i + 1 == lines.Count)
|
|
1014 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem))
|
|
1046 | 1015 |
{ |
1047 |
// 끝점에 연결된 Symbol 찾기
|
|
1048 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[1].CONNECTEDITEM);
|
|
1016 |
connectorVertices1 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId);
|
|
1017 |
targetConnector1 = FindTargetLMConnector(connectorVertices1, line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y);
|
|
1049 | 1018 |
|
1050 |
if (i != 0) |
|
1019 |
if (targetConnector1 != null) |
|
1020 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector1, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1021 |
else |
|
1022 |
{ |
|
1023 |
startBranchLine = connItem as Line; |
|
1051 | 1024 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
1025 |
} |
|
1026 |
} |
|
1027 |
else |
|
1028 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1052 | 1029 |
|
1053 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
1054 |
{ |
|
1055 |
Symbol symbol2 = connItem as Symbol; |
|
1056 |
_LMSymbol2 = GetTargetSymbol(connItem as Symbol, line); |
|
1057 |
if (_LMSymbol2 != null) |
|
1058 |
{ |
|
1059 |
double x = line.SPPID.END_X; |
|
1060 |
double y = line.SPPID.END_Y; |
|
1061 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol2); |
|
1062 |
if (connector != null) |
|
1063 |
{ |
|
1064 |
GetTargetSymbolConnectorPoint(connector, symbol2, ref x, ref y); |
|
1065 |
line.SPPID.END_X = x; |
|
1066 |
line.SPPID.END_Y = y; |
|
1067 |
} |
|
1030 |
} |
|
1031 |
if (i + 1 == lines.Count) |
|
1032 |
{ |
|
1033 |
// 끝점에 연결된 Symbol 찾기 |
|
1034 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[1].CONNECTEDITEM); |
|
1068 | 1035 |
|
1069 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol2, x, y)); |
|
1070 |
} |
|
1071 |
else |
|
1072 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1073 |
} |
|
1074 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem)) |
|
1075 |
{ |
|
1076 |
connectorVertices2 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId); |
|
1077 |
targetConnector2 = FindTargetLMConnector(connectorVertices2, line.SPPID.END_X, line.SPPID.END_Y, line.SPPID.START_X, line.SPPID.START_Y); |
|
1036 |
if (i != 0) |
|
1037 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1078 | 1038 |
|
1079 |
if (targetConnector2 != null) |
|
1080 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector2, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1081 |
else |
|
1039 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
1040 |
{ |
|
1041 |
Symbol symbol2 = connItem as Symbol; |
|
1042 |
_LMSymbol2 = GetTargetSymbol(connItem as Symbol, line); |
|
1043 |
if (_LMSymbol2 != null) |
|
1044 |
{ |
|
1045 |
double x = line.SPPID.END_X; |
|
1046 |
double y = line.SPPID.END_Y; |
|
1047 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol2); |
|
1048 |
if (connector != null) |
|
1082 | 1049 |
{ |
1083 |
endBranchLine = connItem as Line; |
|
1084 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1050 |
GetTargetSymbolConnectorPoint(connector, symbol2, ref x, ref y); |
|
1051 |
line.SPPID.END_X = x; |
|
1052 |
line.SPPID.END_Y = y; |
|
1085 | 1053 |
} |
1054 |
|
|
1055 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol2, x, y)); |
|
1086 | 1056 |
} |
1087 | 1057 |
else |
1088 | 1058 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
1089 | 1059 |
} |
1090 |
} |
|
1091 |
|
|
1092 |
double prevX = double.NaN; |
|
1093 |
double prevY = double.NaN; |
|
1094 |
SlopeType prevSlopeType = SlopeType.None; |
|
1095 |
for (int i = 0; i < linePointInfo.Count; i++) |
|
1096 |
{ |
|
1097 |
Tuple<string, Line, object, double, double> item = linePointInfo[i]; |
|
1098 |
Line line = item.Item2; |
|
1099 |
double x = item.Item4; |
|
1100 |
double y = item.Item5; |
|
1101 |
SlopeType slopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1102 |
// Symbol일 경우 바로 Input Point |
|
1103 |
if (item.Item1 == "SYMBOL") |
|
1060 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem)) |
|
1104 | 1061 |
{ |
1105 |
LMSymbol targetSymbol = item.Item3 as LMSymbol; |
|
1106 |
placeRunInputs.AddSymbolTarget(targetSymbol, x, y); |
|
1062 |
connectorVertices2 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId); |
|
1063 |
targetConnector2 = FindTargetLMConnector(connectorVertices2, line.SPPID.END_X, line.SPPID.END_Y, line.SPPID.START_X, line.SPPID.START_Y); |
|
1064 |
|
|
1065 |
if (targetConnector2 != null) |
|
1066 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector2, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1067 |
else |
|
1068 |
{ |
|
1069 |
endBranchLine = connItem as Line; |
|
1070 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1071 |
} |
|
1107 | 1072 |
} |
1108 | 1073 |
else |
1074 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1075 |
} |
|
1076 |
} |
|
1077 |
|
|
1078 |
double prevX = double.NaN; |
|
1079 |
double prevY = double.NaN; |
|
1080 |
SlopeType prevSlopeType = SlopeType.None; |
|
1081 |
for (int i = 0; i < linePointInfo.Count; i++) |
|
1082 |
{ |
|
1083 |
Tuple<string, Line, object, double, double> item = linePointInfo[i]; |
|
1084 |
Line line = item.Item2; |
|
1085 |
double x = item.Item4; |
|
1086 |
double y = item.Item5; |
|
1087 |
SlopeType slopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1088 |
// Symbol일 경우 바로 Input Point |
|
1089 |
if (item.Item1 == "SYMBOL") |
|
1090 |
{ |
|
1091 |
LMSymbol targetSymbol = item.Item3 as LMSymbol; |
|
1092 |
placeRunInputs.AddSymbolTarget(targetSymbol, x, y); |
|
1093 |
} |
|
1094 |
else |
|
1095 |
{ |
|
1096 |
SPPIDUtil.ConvertGridPoint(ref x, ref y); |
|
1097 |
// i == 0은 그대로 사용 |
|
1098 |
if (i != 0) |
|
1109 | 1099 |
{ |
1110 |
SPPIDUtil.ConvertGridPoint(ref x, ref y);
|
|
1111 |
// i == 0은 그대로 사용
|
|
1112 |
if (i != 0)
|
|
1100 |
Tuple<string, Line, object, double, double> prevItem = linePointInfo[i - 1];
|
|
1101 |
// y 좌표가 같아야함 및 Symbol 좌표가 정확하지 않으므로 한번더 보정
|
|
1102 |
if (prevSlopeType == SlopeType.HORIZONTAL)
|
|
1113 | 1103 |
{ |
1114 |
Tuple<string, Line, object, double, double> prevItem = linePointInfo[i - 1]; |
|
1115 |
// y 좌표가 같아야함 및 Symbol 좌표가 정확하지 않으므로 한번더 보정 |
|
1116 |
if (prevSlopeType == SlopeType.HORIZONTAL) |
|
1117 |
{ |
|
1118 |
y = prevY; |
|
1119 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref y); |
|
1120 |
} |
|
1121 |
else if (prevSlopeType == SlopeType.VERTICAL) |
|
1122 |
{ |
|
1123 |
x = prevX; |
|
1124 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref x); |
|
1125 |
} |
|
1126 |
|
|
1127 |
// 마지막이 Symbol일 경우는 Symbol의 좌표를 따라감 |
|
1128 |
if (i + 1 == linePointInfo.Count - 1 && linePointInfo[i + 1].Item1 == "SYMBOL") |
|
1129 |
{ |
|
1130 |
Line nextLine = linePointInfo[i + 1].Item2; |
|
1131 |
SlopeType nextSlopeType = SPPIDUtil.CalcSlope(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y); |
|
1132 |
if (slopeType == SlopeType.HORIZONTAL) |
|
1133 |
y = linePointInfo[i + 1].Item5; |
|
1134 |
else if (slopeType == SlopeType.VERTICAL) |
|
1135 |
x = linePointInfo[i + 1].Item4; |
|
1136 |
} |
|
1104 |
y = prevY; |
|
1105 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref y); |
|
1106 |
} |
|
1107 |
else if (prevSlopeType == SlopeType.VERTICAL) |
|
1108 |
{ |
|
1109 |
x = prevX; |
|
1110 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref x); |
|
1137 | 1111 |
} |
1138 | 1112 |
|
1139 |
if (item.Item1 == "LINE") |
|
1113 |
// 마지막이 Symbol일 경우는 Symbol의 좌표를 따라감 |
|
1114 |
if (i + 1 == linePointInfo.Count - 1 && linePointInfo[i + 1].Item1 == "SYMBOL") |
|
1140 | 1115 |
{ |
1141 |
LMConnector targetConnector = item.Item3 as LMConnector; |
|
1142 |
placeRunInputs.AddConnectorTarget(targetConnector, x, y); |
|
1116 |
Line nextLine = linePointInfo[i + 1].Item2; |
|
1117 |
SlopeType nextSlopeType = SPPIDUtil.CalcSlope(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y); |
|
1118 |
if (slopeType == SlopeType.HORIZONTAL) |
|
1119 |
y = linePointInfo[i + 1].Item5; |
|
1120 |
else if (slopeType == SlopeType.VERTICAL) |
|
1121 |
x = linePointInfo[i + 1].Item4; |
|
1143 | 1122 |
} |
1144 |
|
|
1145 |
else |
|
1146 |
placeRunInputs.AddPoint(x, y); |
|
1147 | 1123 |
} |
1148 | 1124 |
|
1149 |
prevX = x; |
|
1150 |
prevY = y; |
|
1151 |
prevSlopeType = slopeType; |
|
1152 |
} |
|
1153 |
|
|
1154 |
LMConnector _lMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
|
1155 |
|
|
1156 |
if (_lMConnector != null) |
|
1157 |
{ |
|
1158 |
bool bStart = false; |
|
1159 |
bool bEnd = false; |
|
1160 |
|
|
1161 |
NeedReModeling(lines[0], _LMSymbol1, ref bStart); |
|
1162 |
NeedReModeling(lines[lines.Count - 1], _LMSymbol2, ref bEnd); |
|
1163 |
|
|
1164 |
if (bStart || bEnd) |
|
1165 |
ReModelingLine(lines, _lMConnector, _LMSymbol1, _LMSymbol2, bStart, bEnd); |
|
1166 |
else |
|
1125 |
if (item.Item1 == "LINE") |
|
1167 | 1126 |
{ |
1168 |
foreach (var line in lines) |
|
1169 |
line.SPPID.ModelItemId = _lMConnector.ModelItemID; |
|
1170 |
_lMConnector.Commit(); |
|
1127 |
LMConnector targetConnector = item.Item3 as LMConnector; |
|
1128 |
placeRunInputs.AddConnectorTarget(targetConnector, x, y); |
|
1171 | 1129 |
} |
1172 | 1130 |
|
1173 |
if (startBranchLine != null || endBranchLine != null)
|
|
1174 |
BranchLines.Add(new Tuple<string, Line, Line>(lines[0].SPPID.ModelItemId, startBranchLine, endBranchLine));
|
|
1131 |
else
|
|
1132 |
placeRunInputs.AddPoint(x, y);
|
|
1175 | 1133 |
} |
1176 | 1134 |
|
1177 |
if (_LMSymbol1 != null) |
|
1178 |
ReleaseCOMObjects(_LMSymbol1); |
|
1179 |
if (_LMSymbol2 != null) |
|
1180 |
ReleaseCOMObjects(_LMSymbol2); |
|
1181 |
if (targetConnector1 != null) |
|
1182 |
ReleaseCOMObjects(targetConnector1); |
|
1183 |
if (targetConnector2 != null) |
|
1184 |
ReleaseCOMObjects(targetConnector2); |
|
1185 |
foreach (var item in connectorVertices1) |
|
1186 |
ReleaseCOMObjects(item.Key); |
|
1187 |
foreach (var item in connectorVertices2) |
|
1188 |
ReleaseCOMObjects(item.Key); |
|
1189 |
|
|
1190 |
ReleaseCOMObjects(_lMConnector); |
|
1191 |
ReleaseCOMObjects(placeRunInputs); |
|
1192 |
ReleaseCOMObjects(_LMAItem); |
|
1135 |
prevX = x; |
|
1136 |
prevY = y; |
|
1137 |
prevSlopeType = slopeType; |
|
1193 | 1138 |
} |
1194 |
catch (Exception ex) |
|
1139 |
|
|
1140 |
LMConnector _lMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
|
1141 |
|
|
1142 |
if (_lMConnector != null) |
|
1195 | 1143 |
{ |
1196 |
StringBuilder sb = new StringBuilder(); |
|
1197 |
foreach (var item in lines) |
|
1144 |
bool bStart = false; |
|
1145 |
bool bEnd = false; |
|
1146 |
|
|
1147 |
NeedReModeling(lines[0], _LMSymbol1, ref bStart); |
|
1148 |
NeedReModeling(lines[lines.Count - 1], _LMSymbol2, ref bEnd); |
|
1149 |
|
|
1150 |
if (bStart || bEnd) |
|
1151 |
ReModelingLine(lines, _lMConnector, _LMSymbol1, _LMSymbol2, bStart, bEnd); |
|
1152 |
else |
|
1198 | 1153 |
{ |
1199 |
sb.AppendLine(item.UID); |
|
1154 |
foreach (var line in lines) |
|
1155 |
line.SPPID.ModelItemId = _lMConnector.ModelItemID; |
|
1156 |
_lMConnector.Commit(); |
|
1200 | 1157 |
} |
1201 |
throw new Exception(sb.ToString()); |
|
1158 |
|
|
1159 |
if (startBranchLine != null || endBranchLine != null) |
|
1160 |
BranchLines.Add(new Tuple<string, Line, Line>(lines[0].SPPID.ModelItemId, startBranchLine, endBranchLine)); |
|
1202 | 1161 |
} |
1162 |
|
|
1163 |
if (_LMSymbol1 != null) |
|
1164 |
ReleaseCOMObjects(_LMSymbol1); |
|
1165 |
if (_LMSymbol2 != null) |
|
1166 |
ReleaseCOMObjects(_LMSymbol2); |
|
1167 |
if (targetConnector1 != null) |
|
1168 |
ReleaseCOMObjects(targetConnector1); |
|
1169 |
if (targetConnector2 != null) |
|
1170 |
ReleaseCOMObjects(targetConnector2); |
|
1171 |
foreach (var item in connectorVertices1) |
|
1172 |
ReleaseCOMObjects(item.Key); |
|
1173 |
foreach (var item in connectorVertices2) |
|
1174 |
ReleaseCOMObjects(item.Key); |
|
1175 |
|
|
1176 |
ReleaseCOMObjects(_lMConnector); |
|
1177 |
ReleaseCOMObjects(placeRunInputs); |
|
1178 |
ReleaseCOMObjects(_LMAItem); |
|
1203 | 1179 |
} |
1204 | 1180 |
|
1205 | 1181 |
private void NeedReModeling(Line line, LMSymbol symbol, ref bool result) |
... | ... | |
1222 | 1198 |
result = true; |
1223 | 1199 |
} |
1224 | 1200 |
} |
1225 |
|
|
1201 |
|
|
1226 | 1202 |
/// <summary> |
1227 | 1203 |
/// Symbol에 붙을 경우 Line을 Remodeling 한다. |
1228 | 1204 |
/// </summary> |
... | ... | |
1251 | 1227 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d; |
1252 | 1228 |
int verticesCount = lineStringGeometry.VertexCount; |
1253 | 1229 |
PlaceRunInputs placeRunInputs = new PlaceRunInputs(); |
1254 |
|
|
1230 |
|
|
1255 | 1231 |
List<double[]> vertices = new List<double[]>(); |
1256 | 1232 |
for (int i = 1; i <= verticesCount; i++) |
1257 | 1233 |
{ |
... | ... | |
1431 | 1407 |
_LMSymbol = dataSource.GetSymbol(child.SPPID.RepresentationId); |
1432 | 1408 |
} |
1433 | 1409 |
|
1434 |
break;
|
|
1410 |
break; |
|
1435 | 1411 |
} |
1436 | 1412 |
} |
1437 | 1413 |
|
... | ... | |
1594 | 1570 |
|
1595 | 1571 |
if (IsStart && |
1596 | 1572 |
!DBNull.Value.Equals(item.Key.ConnectItem1SymbolID) && |
1597 |
!DBNull.Value.Equals(_Connector.ConnectItem2SymbolID)&&
|
|
1573 |
!DBNull.Value.Equals(_Connector.ConnectItem2SymbolID) &&
|
|
1598 | 1574 |
item.Key.ConnectItem1SymbolID == _Connector.ConnectItem2SymbolID) |
1599 | 1575 |
{ |
1600 | 1576 |
_SameRunTargetConnector = item.Key; |
... | ... | |
1602 | 1578 |
} |
1603 | 1579 |
else if (!IsStart && |
1604 | 1580 |
!DBNull.Value.Equals(item.Key.ConnectItem2SymbolID) && |
1605 |
!DBNull.Value.Equals(_Connector.ConnectItem1SymbolID) &&
|
|
1581 |
!DBNull.Value.Equals(_Connector.ConnectItem1SymbolID) && |
|
1606 | 1582 |
item.Key.ConnectItem2SymbolID == _Connector.ConnectItem1SymbolID) |
1607 | 1583 |
{ |
1608 | 1584 |
_SameRunTargetConnector = item.Key; |
... | ... | |
1630 | 1606 |
|
1631 | 1607 |
// 기존 Connector 제거 |
1632 | 1608 |
_placement.PIDRemovePlacement(_Connector.AsLMRepresentation()); |
1633 |
|
|
1609 |
|
|
1634 | 1610 |
// 시작 Connector일 경우 첫 Point가 TargetConnector를 찾아야함 |
1635 | 1611 |
if (IsStart) |
1636 | 1612 |
{ |
... | ... | |
1819 | 1795 |
Array array = new double[] { 0, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y }; |
1820 | 1796 |
LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, Rotation: 0, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: true); |
1821 | 1797 |
} |
1822 |
|
|
1798 |
|
|
1823 | 1799 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
1824 | 1800 |
} |
1825 | 1801 |
|
... | ... | |
2136 | 2112 |
_LMAItem item1 = modelItem1.AsLMAItem(); |
2137 | 2113 |
LMModelItem modelItem2 = dataSource.GetModelItem(fromModelItemId); |
2138 | 2114 |
_LMAItem item2 = modelItem2.AsLMAItem(); |
2139 |
|
|
2140 |
// item2가 item1으로 조인 |
|
2141 |
try |
|
2142 |
{ |
|
2143 |
_placement.PIDJoinRuns(ref item1, ref item2); |
|
2144 |
item1.Commit(); |
|
2145 |
item2.Commit(); |
|
2146 | 2115 |
|
2147 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, fromModelItemId); |
|
2148 |
foreach (var line in lines) |
|
2149 |
line.SPPID.ModelItemId = toModelItemId; |
|
2150 |
} |
|
2151 |
catch (Exception ex) |
|
2152 |
{ |
|
2153 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2154 |
} |
|
2155 |
finally |
|
2156 |
{ |
|
2157 |
ReleaseCOMObjects(modelItem1); |
|
2158 |
ReleaseCOMObjects(item1); |
|
2159 |
ReleaseCOMObjects(modelItem2); |
|
2160 |
ReleaseCOMObjects(item2); |
|
2161 |
} |
|
2116 |
// item2가 item1으로 조인 |
|
2117 |
_placement.PIDJoinRuns(ref item1, ref item2); |
|
2118 |
item1.Commit(); |
|
2119 |
item2.Commit(); |
|
2120 |
|
|
2121 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, fromModelItemId); |
|
2122 |
foreach (var line in lines) |
|
2123 |
line.SPPID.ModelItemId = toModelItemId; |
|
2124 |
|
|
2125 |
ReleaseCOMObjects(modelItem1); |
|
2126 |
ReleaseCOMObjects(item1); |
|
2127 |
ReleaseCOMObjects(modelItem2); |
|
2128 |
ReleaseCOMObjects(item2); |
|
2162 | 2129 |
} |
2163 | 2130 |
|
2164 | 2131 |
/// <summary> |
... | ... | |
2169 | 2136 |
{ |
2170 | 2137 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemId); |
2171 | 2138 |
_LMAItem item = modelItem.AsLMAItem(); |
2172 |
try
|
|
2139 |
if (modelItem.get_ItemStatus() == "Active")
|
|
2173 | 2140 |
{ |
2174 |
if (modelItem.get_ItemStatus() == "Active") |
|
2175 |
{ |
|
2176 |
string modelitemID = item.Id; |
|
2177 |
_placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item); |
|
2178 |
string afterModelItemID = item.Id; |
|
2141 |
string modelitemID = item.Id; |
|
2142 |
_placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item); |
|
2143 |
string afterModelItemID = item.Id; |
|
2179 | 2144 |
|
2180 |
if (modelitemID != afterModelItemID) |
|
2181 |
{ |
|
2182 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, modelitemID); |
|
2183 |
foreach (var line in lines) |
|
2184 |
line.SPPID.ModelItemId = afterModelItemID; |
|
2185 |
} |
|
2186 |
item.Commit(); |
|
2145 |
if (modelitemID != afterModelItemID) |
|
2146 |
{ |
|
2147 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, modelitemID); |
|
2148 |
foreach (var line in lines) |
|
2149 |
line.SPPID.ModelItemId = afterModelItemID; |
|
2187 | 2150 |
} |
2151 |
item.Commit(); |
|
2188 | 2152 |
} |
2189 |
catch (Exception ex) |
|
2190 |
{ |
|
2191 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2192 |
} |
|
2193 |
finally |
|
2194 |
{ |
|
2195 |
ReleaseCOMObjects(modelItem); |
|
2196 |
ReleaseCOMObjects(item); |
|
2197 |
} |
|
2153 |
|
|
2154 |
ReleaseCOMObjects(modelItem); |
|
2155 |
ReleaseCOMObjects(item); |
|
2198 | 2156 |
} |
2199 | 2157 |
|
2200 | 2158 |
/// <summary> |
... | ... | |
2538 | 2496 |
else |
2539 | 2497 |
tempY = line.SPPID.START_Y - gapY; |
2540 | 2498 |
|
2541 |
|
|
2542 |
|
|
2499 |
|
|
2500 |
|
|
2543 | 2501 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId); |
2544 | 2502 |
LMConnector _TargetItem = null; |
2545 | 2503 |
double distance = double.MaxValue; |
... | ... | |
2606 | 2564 |
y = startPoint[1] + gapY; |
2607 | 2565 |
else |
2608 | 2566 |
y = startPoint[1] - gapY; |
2609 |
|
|
2567 |
|
|
2610 | 2568 |
if (targetSlopeType == SlopeType.HORIZONTAL) |
2611 | 2569 |
{ |
2612 | 2570 |
if (startPoint[0] < endPoint[0]) |
... | ... | |
2624 | 2582 |
} |
2625 | 2583 |
|
2626 | 2584 |
LMSymbol _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: 0, Rotation: angle, TargetItem: _TargetItem); |
2627 |
|
|
2585 |
|
|
2628 | 2586 |
if (_LMSymbol != null) |
2629 | 2587 |
{ |
2630 | 2588 |
ReleaseCOMObjects(_LMSymbol); |
2631 | 2589 |
} |
2632 |
|
|
2590 |
|
|
2633 | 2591 |
} |
2634 | 2592 |
|
2635 | 2593 |
foreach (var item in connectorVertices) |
... | ... | |
2700 | 2658 |
_LMAAttribute.set_Value(attribute.VALUE); |
2701 | 2659 |
else if (_LMAAttribute.get_Value() != attribute.VALUE) |
2702 | 2660 |
_LMAAttribute.set_Value(attribute.VALUE); |
2703 |
|
|
2661 |
|
|
2704 | 2662 |
} |
2705 | 2663 |
} |
2706 | 2664 |
} |
... | ... | |
2722 | 2680 |
/// <param name="item"></param> |
2723 | 2681 |
private void InputSymbolAttribute(object targetItem, List<BaseModel.Attribute> targetAttributes) |
2724 | 2682 |
{ |
2725 |
try |
|
2683 |
|
|
2684 |
// Object 아이템이 Symbol일 경우 Equipment일 경우 |
|
2685 |
string sRep = null; |
|
2686 |
if (targetItem.GetType() == typeof(Symbol)) |
|
2687 |
sRep = ((Symbol)targetItem).SPPID.RepresentationId; |
|
2688 |
else if (targetItem.GetType() == typeof(Equipment)) |
|
2689 |
sRep = ((Equipment)targetItem).SPPID.RepresentationId; |
|
2690 |
|
|
2691 |
if (!string.IsNullOrEmpty(sRep)) |
|
2726 | 2692 |
{ |
2727 |
// Object 아이템이 Symbol일 경우 Equipment일 경우 |
|
2728 |
string sRep = null; |
|
2729 |
if (targetItem.GetType() == typeof(Symbol)) |
|
2730 |
sRep = ((Symbol)targetItem).SPPID.RepresentationId; |
|
2731 |
else if (targetItem.GetType() == typeof(Equipment)) |
|
2732 |
sRep = ((Equipment)targetItem).SPPID.RepresentationId; |
|
2733 |
|
|
2734 |
if (!string.IsNullOrEmpty(sRep)) |
|
2735 |
{ |
|
2736 |
LMSymbol _LMSymbol = dataSource.GetSymbol(sRep); |
|
2737 |
LMModelItem _LMModelItem = _LMSymbol.ModelItemObject; |
|
2738 |
LMAAttributes _Attributes = _LMModelItem.Attributes; |
|
2693 |
LMSymbol _LMSymbol = dataSource.GetSymbol(sRep); |
|
2694 |
LMModelItem _LMModelItem = _LMSymbol.ModelItemObject; |
|
2695 |
LMAAttributes _Attributes = _LMModelItem.Attributes; |
|
2739 | 2696 |
|
2740 |
foreach (var item in targetAttributes) |
|
2697 |
foreach (var item in targetAttributes) |
|
2698 |
{ |
|
2699 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID); |
|
2700 |
if (mapping != null && !string.IsNullOrEmpty(item.VALUE) && item.VALUE != "None") |
|
2741 | 2701 |
{ |
2742 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID); |
|
2743 |
if (mapping != null && !string.IsNullOrEmpty(item.VALUE) && item.VALUE != "None") |
|
2744 |
{ |
|
2745 |
LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
2746 |
if (_Attribute != null) |
|
2747 |
_Attribute.set_Value(item.VALUE); |
|
2748 |
} |
|
2702 |
LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
2703 |
if (_Attribute != null) |
|
2704 |
_Attribute.set_Value(item.VALUE); |
|
2749 | 2705 |
} |
2750 |
_LMModelItem.Commit(); |
|
2751 |
|
|
2752 |
ReleaseCOMObjects(_Attributes); |
|
2753 |
ReleaseCOMObjects(_LMModelItem); |
|
2754 |
ReleaseCOMObjects(_LMSymbol); |
|
2755 | 2706 |
} |
2756 |
} |
|
2757 |
catch (Exception ex) |
|
2758 |
{ |
|
2759 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2707 |
_LMModelItem.Commit(); |
|
2708 |
|
|
2709 |
ReleaseCOMObjects(_Attributes); |
|
2710 |
ReleaseCOMObjects(_LMModelItem); |
|
2711 |
ReleaseCOMObjects(_LMSymbol); |
|
2760 | 2712 |
} |
2761 | 2713 |
|
2762 | 2714 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
... | ... | |
2768 | 2720 |
/// <param name="specBreak"></param> |
2769 | 2721 |
private void InputSpecBreakAttribute(SpecBreak specBreak) |
2770 | 2722 |
{ |
2771 |
try |
|
2723 |
object upStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.UpStreamUID); |
|
2724 |
object downStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.DownStreamUID); |
|
2725 |
|
|
2726 |
if (upStreamObj != null && |
|
2727 |
downStreamObj != null) |
|
2772 | 2728 |
{ |
2773 |
object upStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.UpStreamUID); |
|
2774 |
object downStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.DownStreamUID); |
|
2729 |
LMConnector targetLMConnector = FindBreakLineTarget(upStreamObj, downStreamObj); |
|
2775 | 2730 |
|
2776 |
if (upStreamObj != null && |
|
2777 |
downStreamObj != null) |
|
2731 |
if (targetLMConnector != null) |
|
2778 | 2732 |
{ |
2779 |
LMConnector targetLMConnector = FindBreakLineTarget(upStreamObj, downStreamObj); |
|
2780 |
|
|
2781 |
if (targetLMConnector != null) |
|
2733 |
foreach (LMLabelPersist _LMLabelPersist in targetLMConnector.LabelPersists) |
|
2782 | 2734 |
{ |
2783 |
foreach (LMLabelPersist _LMLabelPersist in targetLMConnector.LabelPersists) |
|
2735 |
string symbolPath = _LMLabelPersist.get_FileName(); |
|
2736 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.SPPIDSYMBOLNAME == symbolPath); |
|
2737 |
if (mapping != null) |
|
2784 | 2738 |
{ |
2785 |
string symbolPath = _LMLabelPersist.get_FileName(); |
|
2786 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.SPPIDSYMBOLNAME == symbolPath); |
|
2787 |
if (mapping != null) |
|
2739 |
BaseModel.Attribute attribute = specBreak.ATTRIBUTES.Find(y => y.UID == mapping.UID); |
|
2740 |
if (attribute != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None") |
|
2788 | 2741 |
{ |
2789 |
BaseModel.Attribute attribute = specBreak.ATTRIBUTES.Find(y => y.UID == mapping.UID);
|
|
2790 |
if (attribute != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
|
|
2742 |
string[] values = attribute.VALUE.Split(new char[] { ',' });
|
|
2743 |
if (values.Length == 2)
|
|
2791 | 2744 |
{ |
2792 |
string[] values = attribute.VALUE.Split(new char[] { ',' }); |
|
2793 |
if (values.Length == 2) |
|
2794 |
{ |
|
2795 |
string upStreamValue = values[0]; |
|
2796 |
string downStreamValue = values[1]; |
|
2745 |
string upStreamValue = values[0]; |
|
2746 |
string downStreamValue = values[1]; |
|
2797 | 2747 |
|
2798 |
InputAttributeForSpecBreak(upStreamObj, downStreamObj, upStreamValue, downStreamValue, mapping.SPPIDATTRIBUTENAME); |
|
2799 |
} |
|
2748 |
InputAttributeForSpecBreak(upStreamObj, downStreamObj, upStreamValue, downStreamValue, mapping.SPPIDATTRIBUTENAME); |
|
2800 | 2749 |
} |
2801 | 2750 |
} |
2802 | 2751 |
} |
2803 |
|
|
2804 |
ReleaseCOMObjects(targetLMConnector); |
|
2805 | 2752 |
} |
2753 |
|
|
2754 |
ReleaseCOMObjects(targetLMConnector); |
|
2806 | 2755 |
} |
2807 | 2756 |
} |
2808 |
catch (Exception ex) |
|
2809 |
{ |
|
2810 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2811 |
} |
|
2757 |
|
|
2812 | 2758 |
|
2813 | 2759 |
#region 내부에서만 쓰는 메서드 |
2814 |
void InputAttributeForSpecBreak(object upStreamObj, object downStreamObj, string upStreamValue, string downStreamValue, string sppidAttributeName)
|
|
2760 |
void InputAttributeForSpecBreak(object _upStreamObj, object _downStreamObj, string upStreamValue, string downStreamValue, string sppidAttributeName)
|
|
2815 | 2761 |
{ |
2816 |
try |
|
2762 |
Symbol upStreamSymbol = _upStreamObj as Symbol; |
|
2763 |
Line upStreamLine = _upStreamObj as Line; |
|
2764 |
Symbol downStreamSymbol = _downStreamObj as Symbol; |
|
2765 |
Line downStreamLine = _downStreamObj as Line; |
|
2766 |
// 둘다 Line일 경우 |
|
2767 |
if (upStreamLine != null && downStreamLine != null) |
|
2817 | 2768 |
{ |
2818 |
Symbol upStreamSymbol = upStreamObj as Symbol; |
|
2819 |
Line upStreamLine = upStreamObj as Line; |
|
2820 |
Symbol downStreamSymbol = downStreamObj as Symbol; |
|
2821 |
Line downStreamLine = downStreamObj as Line; |
|
2822 |
// 둘다 Line일 경우 |
|
2823 |
if (upStreamLine != null && downStreamLine != null) |
|
2824 |
{ |
|
2825 |
InputLineAttributeForSpecBreakLine(upStreamLine, sppidAttributeName, upStreamValue); |
|
2826 |
InputLineAttributeForSpecBreakLine(downStreamLine, sppidAttributeName, downStreamValue); |
|
2827 |
} |
|
2828 |
// 둘다 Symbol일 경우 |
|
2829 |
else if (upStreamSymbol != null && downStreamSymbol != null) |
|
2830 |
{ |
|
2831 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamSymbol, downStreamSymbol); |
|
2832 |
LMSymbol upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId); |
|
2833 |
LMSymbol downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId); |
|
2834 |
|
|
2835 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors) |
|
2836 |
{ |
|
2837 |
if (connector.get_ItemStatus() != "Active") |
|
2838 |
continue; |
|
2769 |
InputLineAttributeForSpecBreakLine(upStreamLine, sppidAttributeName, upStreamValue); |
|
2770 |
InputLineAttributeForSpecBreakLine(downStreamLine, sppidAttributeName, downStreamValue); |
|
2771 |
} |
|
2772 |
// 둘다 Symbol일 경우 |
|
2773 |
else if (upStreamSymbol != null && downStreamSymbol != null) |
|
2774 |
{ |
|
2775 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamSymbol, downStreamSymbol); |
|
2776 |
LMSymbol upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId); |
|
2777 |
LMSymbol downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId); |
|
2839 | 2778 |
|
2840 |
if (connector.Id != zeroLenthConnector.Id) |
|
2841 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2842 |
} |
|
2779 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors) |
|
2780 |
{ |
|
2781 |
if (connector.get_ItemStatus() != "Active") |
|
2782 |
continue; |
|
2843 | 2783 |
|
2844 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors) |
|
2845 |
{ |
|
2846 |
if (connector.get_ItemStatus() != "Active") |
|
2847 |
continue; |
|
2784 |
if (connector.Id != zeroLenthConnector.Id) |
|
2785 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2786 |
} |
|
2848 | 2787 |
|
2849 |
if (connector.Id != zeroLenthConnector.Id) |
|
2850 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2851 |
} |
|
2788 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors) |
|
2789 |
{ |
|
2790 |
if (connector.get_ItemStatus() != "Active") |
|
2791 |
continue; |
|
2852 | 2792 |
|
2853 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid1Connectors) |
|
2854 |
{ |
|
2855 |
if (connector.get_ItemStatus() != "Active") |
|
2856 |
continue; |
|
2793 |
if (connector.Id != zeroLenthConnector.Id) |
|
2794 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2795 |
} |
|
2857 | 2796 |
|
2858 |
if (connector.Id != zeroLenthConnector.Id) |
|
2859 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2860 |
} |
|
2797 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid1Connectors) |
|
2798 |
{ |
|
2799 |
if (connector.get_ItemStatus() != "Active") |
|
2800 |
continue; |
|
2861 | 2801 |
|
2862 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid2Connectors) |
|
2863 |
{ |
|
2864 |
if (connector.get_ItemStatus() != "Active") |
|
2865 |
continue; |
|
2802 |
if (connector.Id != zeroLenthConnector.Id) |
|
2803 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2804 |
} |
|
2866 | 2805 |
|
2867 |
if (connector.Id != zeroLenthConnector.Id) |
|
2868 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2869 |
} |
|
2806 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid2Connectors) |
|
2807 |
{ |
|
2808 |
if (connector.get_ItemStatus() != "Active") |
|
2809 |
continue; |
|
2870 | 2810 |
|
2871 |
ReleaseCOMObjects(zeroLenthConnector); |
|
2872 |
ReleaseCOMObjects(upStreamLMSymbol); |
|
2873 |
ReleaseCOMObjects(downStreamLMSymbol); |
|
2811 |
if (connector.Id != zeroLenthConnector.Id) |
|
2812 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2874 | 2813 |
} |
2875 |
else if (upStreamSymbol != null && downStreamLine != null) |
|
2876 |
{ |
|
2877 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamSymbol, downStreamLine); |
|
2878 |
InputLineAttributeForSpecBreakLine(downStreamLine, sppidAttributeName, downStreamValue); |
|
2879 |
LMSymbol upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId); |
|
2880 | 2814 |
|
2881 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors) |
|
2882 |
{ |
|
2883 |
if (connector.get_ItemStatus() != "Active") |
|
2884 |
continue; |
|
2815 |
ReleaseCOMObjects(zeroLenthConnector); |
|
2816 |
ReleaseCOMObjects(upStreamLMSymbol); |
|
2817 |
ReleaseCOMObjects(downStreamLMSymbol); |
|
2818 |
} |
|
2819 |
else if (upStreamSymbol != null && downStreamLine != null) |
|
2820 |
{ |
|
2821 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamSymbol, downStreamLine); |
|
2822 |
InputLineAttributeForSpecBreakLine(downStreamLine, sppidAttributeName, downStreamValue); |
|
2823 |
LMSymbol upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId); |
|
2885 | 2824 |
|
2886 |
if (connector.Id != zeroLenthConnector.Id) |
|
2887 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2888 |
} |
|
2825 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors) |
|
2826 |
{ |
|
2827 |
if (connector.get_ItemStatus() != "Active") |
|
2828 |
continue; |
|
2889 | 2829 |
|
2890 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors) |
|
2891 |
{ |
|
2892 |
if (connector.get_ItemStatus() != "Active") |
|
2893 |
continue; |
|
2830 |
if (connector.Id != zeroLenthConnector.Id) |
|
2831 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2832 |
} |
|
2894 | 2833 |
|
2895 |
if (connector.Id != zeroLenthConnector.Id) |
|
2896 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2897 |
} |
|
2834 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors) |
|
2835 |
{ |
|
2836 |
if (connector.get_ItemStatus() != "Active") |
|
2837 |
continue; |
|
2898 | 2838 |
|
2899 |
ReleaseCOMObjects(zeroLenthConnector);
|
|
2900 |
ReleaseCOMObjects(upStreamLMSymbol);
|
|
2839 |
if (connector.Id != zeroLenthConnector.Id)
|
|
2840 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue);
|
|
2901 | 2841 |
} |
2902 |
else if (upStreamLine != null && downStreamSymbol != null) |
|
2903 |
{ |
|
2904 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamLine, downStreamSymbol); |
|
2905 |
InputLineAttributeForSpecBreakLine(upStreamLine, sppidAttributeName, upStreamValue); |
|
2906 |
LMSymbol downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId); |
|
2907 | 2842 |
|
2908 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid1Connectors) |
|
2909 |
{ |
|
2910 |
if (connector.get_ItemStatus() != "Active") |
|
2911 |
continue; |
|
2843 |
ReleaseCOMObjects(zeroLenthConnector); |
|
2844 |
ReleaseCOMObjects(upStreamLMSymbol); |
|
2845 |
} |
|
2846 |
else if (upStreamLine != null && downStreamSymbol != null) |
|
2847 |
{ |
|
2848 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamLine, downStreamSymbol); |
|
2849 |
InputLineAttributeForSpecBreakLine(upStreamLine, sppidAttributeName, upStreamValue); |
|
2850 |
LMSymbol downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId); |
|
2912 | 2851 |
|
2913 |
if (connector.Id != zeroLenthConnector.Id) |
|
2914 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2915 |
} |
|
2852 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid1Connectors) |
|
2853 |
{ |
|
2854 |
if (connector.get_ItemStatus() != "Active") |
|
2855 |
continue; |
|
2916 | 2856 |
|
2917 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid2Connectors) |
|
2918 |
{ |
|
2919 |
if (connector.get_ItemStatus() != "Active") |
|
2920 |
continue; |
|
2857 |
if (connector.Id != zeroLenthConnector.Id) |
|
2858 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2859 |
} |
|
2921 | 2860 |
|
2922 |
if (connector.Id != zeroLenthConnector.Id) |
|
2923 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2924 |
} |
|
2861 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid2Connectors) |
|
2862 |
{ |
|
2863 |
if (connector.get_ItemStatus() != "Active") |
|
2864 |
continue; |
|
2925 | 2865 |
|
2926 |
ReleaseCOMObjects(zeroLenthConnector);
|
|
2927 |
ReleaseCOMObjects(downStreamLMSymbol);
|
|
2866 |
if (connector.Id != zeroLenthConnector.Id)
|
|
2867 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue);
|
|
2928 | 2868 |
} |
2929 |
} |
|
2930 |
catch (Exception ex) |
|
2931 |
{ |
|
2932 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2869 |
|
|
2870 |
ReleaseCOMObjects(zeroLenthConnector); |
|
2871 |
ReleaseCOMObjects(downStreamLMSymbol); |
|
2933 | 2872 |
} |
2934 | 2873 |
} |
2935 | 2874 |
|
2936 | 2875 |
void InputLineAttributeForSpecBreakLine(Line line, string attrName, string value) |
2937 | 2876 |
{ |
2938 |
try |
|
2877 |
LMModelItem _LMModelItem = dataSource.GetModelItem(line.SPPID.ModelItemId); |
|
2878 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active") |
|
2939 | 2879 |
{ |
2940 |
LMModelItem _LMModelItem = dataSource.GetModelItem(line.SPPID.ModelItemId);
|
|
2941 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active")
|
|
2880 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[attrName];
|
|
2881 |
if (_LMAAttribute != null)
|
|
2942 | 2882 |
{ |
2943 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[attrName]; |
|
2944 |
if (_LMAAttribute != null) |
|
2945 |
{ |
|
2946 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2947 |
_LMAAttribute.set_Value(value); |
|
2948 |
else if (_LMAAttribute.get_Value() != value) |
|
2949 |
_LMAAttribute.set_Value(value); |
|
2950 |
} |
|
2951 |
|
|
2952 |
_LMModelItem.Commit(); |
|
2883 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2884 |
_LMAAttribute.set_Value(value); |
|
2885 |
else if (_LMAAttribute.get_Value() != value) |
|
2886 |
_LMAAttribute.set_Value(value); |
|
2953 | 2887 |
} |
2954 |
if (_LMModelItem != null) |
|
2955 |
ReleaseCOMObjects(_LMModelItem); |
|
2956 |
} |
|
2957 |
catch (Exception ex) |
|
2958 |
{ |
|
2959 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2888 |
|
|
2889 |
_LMModelItem.Commit(); |
|
2960 | 2890 |
} |
2891 |
if (_LMModelItem != null) |
|
2892 |
ReleaseCOMObjects(_LMModelItem); |
|
2961 | 2893 |
} |
2962 | 2894 |
|
2963 | 2895 |
void InputLineAttributeForSpecBreakLMConnector(LMConnector connector, string attrName, string value) |
2964 | 2896 |
{ |
2965 |
try |
|
2897 |
LMModelItem _LMModelItem = dataSource.GetModelItem(connector.ModelItemID); |
|
2898 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active") |
|
2966 | 2899 |
{ |
2967 |
LMModelItem _LMModelItem = dataSource.GetModelItem(connector.ModelItemID);
|
|
2968 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active")
|
|
2900 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[attrName];
|
|
2901 |
if (_LMAAttribute != null)
|
|
2969 | 2902 |
{ |
2970 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[attrName]; |
|
2971 |
if (_LMAAttribute != null) |
|
2972 |
{ |
|
2973 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2974 |
_LMAAttribute.set_Value(value); |
|
2975 |
else if (_LMAAttribute.get_Value() != value) |
|
2976 |
_LMAAttribute.set_Value(value); |
|
2977 |
} |
|
2978 |
|
|
2979 |
_LMModelItem.Commit(); |
|
2903 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2904 |
_LMAAttribute.set_Value(value); |
|
2905 |
else if (_LMAAttribute.get_Value() != value) |
|
2906 |
_LMAAttribute.set_Value(value); |
|
2980 | 2907 |
} |
2981 |
if (_LMModelItem != null) |
|
2982 |
ReleaseCOMObjects(_LMModelItem); |
|
2983 |
} |
|
2984 |
catch (Exception ex) |
|
2985 |
{ |
|
2986 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2908 |
|
|
2909 |
_LMModelItem.Commit(); |
|
2987 | 2910 |
} |
2911 |
if (_LMModelItem != null) |
|
2912 |
ReleaseCOMObjects(_LMModelItem); |
|
2988 | 2913 |
} |
2989 | 2914 |
#endregion |
2990 | 2915 |
} |
... | ... | |
2997 | 2922 |
{ |
2998 | 2923 |
LMSymbol _LMSymbol = null; |
2999 | 2924 |
LMConnector connectedLMConnector = null; |
3000 |
try |
|
2925 |
//if (text.ASSOCIATION && !string.IsNullOrEmpty(text.OWNER) && text.OWNER != "None") |
|
2926 |
if (text.ASSOCIATION) |
|
3001 | 2927 |
{ |
3002 |
//if (text.ASSOCIATION && !string.IsNullOrEmpty(text.OWNER) && text.OWNER != "None")
|
|
3003 |
if (text.ASSOCIATION)
|
|
2928 |
object owner = SPPIDUtil.FindObjectByUID(document, text.OWNER);
|
|
2929 |
if (owner.GetType() == typeof(Symbol))
|
|
3004 | 2930 |
{ |
3005 |
object owner = SPPIDUtil.FindObjectByUID(document, text.OWNER); |
|
3006 |
if (owner.GetType() == typeof(Symbol)) |
|
3007 |
{ |
|
3008 |
Symbol symbol = owner as Symbol; |
|
3009 |
_LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId); |
|
3010 |
if (_LMSymbol != null) |
|
3011 |
{ |
|
3012 |
BaseModel.Attribute attribute = symbol.ATTRIBUTES.Find(x => x.ASSOCITEM == text.UID); |
|
3013 |
if (!string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None") |
|
3014 |
{ |
|
3015 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME)); |
|
3016 |
|
|
3017 |
if (mapping != null) |
|
3018 |
{ |
|
3019 |
double x = 0; |
|
3020 |
double y = 0; |
|
3021 |
|
|
3022 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location); |
|
3023 |
Array array = new double[] { 0, x, y }; |
|
3024 |
|
|
3025 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine); |
|
3026 |
if (_LMLabelPersist != null) |
|
3027 |
{ |
|
3028 |
_LMLabelPersist.Commit(); |
|
3029 |
ReleaseCOMObjects(_LMLabelPersist); |
|
3030 |
} |
|
3031 |
} |
|
3032 |
} |
|
3033 |
} |
|
3034 |
} |
|
3035 |
else if (owner.GetType() == typeof(Line)) |
|
2931 |
Symbol symbol = owner as Symbol; |
|
2932 |
_LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId); |
|
2933 |
if (_LMSymbol != null) |
|
3036 | 2934 |
{ |
3037 |
Line line = owner as Line; |
|
3038 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId); |
|
3039 |
connectedLMConnector = FindTargetLMConnectorForLabel(connectorVertices, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y); |
|
3040 |
|
|
3041 |
if (connectedLMConnector != null) |
|
2935 |
BaseModel.Attribute attribute = symbol.ATTRIBUTES.Find(x => x.ASSOCITEM == text.UID); |
|
2936 |
if (!string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None") |
|
3042 | 2937 |
{ |
3043 |
Association association = line.ASSOCIATIONS.Find(x => x.VALUE == text.UID); |
|
3044 |
List<BaseModel.Attribute> attributes = line.ATTRIBUTES.FindAll(x => x.ATTRIBUTETYPE == association.TYPE); |
|
3045 |
AttributeMapping mapping = null; |
|
3046 |
foreach (var attribute in attributes) |
|
3047 |
{ |
|
3048 |
if (string.IsNullOrEmpty(attribute.VALUE) || attribute.VALUE == "None") |
|
3049 |
continue; |
|
3050 |
|
|
3051 |
mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME)); |
|
3052 |
if (mapping != null) |
|
3053 |
break; |
|
3054 |
} |
|
2938 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME)); |
|
3055 | 2939 |
|
3056 | 2940 |
if (mapping != null) |
3057 | 2941 |
{ |
... | ... | |
3061 | 2945 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location); |
3062 | 2946 |
Array array = new double[] { 0, x, y }; |
3063 | 2947 |
|
3064 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
|
|
2948 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
|
|
3065 | 2949 |
if (_LMLabelPersist != null) |
3066 | 2950 |
{ |
3067 | 2951 |
_LMLabelPersist.Commit(); |
... | ... | |
3071 | 2955 |
} |
3072 | 2956 |
} |
3073 | 2957 |
} |
3074 |
else |
|
2958 |
else if (owner.GetType() == typeof(Line))
|
|
3075 | 2959 |
{ |
3076 |
LMItemNote _LMItemNote = null; |
|
3077 |
LMAAttribute _LMAAttribute = null; |
|
2960 |
Line line = owner as Line; |
|
2961 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId); |
|
2962 |
connectedLMConnector = FindTargetLMConnectorForLabel(connectorVertices, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y); |
|
3078 | 2963 |
|
3079 |
double x = 0; |
|
3080 |
double y = 0; |
|
3081 |
double angle = text.ANGLE; |
|
3082 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, _ETCSetting.TextLocation); |
|
2964 |
if (connectedLMConnector != null) |
|
2965 |
{ |
|
2966 |
Association association = line.ASSOCIATIONS.Find(x => x.VALUE == text.UID); |
|
2967 |
List<BaseModel.Attribute> attributes = line.ATTRIBUTES.FindAll(x => x.ATTRIBUTETYPE == association.TYPE); |
|
2968 |
AttributeMapping mapping = null; |
|
2969 |
foreach (var attribute in attributes) |
|
2970 |
{ |
|
2971 |
if (string.IsNullOrEmpty(attribute.VALUE) || attribute.VALUE == "None") |
|
2972 |
continue; |
|
2973 |
|
|
2974 |
mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME)); |
|
2975 |
if (mapping != null) |
|
2976 |
break; |
|
2977 |
} |
|
2978 |
|
|
2979 |
if (mapping != null) |
|
2980 |
{ |
|
2981 |
double x = 0; |
|
2982 |
double y = 0; |
|
3083 | 2983 |
|
3084 |
_LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, x, y, Rotation: angle); |
|
3085 |
_LMSymbol.Commit(); |
|
3086 |
_LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID); |
|
3087 |
_LMItemNote.Commit(); |
|
3088 |
_LMAAttribute = _LMItemNote.Attributes["Note.Body"]; |
|
3089 |
_LMAAttribute.set_Value(text.VALUE); |
|
3090 |
_LMItemNote.Commit(); |
|
2984 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location); |
|
2985 |
Array array = new double[] { 0, x, y }; |
|
3091 | 2986 |
|
3092 |
if (_LMAAttribute != null) |
|
3093 |
ReleaseCOMObjects(_LMAAttribute); |
|
3094 |
if (_LMItemNote != null) |
|
3095 |
ReleaseCOMObjects(_LMItemNote); |
|
2987 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine); |
|
2988 |
if (_LMLabelPersist != null) |
|
2989 |
{ |
|
2990 |
_LMLabelPersist.Commit(); |
|
2991 |
ReleaseCOMObjects(_LMLabelPersist); |
|
2992 |
} |
|
2993 |
} |
|
2994 |
} |
|
3096 | 2995 |
} |
3097 | 2996 |
} |
3098 |
catch (Exception ex)
|
|
2997 |
else
|
|
3099 | 2998 |
{ |
2999 |
LMItemNote _LMItemNote = null; |
|
3000 |
LMAAttribute _LMAAttribute = null; |
|
3100 | 3001 |
|
3002 |
double x = 0; |
|
3003 |
double y = 0; |
|
3004 |
double angle = text.ANGLE; |
|
3005 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, _ETCSetting.TextLocation); |
|
3006 |
|
|
3007 |
_LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, x, y, Rotation: angle); |
|
3008 |
_LMSymbol.Commit(); |
|
3009 |
_LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID); |
|
3010 |
_LMItemNote.Commit(); |
|
3011 |
_LMAAttribute = _LMItemNote.Attributes["Note.Body"]; |
|
3012 |
_LMAAttribute.set_Value(text.VALUE); |
|
3013 |
_LMItemNote.Commit(); |
|
3014 |
|
|
3015 |
if (_LMAAttribute != null) |
|
3016 |
ReleaseCOMObjects(_LMAAttribute); |
|
3017 |
if (_LMItemNote != null) |
|
3018 |
ReleaseCOMObjects(_LMItemNote); |
|
3101 | 3019 |
} |
3102 |
finally |
|
3103 |
{ |
|
3104 |
if (_LMSymbol != null) |
|
3105 |
ReleaseCOMObjects(_LMSymbol); |
|
3106 |
} |
|
3020 |
if (_LMSymbol != null) |
|
3021 |
ReleaseCOMObjects(_LMSymbol); |
|
3107 | 3022 |
|
3108 | 3023 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
3109 | 3024 |
} |
... | ... | |
3118 | 3033 |
LMItemNote _LMItemNote = null; |
3119 | 3034 |
LMAAttribute _LMAAttribute = null; |
3120 | 3035 |
|
3121 |
try
|
|
3036 |
if (string.IsNullOrEmpty(note.OWNER) || note.OWNER == "None")
|
|
3122 | 3037 |
{ |
3123 |
if (string.IsNullOrEmpty(note.OWNER) || note.OWNER == "None") |
|
3124 |
{ |
|
3125 |
double x = 0; |
|
3126 |
double y = 0; |
|
3038 |
double x = 0; |
|
3039 |
double y = 0; |
|
3127 | 3040 |
|
3128 |
CalcLabelLocation(ref x, ref y, note.SPPID.ORIGINAL_X, note.SPPID.ORIGINAL_Y, note.SPPIDLabelLocation, _ETCSetting.NoteLocation);
|
|
3041 |
CalcLabelLocation(ref x, ref y, note.SPPID.ORIGINAL_X, note.SPPID.ORIGINAL_Y, note.SPPIDLabelLocation, _ETCSetting.NoteLocation); |
|
3129 | 3042 |
|
3130 |
_LMSymbol = _placement.PIDPlaceSymbol(note.SPPID.MAPPINGNAME, x, y); |
|
3131 |
_LMSymbol.Commit(); |
|
3132 |
_LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID); |
|
3133 |
_LMItemNote.Commit(); |
|
3134 |
_LMAAttribute = _LMItemNote.Attributes["Note.Body"]; |
|
3135 |
_LMAAttribute.set_Value(note.VALUE); |
|
3136 |
_LMItemNote.Commit(); |
|
3137 |
} |
|
3043 |
_LMSymbol = _placement.PIDPlaceSymbol(note.SPPID.MAPPINGNAME, x, y); |
|
3044 |
_LMSymbol.Commit(); |
|
3045 |
_LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID); |
|
3046 |
_LMItemNote.Commit(); |
|
3047 |
_LMAAttribute = _LMItemNote.Attributes["Note.Body"]; |
|
3048 |
_LMAAttribute.set_Value(note.VALUE); |
|
3049 |
_LMItemNote.Commit(); |
|
3138 | 3050 |
} |
3139 |
catch (Exception ex) |
|
3140 |
{ |
|
3141 | 3051 |
|
3142 |
} |
|
3143 |
finally |
|
3144 |
{ |
|
3145 |
if (_LMAAttribute != null) |
|
3146 |
ReleaseCOMObjects(_LMAAttribute); |
|
3147 |
if (_LMItemNote != null) |
|
3148 |
ReleaseCOMObjects(_LMItemNote); |
|
3149 |
if (_LMSymbol != null) |
|
3150 |
ReleaseCOMObjects(_LMSymbol); |
|
3151 |
} |
|
3052 |
if (_LMAAttribute != null) |
|
3053 |
ReleaseCOMObjects(_LMAAttribute); |
|
3054 |
if (_LMItemNote != null) |
|
3055 |
ReleaseCOMObjects(_LMItemNote); |
|
3056 |
if (_LMSymbol != null) |
|
3057 |
ReleaseCOMObjects(_LMSymbol); |
|
3152 | 3058 |
|
3153 | 3059 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
3154 | 3060 |
} |
... | ... | |
3230 | 3136 |
double originY = 0; |
3231 | 3137 |
|
3232 | 3138 |
// ID2 Table에서 Original Point 가져옴. |
3233 |
string OriginalPoint = symbolTable.Select(string.Format("UID = {0}",symbol.DBUID))[0]["OriginalPoint"].ToString(); |
|
3139 |
string OriginalPoint = symbolTable.Select(string.Format("UID = {0}", symbol.DBUID))[0]["OriginalPoint"].ToString();
|
|
3234 | 3140 |
SPPIDUtil.ConvertPointBystring(OriginalPoint, ref originX, ref originY); |
3235 | 3141 |
|
3236 | 3142 |
SlopeType slopeType1 = SlopeType.None; |
내보내기 Unified diff