개정판 c2ec33f5
dev issue #000 : fixbug
Change-Id: I547f96764c74274dd6e343a8083083e89844d2ff
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
970 | 970 |
/// <param name="lines"></param> |
971 | 971 |
private void LineModeling(List<Line> lines) |
972 | 972 |
{ |
973 |
_LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME); |
|
974 |
PlaceRunInputs placeRunInputs = new PlaceRunInputs(); |
|
975 |
LMSymbol _LMSymbol1 = null; |
|
976 |
LMSymbol _LMSymbol2 = null; |
|
977 |
Dictionary<LMConnector, List<double[]>> connectorVertices1 = new Dictionary<LMConnector, List<double[]>>(); |
|
978 |
LMConnector targetConnector1 = null; |
|
979 |
Dictionary<LMConnector, List<double[]>> connectorVertices2 = new Dictionary<LMConnector, List<double[]>>(); |
|
980 |
LMConnector targetConnector2 = null; |
|
981 |
|
|
982 |
Line startBranchLine = null; |
|
983 |
Line endBranchLine = null; |
|
984 |
|
|
985 |
// Type, Line, TargetObjet, x, y |
|
986 |
List<Tuple<string, Line, object, double, double>> linePointInfo = new List<Tuple<string, Line, object, double, double>>(); |
|
987 |
// Point 정리 |
|
988 |
for (int i = 0; i < lines.Count; i++) |
|
973 |
try |
|
989 | 974 |
{ |
990 |
Line line = lines[i]; |
|
991 |
if (i == 0 || i + 1 != lines.Count) |
|
992 |
{ |
|
993 |
// 시작점에 연결된 Symbol 찾기 |
|
994 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[0].CONNECTEDITEM); |
|
995 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
996 |
{ |
|
997 |
Symbol symbol1 = connItem as Symbol; |
|
998 |
_LMSymbol1 = GetTargetSymbol(symbol1, line); |
|
999 |
if (_LMSymbol1 != null) |
|
975 |
_LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME); |
|
976 |
PlaceRunInputs placeRunInputs = new PlaceRunInputs(); |
|
977 |
LMSymbol _LMSymbol1 = null; |
|
978 |
LMSymbol _LMSymbol2 = null; |
|
979 |
Dictionary<LMConnector, List<double[]>> connectorVertices1 = new Dictionary<LMConnector, List<double[]>>(); |
|
980 |
LMConnector targetConnector1 = null; |
|
981 |
Dictionary<LMConnector, List<double[]>> connectorVertices2 = new Dictionary<LMConnector, List<double[]>>(); |
|
982 |
LMConnector targetConnector2 = null; |
|
983 |
|
|
984 |
Line startBranchLine = null; |
|
985 |
Line endBranchLine = null; |
|
986 |
|
|
987 |
// Type, Line, TargetObjet, x, y |
|
988 |
List<Tuple<string, Line, object, double, double>> linePointInfo = new List<Tuple<string, Line, object, double, double>>(); |
|
989 |
// Point 정리 |
|
990 |
for (int i = 0; i < lines.Count; i++) |
|
991 |
{ |
|
992 |
Line line = lines[i]; |
|
993 |
if (i == 0 || i + 1 != lines.Count) |
|
994 |
{ |
|
995 |
// 시작점에 연결된 Symbol 찾기 |
|
996 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[0].CONNECTEDITEM); |
|
997 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
1000 | 998 |
{ |
1001 |
double x = line.SPPID.START_X; |
|
1002 |
double y = line.SPPID.START_Y; |
|
1003 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol1); |
|
1004 |
if (connector != null) |
|
999 |
Symbol symbol1 = connItem as Symbol; |
|
1000 |
_LMSymbol1 = GetTargetSymbol(symbol1, line); |
|
1001 |
if (_LMSymbol1 != null) |
|
1005 | 1002 |
{ |
1006 |
GetTargetSymbolConnectorPoint(connector, symbol1, ref x, ref y); |
|
1007 |
line.SPPID.START_X = x; |
|
1008 |
line.SPPID.START_Y = y; |
|
1003 |
double x = line.SPPID.START_X; |
|
1004 |
double y = line.SPPID.START_Y; |
|
1005 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol1); |
|
1006 |
if (connector != null) |
|
1007 |
{ |
|
1008 |
GetTargetSymbolConnectorPoint(connector, symbol1, ref x, ref y); |
|
1009 |
line.SPPID.START_X = x; |
|
1010 |
line.SPPID.START_Y = y; |
|
1011 |
} |
|
1012 |
|
|
1013 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol1, x, y)); |
|
1009 | 1014 |
} |
1015 |
else |
|
1016 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1017 |
} |
|
1018 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem)) |
|
1019 |
{ |
|
1020 |
connectorVertices1 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId); |
|
1021 |
targetConnector1 = FindTargetLMConnector(connectorVertices1, line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1010 | 1022 |
|
1011 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol1, x, y)); |
|
1023 |
if (targetConnector1 != null) |
|
1024 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector1, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1025 |
else |
|
1026 |
{ |
|
1027 |
startBranchLine = connItem as Line; |
|
1028 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1029 |
} |
|
1012 | 1030 |
} |
1013 | 1031 |
else |
1014 | 1032 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
1033 |
|
|
1015 | 1034 |
} |
1016 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem))
|
|
1035 |
if (i + 1 == lines.Count)
|
|
1017 | 1036 |
{ |
1018 |
connectorVertices1 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId);
|
|
1019 |
targetConnector1 = FindTargetLMConnector(connectorVertices1, line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y);
|
|
1037 |
// 끝점에 연결된 Symbol 찾기
|
|
1038 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[1].CONNECTEDITEM);
|
|
1020 | 1039 |
|
1021 |
if (targetConnector1 != null) |
|
1022 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector1, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1023 |
else |
|
1024 |
{ |
|
1025 |
startBranchLine = connItem as Line; |
|
1040 |
if (i != 0) |
|
1026 | 1041 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
1027 |
} |
|
1028 |
} |
|
1029 |
else |
|
1030 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1031 |
|
|
1032 |
} |
|
1033 |
if (i + 1 == lines.Count) |
|
1034 |
{ |
|
1035 |
// 끝점에 연결된 Symbol 찾기 |
|
1036 |
object connItem = SPPIDUtil.FindObjectByUID(document, line.CONNECTORS[1].CONNECTEDITEM); |
|
1037 | 1042 |
|
1038 |
if (i != 0) |
|
1039 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.START_X, line.SPPID.START_Y)); |
|
1040 |
|
|
1041 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
1042 |
{ |
|
1043 |
Symbol symbol2 = connItem as Symbol; |
|
1044 |
_LMSymbol2 = GetTargetSymbol(connItem as Symbol, line); |
|
1045 |
if (_LMSymbol2 != null) |
|
1043 |
if (connItem != null && connItem.GetType() == typeof(Symbol)) |
|
1046 | 1044 |
{ |
1047 |
double x = line.SPPID.END_X; |
|
1048 |
double y = line.SPPID.END_Y; |
|
1049 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol2); |
|
1050 |
if (connector != null) |
|
1045 |
Symbol symbol2 = connItem as Symbol; |
|
1046 |
_LMSymbol2 = GetTargetSymbol(connItem as Symbol, line); |
|
1047 |
if (_LMSymbol2 != null) |
|
1051 | 1048 |
{ |
1052 |
GetTargetSymbolConnectorPoint(connector, symbol2, ref x, ref y); |
|
1053 |
line.SPPID.END_X = x; |
|
1054 |
line.SPPID.END_Y = y; |
|
1055 |
} |
|
1049 |
double x = line.SPPID.END_X; |
|
1050 |
double y = line.SPPID.END_Y; |
|
1051 |
Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, line.UID, symbol2); |
|
1052 |
if (connector != null) |
|
1053 |
{ |
|
1054 |
GetTargetSymbolConnectorPoint(connector, symbol2, ref x, ref y); |
|
1055 |
line.SPPID.END_X = x; |
|
1056 |
line.SPPID.END_Y = y; |
|
1057 |
} |
|
1056 | 1058 |
|
1057 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol2, x, y)); |
|
1059 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("SYMBOL", line, _LMSymbol2, x, y)); |
|
1060 |
} |
|
1061 |
else |
|
1062 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1058 | 1063 |
} |
1059 |
else |
|
1060 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1061 |
} |
|
1062 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem)) |
|
1063 |
{ |
|
1064 |
connectorVertices2 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId); |
|
1065 |
targetConnector2 = FindTargetLMConnector(connectorVertices2, line.SPPID.END_X, line.SPPID.END_Y, line.SPPID.START_X, line.SPPID.START_Y); |
|
1064 |
else if (connItem != null && connItem.GetType() == typeof(Line) && !lines.Contains(connItem)) |
|
1065 |
{ |
|
1066 |
connectorVertices2 = GetPipeRunVertices(((Line)connItem).SPPID.ModelItemId); |
|
1067 |
targetConnector2 = FindTargetLMConnector(connectorVertices2, line.SPPID.END_X, line.SPPID.END_Y, line.SPPID.START_X, line.SPPID.START_Y); |
|
1066 | 1068 |
|
1067 |
if (targetConnector2 != null) |
|
1068 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector2, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1069 |
if (targetConnector2 != null) |
|
1070 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>("LINE", line, targetConnector2, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1071 |
else |
|
1072 |
{ |
|
1073 |
endBranchLine = connItem as Line; |
|
1074 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1075 |
} |
|
1076 |
} |
|
1069 | 1077 |
else |
1070 |
{ |
|
1071 |
endBranchLine = connItem as Line; |
|
1072 | 1078 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
1073 |
} |
|
1074 | 1079 |
} |
1075 |
else |
|
1076 |
linePointInfo.Add(new Tuple<string, Line, object, double, double>(null, line, null, line.SPPID.END_X, line.SPPID.END_Y)); |
|
1077 | 1080 |
} |
1078 |
} |
|
1079 | 1081 |
|
1080 |
double prevX = double.NaN; |
|
1081 |
double prevY = double.NaN; |
|
1082 |
SlopeType prevSlopeType = SlopeType.None; |
|
1083 |
for (int i = 0; i < linePointInfo.Count; i++) |
|
1084 |
{ |
|
1085 |
Tuple<string, Line, object, double, double> item = linePointInfo[i]; |
|
1086 |
Line line = item.Item2; |
|
1087 |
double x = item.Item4; |
|
1088 |
double y = item.Item5; |
|
1089 |
SlopeType slopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1090 |
// Symbol일 경우 바로 Input Point |
|
1091 |
if (item.Item1 == "SYMBOL") |
|
1092 |
placeRunInputs.AddSymbolTarget(item.Item3 as LMSymbol, x, y); |
|
1093 |
else |
|
1082 |
double prevX = double.NaN; |
|
1083 |
double prevY = double.NaN; |
|
1084 |
SlopeType prevSlopeType = SlopeType.None; |
|
1085 |
for (int i = 0; i < linePointInfo.Count; i++) |
|
1094 | 1086 |
{ |
1095 |
SPPIDUtil.ConvertGridPoint(ref x, ref y); |
|
1096 |
// i == 0은 그대로 사용 |
|
1097 |
if (i != 0) |
|
1087 |
Tuple<string, Line, object, double, double> item = linePointInfo[i]; |
|
1088 |
Line line = item.Item2; |
|
1089 |
double x = item.Item4; |
|
1090 |
double y = item.Item5; |
|
1091 |
SlopeType slopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1092 |
// Symbol일 경우 바로 Input Point |
|
1093 |
if (item.Item1 == "SYMBOL") |
|
1098 | 1094 |
{ |
1099 |
Tuple<string, Line, object, double, double> prevItem = linePointInfo[i - 1];
|
|
1100 |
// y 좌표가 같아야함 및 Symbol 좌표가 정확하지 않으므로 한번더 보정
|
|
1101 |
if (prevSlopeType == SlopeType.HORIZONTAL)
|
|
1102 |
{
|
|
1103 |
y = prevY;
|
|
1104 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref y);
|
|
1105 |
}
|
|
1106 |
else if (prevSlopeType == SlopeType.VERTICAL)
|
|
1095 |
LMSymbol targetSymbol = item.Item3 as LMSymbol;
|
|
1096 |
placeRunInputs.AddSymbolTarget(targetSymbol, x, y);
|
|
1097 |
}
|
|
1098 |
else
|
|
1099 |
{
|
|
1100 |
SPPIDUtil.ConvertGridPoint(ref x, ref y);
|
|
1101 |
// i == 0은 그대로 사용
|
|
1102 |
if (i != 0)
|
|
1107 | 1103 |
{ |
1108 |
x = prevX; |
|
1109 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref x); |
|
1104 |
Tuple<string, Line, object, double, double> prevItem = linePointInfo[i - 1]; |
|
1105 |
// y 좌표가 같아야함 및 Symbol 좌표가 정확하지 않으므로 한번더 보정 |
|
1106 |
if (prevSlopeType == SlopeType.HORIZONTAL) |
|
1107 |
{ |
|
1108 |
y = prevY; |
|
1109 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref y); |
|
1110 |
} |
|
1111 |
else if (prevSlopeType == SlopeType.VERTICAL) |
|
1112 |
{ |
|
1113 |
x = prevX; |
|
1114 |
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref x); |
|
1115 |
} |
|
1116 |
|
|
1117 |
// 마지막이 Symbol일 경우는 Symbol의 좌표를 따라감 |
|
1118 |
if (i + 1 == linePointInfo.Count - 1 && linePointInfo[i + 1].Item1 == "SYMBOL") |
|
1119 |
{ |
|
1120 |
Line nextLine = linePointInfo[i + 1].Item2; |
|
1121 |
SlopeType nextSlopeType = SPPIDUtil.CalcSlope(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y); |
|
1122 |
if (slopeType == SlopeType.HORIZONTAL) |
|
1123 |
y = linePointInfo[i + 1].Item5; |
|
1124 |
else if (slopeType == SlopeType.VERTICAL) |
|
1125 |
x = linePointInfo[i + 1].Item4; |
|
1126 |
} |
|
1110 | 1127 |
} |
1111 | 1128 |
|
1112 |
// 마지막이 Symbol일 경우는 Symbol의 좌표를 따라감 |
|
1113 |
if (i + 1 == linePointInfo.Count - 1 && linePointInfo[i + 1].Item1 == "SYMBOL") |
|
1129 |
if (item.Item1 == "LINE") |
|
1114 | 1130 |
{ |
1115 |
Line nextLine = linePointInfo[i + 1].Item2; |
|
1116 |
SlopeType nextSlopeType = SPPIDUtil.CalcSlope(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y); |
|
1117 |
if (slopeType == SlopeType.HORIZONTAL) |
|
1118 |
y = linePointInfo[i + 1].Item5; |
|
1119 |
else if (slopeType == SlopeType.VERTICAL) |
|
1120 |
x = linePointInfo[i + 1].Item4; |
|
1131 |
LMConnector targetConnector = item.Item3 as LMConnector; |
|
1132 |
placeRunInputs.AddConnectorTarget(targetConnector, x, y); |
|
1121 | 1133 |
} |
1134 |
|
|
1135 |
else |
|
1136 |
placeRunInputs.AddPoint(x, y); |
|
1122 | 1137 |
} |
1123 | 1138 |
|
1124 |
if (item.Item1 == "LINE") |
|
1125 |
placeRunInputs.AddConnectorTarget(item.Item3 as LMConnector, x, y); |
|
1126 |
else |
|
1127 |
placeRunInputs.AddPoint(x, y); |
|
1139 |
prevX = x; |
|
1140 |
prevY = y; |
|
1141 |
prevSlopeType = slopeType; |
|
1128 | 1142 |
} |
1129 | 1143 |
|
1130 |
prevX = x; |
|
1131 |
prevY = y; |
|
1132 |
prevSlopeType = slopeType; |
|
1133 |
} |
|
1144 |
LMConnector _lMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
|
1134 | 1145 |
|
1135 |
LMConnector _lMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
|
1146 |
if (_lMConnector != null) |
|
1147 |
{ |
|
1148 |
bool bStart = false; |
|
1149 |
bool bEnd = false; |
|
1136 | 1150 |
|
1137 |
if (_lMConnector != null) |
|
1138 |
{ |
|
1139 |
bool bStart = false; |
|
1140 |
bool bEnd = false; |
|
1151 |
NeedReModeling(lines[0], _LMSymbol1, ref bStart); |
|
1152 |
NeedReModeling(lines[lines.Count - 1], _LMSymbol2, ref bEnd); |
|
1141 | 1153 |
|
1142 |
NeedReModeling(lines[0], _LMSymbol1, ref bStart); |
|
1143 |
NeedReModeling(lines[lines.Count - 1], _LMSymbol2, ref bEnd); |
|
1154 |
if (bStart || bEnd) |
|
1155 |
ReModelingLine(lines, _lMConnector, _LMSymbol1, _LMSymbol2, bStart, bEnd); |
|
1156 |
else |
|
1157 |
{ |
|
1158 |
foreach (var line in lines) |
|
1159 |
line.SPPID.ModelItemId = _lMConnector.ModelItemID; |
|
1160 |
_lMConnector.Commit(); |
|
1161 |
} |
|
1144 | 1162 |
|
1145 |
if (bStart || bEnd) |
|
1146 |
ReModelingLine(lines, _lMConnector, _LMSymbol1, _LMSymbol2, bStart, bEnd); |
|
1147 |
else |
|
1148 |
{ |
|
1149 |
foreach (var line in lines) |
|
1150 |
line.SPPID.ModelItemId = _lMConnector.ModelItemID; |
|
1151 |
_lMConnector.Commit(); |
|
1163 |
if (startBranchLine != null || endBranchLine != null) |
|
1164 |
BranchLines.Add(new Tuple<string, Line, Line>(lines[0].SPPID.ModelItemId, startBranchLine, endBranchLine)); |
|
1152 | 1165 |
} |
1153 | 1166 |
|
1154 |
if (startBranchLine != null || endBranchLine != null) |
|
1155 |
BranchLines.Add(new Tuple<string, Line, Line>(lines[0].SPPID.ModelItemId, startBranchLine, endBranchLine)); |
|
1156 |
} |
|
1157 |
|
|
1158 |
if (_LMSymbol1 != null) |
|
1159 |
ReleaseCOMObjects(_LMSymbol1); |
|
1160 |
if (_LMSymbol2 != null) |
|
1161 |
ReleaseCOMObjects(_LMSymbol2); |
|
1162 |
if (targetConnector1 != null) |
|
1163 |
ReleaseCOMObjects(targetConnector1); |
|
1164 |
if (targetConnector2 != null) |
|
1165 |
ReleaseCOMObjects(targetConnector2); |
|
1166 |
foreach (var item in connectorVertices1) |
|
1167 |
ReleaseCOMObjects(item.Key); |
|
1168 |
foreach (var item in connectorVertices2) |
|
1169 |
ReleaseCOMObjects(item.Key); |
|
1167 |
if (_LMSymbol1 != null) |
|
1168 |
ReleaseCOMObjects(_LMSymbol1); |
|
1169 |
if (_LMSymbol2 != null) |
|
1170 |
ReleaseCOMObjects(_LMSymbol2); |
|
1171 |
if (targetConnector1 != null) |
|
1172 |
ReleaseCOMObjects(targetConnector1); |
|
1173 |
if (targetConnector2 != null) |
|
1174 |
ReleaseCOMObjects(targetConnector2); |
|
1175 |
foreach (var item in connectorVertices1) |
|
1176 |
ReleaseCOMObjects(item.Key); |
|
1177 |
foreach (var item in connectorVertices2) |
|
1178 |
ReleaseCOMObjects(item.Key); |
|
1170 | 1179 |
|
1171 |
ReleaseCOMObjects(_lMConnector); |
|
1172 |
ReleaseCOMObjects(placeRunInputs); |
|
1173 |
ReleaseCOMObjects(_LMAItem); |
|
1180 |
ReleaseCOMObjects(_lMConnector); |
|
1181 |
ReleaseCOMObjects(placeRunInputs); |
|
1182 |
ReleaseCOMObjects(_LMAItem); |
|
1183 |
} |
|
1184 |
catch (Exception ex) |
|
1185 |
{ |
|
1186 |
StringBuilder sb = new StringBuilder(); |
|
1187 |
foreach (var item in lines) |
|
1188 |
{ |
|
1189 |
sb.AppendLine(item.UID); |
|
1190 |
} |
|
1191 |
throw new Exception(sb.ToString()); |
|
1192 |
} |
|
1174 | 1193 |
} |
1175 | 1194 |
|
1176 | 1195 |
private void NeedReModeling(Line line, LMSymbol symbol, ref bool result) |
... | ... | |
2959 | 2978 |
_LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId); |
2960 | 2979 |
if (_LMSymbol != null) |
2961 | 2980 |
{ |
2962 |
Association association = symbol.ASSOCIATIONS.Find(x => x.VALUE == text.UID); |
|
2963 |
List<BaseModel.Attribute> attributes = symbol.ATTRIBUTES.FindAll(x => x.ATTRIBUTETYPE == association.TYPE); |
|
2964 |
AttributeMapping mapping = null; |
|
2965 |
foreach (var attribute in attributes) |
|
2981 |
BaseModel.Attribute attribute = symbol.ATTRIBUTES.Find(x => x.ASSOCITEM == text.UID); |
|
2982 |
if (!string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None") |
|
2966 | 2983 |
{ |
2967 |
if (string.IsNullOrEmpty(attribute.VALUE) || attribute.VALUE == "None") |
|
2968 |
continue; |
|
2984 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME)); |
|
2969 | 2985 |
|
2970 |
mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME)); |
|
2971 | 2986 |
if (mapping != null) |
2972 |
break; |
|
2973 |
} |
|
2987 |
{ |
|
2988 |
double x = 0; |
|
2989 |
double y = 0; |
|
2974 | 2990 |
|
2975 |
if (mapping != null) |
|
2976 |
{ |
|
2977 |
double x = 0; |
|
2978 |
double y = 0; |
|
2991 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location); |
|
2992 |
Array array = new double[] { 0, x, y }; |
|
2979 | 2993 |
|
2980 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location); |
|
2981 |
Array array = new double[] { 0, x, y }; |
|
2982 |
|
|
2983 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine); |
|
2984 |
if (_LMLabelPersist!=null) |
|
2985 |
{ |
|
2986 |
_LMLabelPersist.Commit(); |
|
2987 |
ReleaseCOMObjects(_LMLabelPersist); |
|
2994 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine); |
|
2995 |
if (_LMLabelPersist != null) |
|
2996 |
{ |
|
2997 |
_LMLabelPersist.Commit(); |
|
2998 |
ReleaseCOMObjects(_LMLabelPersist); |
|
2999 |
} |
|
2988 | 3000 |
} |
2989 | 3001 |
} |
2990 | 3002 |
} |
내보내기 Unified diff