개정판 f1a7faf9
dev issue #1163 : Priority Symbol 순서 수정 및 Bug fix
Change-Id: I84b52947111e3dd32d0e12ba4eb8b2ef7773f95c
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
40 | 40 |
int CurrentCount; |
41 | 41 |
List<Tuple<string, Line, Line>> BranchLines = new List<Tuple<string, Line, Line>>(); |
42 | 42 |
List<string> ZeroLengthModelItemID = new List<string>(); |
43 |
List<Symbol> prioritySymbols; |
|
43 | 44 |
|
44 | 45 |
public AutoModeling(SPPID_Document document, dynamic application, Ingr.RAD2D.Application radApp) |
45 | 46 |
{ |
... | ... | |
124 | 125 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText); |
125 | 126 |
|
126 | 127 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Priority Symbol Modeling"); |
127 |
List<Symbol> prioritySymbols = GetPrioritySymbol();
|
|
128 |
prioritySymbols = GetPrioritySymbol(); |
|
128 | 129 |
foreach (var item in prioritySymbols) |
129 | 130 |
{ |
130 | 131 |
try |
131 | 132 |
{ |
132 |
SymbolModelingByPriority(item);
|
|
133 |
SymbolModelingBySymbol(item);
|
|
133 | 134 |
} |
134 | 135 |
catch (Exception ex) |
135 | 136 |
{ |
... | ... | |
284 | 285 |
Log.Write(ex.Message); |
285 | 286 |
Log.Write(ex.StackTrace); |
286 | 287 |
} |
287 |
|
|
288 |
|
|
288 | 289 |
|
289 | 290 |
// FlowMark Modeling |
290 | 291 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Flow Mark Modeling"); |
... | ... | |
300 | 301 |
Log.Write(ex.Message); |
301 | 302 |
Log.Write(ex.StackTrace); |
302 | 303 |
} |
303 |
|
|
304 |
|
|
304 | 305 |
|
305 | 306 |
// Note Symbol Modeling |
306 | 307 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Note Symbol Modeling"); |
... | ... | |
423 | 424 |
Log.Write(ex.Message); |
424 | 425 |
Log.Write(ex.StackTrace); |
425 | 426 |
} |
426 |
|
|
427 |
|
|
427 | 428 |
// TrimLineRun Line Join |
428 | 429 |
foreach (TrimLine trimLine in document.TRIMLINES) |
429 | 430 |
try |
... | ... | |
726 | 727 |
int mirror = 0; |
727 | 728 |
double angle = symbol.ANGLE; |
728 | 729 |
|
729 |
SPPIDUtil.ConvertGridPoint(ref x, ref y); |
|
730 |
|
|
731 | 730 |
// OPC 일경우 180도 일때 Mirror |
732 | 731 |
if (mappingPath.Contains("Piping OPC's") && angle == Math.PI) |
733 | 732 |
mirror = 1; |
... | ... | |
965 | 964 |
tempRange[3] = Math.Max(tempRange[3], y2); |
966 | 965 |
|
967 | 966 |
foreach (var childSymbol in symbol.ChildSymbols) |
968 |
GetSPPIDChildSymbolRange(childSymbol, ref range);
|
|
967 |
GetSPPIDChildSymbolRange(childSymbol, ref tempRange);
|
|
969 | 968 |
|
970 | 969 |
ReleaseCOMObjects(_TargetItem); |
971 | 970 |
} |
... | ... | |
1219 | 1218 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
1220 | 1219 |
} |
1221 | 1220 |
|
1222 |
private void SymbolModelingByPriority(Symbol symbol) |
|
1223 |
{ |
|
1224 |
// Angle, Center, 우선순위 모델링 |
|
1225 |
if (string.IsNullOrEmpty(symbol.SPPID.RepresentationId)) |
|
1226 |
{ |
|
1227 |
SymbolModeling(symbol, null); |
|
1228 |
List<Symbol> group = new List<Symbol>() { symbol }; |
|
1229 |
SPPIDUtil.FindConnectedSymbolGroup(document, symbol, group); |
|
1230 |
List<Symbol> endModeling = new List<Symbol>() { symbol }; |
|
1231 |
|
|
1232 |
while (endModeling.Count != group.Count) |
|
1233 |
{ |
|
1234 |
foreach (var item in group) |
|
1235 |
{ |
|
1236 |
if (!endModeling.Contains(item)) |
|
1237 |
{ |
|
1238 |
bool result = false; |
|
1239 |
foreach (var connector in item.CONNECTORS) |
|
1240 |
{ |
|
1241 |
Symbol connSymbol = group.Find(x => x.UID == connector.CONNECTEDITEM); |
|
1242 |
if (connSymbol == item) |
|
1243 |
throw new Exception(""); |
|
1244 |
|
|
1245 |
if (connSymbol != null && endModeling.Contains(connSymbol)) |
|
1246 |
{ |
|
1247 |
SymbolModeling(item, connSymbol); |
|
1248 |
endModeling.Add(item); |
|
1249 |
result = true; |
|
1250 |
break; |
|
1251 |
} |
|
1252 |
} |
|
1253 |
|
|
1254 |
if (result) |
|
1255 |
break; |
|
1256 |
} |
|
1257 |
} |
|
1258 |
} |
|
1259 |
|
|
1260 |
SymbolModelingBySymbol(symbol); |
|
1261 |
} |
|
1262 |
} |
|
1263 |
|
|
1264 | 1221 |
/// <summary> |
1265 | 1222 |
/// 첫 진입점 |
1266 | 1223 |
/// </summary> |
1267 | 1224 |
/// <param name="symbol"></param> |
1268 | 1225 |
private void SymbolModelingBySymbol(Symbol symbol) |
1269 | 1226 |
{ |
1227 |
SymbolModeling(symbol, null); |
|
1270 | 1228 |
List<object> endObjects = new List<object>(); |
1271 | 1229 |
endObjects.Add(symbol); |
1230 |
|
|
1272 | 1231 |
foreach (var connector in symbol.CONNECTORS) |
1273 | 1232 |
{ |
1274 | 1233 |
object connItem = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM); |
... | ... | |
1282 | 1241 |
{ |
1283 | 1242 |
SymbolModeling(connSymbol, symbol); |
1284 | 1243 |
} |
1285 |
SymbolModelingByNeerPrioritySymbolLoop(connSymbol, endObjects);
|
|
1244 |
SymbolModelingByNeerSymbolLoop(connSymbol, endObjects); |
|
1286 | 1245 |
} |
1287 | 1246 |
else if (connItem.GetType() == typeof(Line)) |
1288 | 1247 |
{ |
1289 | 1248 |
Line connLine = connItem as Line; |
1290 |
SymbolModelingByNeerPriorityLineLoop(connLine, endObjects, symbol);
|
|
1249 |
SymbolModelingByNeerLineLoop(connLine, endObjects, symbol); |
|
1291 | 1250 |
} |
1292 | 1251 |
} |
1293 | 1252 |
} |
1294 | 1253 |
} |
1295 | 1254 |
|
1296 |
private void SymbolModelingByNeerPrioritySymbolLoop(Symbol symbol, List<object> endObjects)
|
|
1255 |
private void SymbolModelingByNeerSymbolLoop(Symbol symbol, List<object> endObjects) |
|
1297 | 1256 |
{ |
1298 | 1257 |
foreach (var connector in symbol.CONNECTORS) |
1299 | 1258 |
{ |
... | ... | |
1310 | 1269 |
{ |
1311 | 1270 |
SymbolModeling(connSymbol, symbol); |
1312 | 1271 |
} |
1313 |
SymbolModelingByNeerPrioritySymbolLoop(connSymbol, endObjects);
|
|
1272 |
SymbolModelingByNeerSymbolLoop(connSymbol, endObjects); |
|
1314 | 1273 |
} |
1315 | 1274 |
else if (connItem.GetType() == typeof(Line)) |
1316 | 1275 |
{ |
1317 | 1276 |
Line connLine = connItem as Line; |
1318 |
SymbolModelingByNeerPriorityLineLoop(connLine, endObjects, symbol);
|
|
1277 |
SymbolModelingByNeerLineLoop(connLine, endObjects, symbol); |
|
1319 | 1278 |
} |
1320 | 1279 |
} |
1321 | 1280 |
} |
1322 | 1281 |
} |
1323 | 1282 |
} |
1324 | 1283 |
|
1325 |
private void SymbolModelingByNeerPriorityLineLoop(Line line, List<object> endObjects, Symbol prevSymbol)
|
|
1284 |
private void SymbolModelingByNeerLineLoop(Line line, List<object> endObjects, Symbol prevSymbol) |
|
1326 | 1285 |
{ |
1327 | 1286 |
foreach (var connector in line.CONNECTORS) |
1328 | 1287 |
{ |
... | ... | |
1339 | 1298 |
{ |
1340 | 1299 |
List<Symbol> group = new List<Symbol>(); |
1341 | 1300 |
SPPIDUtil.FindConnectedSymbolGroup(document, connSymbol, group); |
1342 |
if (group.Count == 3) |
|
1301 |
Symbol priority = prioritySymbols.Find(x => group.Contains(x)); |
|
1302 |
List<Symbol> endModelingGroup = new List<Symbol>(); |
|
1303 |
if (priority != null) |
|
1343 | 1304 |
{ |
1344 |
Symbol symbol = SPPIDUtil.FindCenterAtThreeSymbols(document, group); |
|
1345 |
SymbolModeling(symbol, null); |
|
1346 |
foreach (var _temp in group) |
|
1347 |
if (_temp != symbol && string.IsNullOrEmpty(_temp.SPPID.RepresentationId)) |
|
1348 |
SymbolModeling(_temp, symbol); |
|
1305 |
SymbolGroupModeling(priority, group); |
|
1349 | 1306 |
|
1350 | 1307 |
// Range 겹치는지 확인해야함 |
1351 | 1308 |
double[] prevRange = null; |
... | ... | |
1366 | 1323 |
foreach (var _temp in group) |
1367 | 1324 |
SPPIDUtil.CalcNewCoordinateForSymbol(_temp, prevSymbol, distanceX, distanceY); |
1368 | 1325 |
|
1369 |
SymbolModeling(symbol, null); |
|
1370 |
foreach (var _temp in group) |
|
1371 |
if (_temp != symbol && string.IsNullOrEmpty(_temp.SPPID.RepresentationId)) |
|
1372 |
SymbolModeling(_temp, symbol); |
|
1326 |
SymbolGroupModeling(priority, group); |
|
1373 | 1327 |
} |
1374 | 1328 |
} |
1375 | 1329 |
else |
... | ... | |
1397 | 1351 |
} |
1398 | 1352 |
} |
1399 | 1353 |
} |
1400 |
SymbolModelingByNeerPrioritySymbolLoop(connSymbol, endObjects);
|
|
1354 |
SymbolModelingByNeerSymbolLoop(connSymbol, endObjects); |
|
1401 | 1355 |
} |
1402 | 1356 |
else if (connItem.GetType() == typeof(Line)) |
1403 | 1357 |
{ |
1404 | 1358 |
Line connLine = connItem as Line; |
1405 | 1359 |
if (!SPPIDUtil.IsBranchLine(connLine, line)) |
1406 |
SymbolModelingByNeerPriorityLineLoop(connLine, endObjects, prevSymbol);
|
|
1360 |
SymbolModelingByNeerLineLoop(connLine, endObjects, prevSymbol); |
|
1407 | 1361 |
} |
1408 | 1362 |
} |
1409 | 1363 |
} |
1410 | 1364 |
} |
1411 | 1365 |
} |
1412 | 1366 |
|
1413 |
|
|
1367 |
private void SymbolGroupModeling(Symbol firstSymbol, List<Symbol> group) |
|
1368 |
{ |
|
1369 |
List<Symbol> endModelingGroup = new List<Symbol>(); |
|
1370 |
SymbolModeling(firstSymbol, null); |
|
1371 |
endModelingGroup.Add(firstSymbol); |
|
1372 |
while (endModelingGroup.Count != group.Count) |
|
1373 |
{ |
|
1374 |
foreach (var _symbol in group) |
|
1375 |
{ |
|
1376 |
if (!endModelingGroup.Contains(_symbol)) |
|
1377 |
{ |
|
1378 |
foreach (var _connector in _symbol.CONNECTORS) |
|
1379 |
{ |
|
1380 |
Symbol _connSymbol = SPPIDUtil.FindObjectByUID(document, _connector.CONNECTEDITEM) as Symbol; |
|
1381 |
if (_connSymbol != null && endModelingGroup.Contains(_connSymbol)) |
|
1382 |
{ |
|
1383 |
SymbolModeling(_symbol, _connSymbol); |
|
1384 |
endModelingGroup.Add(_symbol); |
|
1385 |
break; |
|
1386 |
} |
|
1387 |
} |
|
1388 |
} |
|
1389 |
} |
|
1390 |
} |
|
1391 |
} |
|
1414 | 1392 |
|
1415 | 1393 |
/// <summary> |
1416 | 1394 |
/// 심볼을 실제로 Modeling할때 ChildSymbol이 있다면 Modeling하는 메서드 |
... | ... | |
1599 | 1577 |
if (item.Item1 == "SYMBOL") |
1600 | 1578 |
{ |
1601 | 1579 |
LMSymbol targetSymbol = item.Item3 as LMSymbol; |
1602 |
placeRunInputs.AddSymbolTarget(targetSymbol, x, y, true);
|
|
1580 |
placeRunInputs.AddSymbolTarget(targetSymbol, x, y); |
|
1603 | 1581 |
} |
1604 | 1582 |
else |
1605 | 1583 |
{ |
... | ... | |
1635 | 1613 |
if (item.Item1 == "LINE") |
1636 | 1614 |
{ |
1637 | 1615 |
LMConnector targetConnector = item.Item3 as LMConnector; |
1638 |
placeRunInputs.AddConnectorTarget(targetConnector, x, y, true);
|
|
1616 |
placeRunInputs.AddConnectorTarget(targetConnector, x, y); |
|
1639 | 1617 |
} |
1640 | 1618 |
|
1641 | 1619 |
else |
... | ... | |
1767 | 1745 |
} |
1768 | 1746 |
else |
1769 | 1747 |
{ |
1770 |
placeRunInputs.AddSymbolTarget(startSymbol, points[0], points[1], true);
|
|
1748 |
placeRunInputs.AddSymbolTarget(startSymbol, points[0], points[1]); |
|
1771 | 1749 |
} |
1772 | 1750 |
} |
1773 | 1751 |
// 마지막 심볼이 있고 마지막 좌표일 때 |
... | ... | |
1787 | 1765 |
} |
1788 | 1766 |
else |
1789 | 1767 |
{ |
1790 |
placeRunInputs.AddSymbolTarget(endSymbol, points[0], points[1], true);
|
|
1768 |
placeRunInputs.AddSymbolTarget(endSymbol, points[0], points[1]); |
|
1791 | 1769 |
} |
1792 | 1770 |
} |
1793 | 1771 |
// 첫번째이며 시작 심볼이 아니고 Connecotr일 경우 |
1794 | 1772 |
else if (i == 0 && prevLMConnector.ConnectItem1SymbolObject != null) |
1795 |
placeRunInputs.AddSymbolTarget(prevLMConnector.ConnectItem1SymbolObject, points[0], points[1], true);
|
|
1773 |
placeRunInputs.AddSymbolTarget(prevLMConnector.ConnectItem1SymbolObject, points[0], points[1]); |
|
1796 | 1774 |
// 마지막이며 마지막 심볼이 아니고 Connecotr일 경우 |
1797 | 1775 |
else if (i == vertices.Count - 1 && prevLMConnector.ConnectItem2SymbolObject != null) |
1798 |
placeRunInputs.AddSymbolTarget(prevLMConnector.ConnectItem2SymbolObject, points[0], points[1], true);
|
|
1776 |
placeRunInputs.AddSymbolTarget(prevLMConnector.ConnectItem2SymbolObject, points[0], points[1]); |
|
1799 | 1777 |
else |
1800 | 1778 |
placeRunInputs.AddPoint(points[0], points[1]); |
1801 | 1779 |
} |
... | ... | |
1813 | 1791 |
{ |
1814 | 1792 |
_LMAItem = _placement.PIDCreateItem(symbolPath); |
1815 | 1793 |
placeRunInputs = new PlaceRunInputs(); |
1816 |
placeRunInputs.AddSymbolTarget(startSymbol, vertices[0][0], vertices[0][1], true);
|
|
1817 |
placeRunInputs.AddConnectorTarget(newConnector, vertices[0][0], vertices[0][1], true);
|
|
1794 |
placeRunInputs.AddSymbolTarget(startSymbol, vertices[0][0], vertices[0][1]); |
|
1795 |
placeRunInputs.AddConnectorTarget(newConnector, vertices[0][0], vertices[0][1]); |
|
1818 | 1796 |
LMConnector _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
1819 | 1797 |
if (_LMConnector != null) |
1820 | 1798 |
{ |
... | ... | |
1836 | 1814 |
|
1837 | 1815 |
_LMAItem = _placement.PIDCreateItem(symbolPath); |
1838 | 1816 |
placeRunInputs = new PlaceRunInputs(); |
1839 |
placeRunInputs.AddSymbolTarget(endSymbol, vertices[vertices.Count - 1][0], vertices[vertices.Count - 1][1], true);
|
|
1840 |
placeRunInputs.AddConnectorTarget(newConnector, vertices[vertices.Count - 1][0], vertices[vertices.Count - 1][1], true);
|
|
1817 |
placeRunInputs.AddSymbolTarget(endSymbol, vertices[vertices.Count - 1][0], vertices[vertices.Count - 1][1]); |
|
1818 |
placeRunInputs.AddConnectorTarget(newConnector, vertices[vertices.Count - 1][0], vertices[vertices.Count - 1][1]); |
|
1841 | 1819 |
LMConnector _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
1842 | 1820 |
if (_LMConnector != null) |
1843 | 1821 |
{ |
... | ... | |
2010 | 1988 |
{ |
2011 | 1989 |
double[] point = startPoints[i]; |
2012 | 1990 |
if (i == 0) |
2013 |
placeRunInputs.AddConnectorTarget(_StartTargetConnector, point[0], point[1], true);
|
|
1991 |
placeRunInputs.AddConnectorTarget(_StartTargetConnector, point[0], point[1]); |
|
2014 | 1992 |
else if (i == startPoints.Count - 1) |
2015 |
placeRunInputs.AddConnectorTarget(_EndTargetConnector, point[0], point[1], true);
|
|
1993 |
placeRunInputs.AddConnectorTarget(_EndTargetConnector, point[0], point[1]); |
|
2016 | 1994 |
else |
2017 | 1995 |
placeRunInputs.AddPoint(point[0], point[1]); |
2018 | 1996 |
} |
... | ... | |
2153 | 2131 |
{ |
2154 | 2132 |
if (_BranchTargetConnector != null) |
2155 | 2133 |
{ |
2156 |
placeRunInputs.AddConnectorTarget(_BranchTargetConnector, point[0], point[1], true);
|
|
2134 |
placeRunInputs.AddConnectorTarget(_BranchTargetConnector, point[0], point[1]); |
|
2157 | 2135 |
} |
2158 | 2136 |
else |
2159 | 2137 |
{ |
... | ... | |
2163 | 2141 |
else |
2164 | 2142 |
{ |
2165 | 2143 |
if (_SameRunTargetConnector != null) |
2166 |
placeRunInputs.AddConnectorTarget(_SameRunTargetConnector, point[0], point[1], true);
|
|
2144 |
placeRunInputs.AddConnectorTarget(_SameRunTargetConnector, point[0], point[1]); |
|
2167 | 2145 |
else if (_SameRunTargetLMSymbol != null && bNeedRemodeling) |
2168 | 2146 |
{ |
2169 | 2147 |
SlopeType slopeType = SPPIDUtil.CalcSlope(point[0], point[1], points[i + 1][0], points[i + 1][1]); |
... | ... | |
2177 | 2155 |
placeRunInputs.AddPoint(point[0], point[1]); |
2178 | 2156 |
} |
2179 | 2157 |
else if (_SameRunTargetLMSymbol != null) |
2180 |
placeRunInputs.AddSymbolTarget(_SameRunTargetLMSymbol, point[0], point[1], true);
|
|
2158 |
placeRunInputs.AddSymbolTarget(_SameRunTargetLMSymbol, point[0], point[1]); |
|
2181 | 2159 |
else |
2182 | 2160 |
placeRunInputs.AddPoint(point[0], point[1]); |
2183 | 2161 |
} |
... | ... | |
2187 | 2165 |
if (IsStart) |
2188 | 2166 |
{ |
2189 | 2167 |
if (_SameRunTargetConnector != null) |
2190 |
placeRunInputs.AddConnectorTarget(_SameRunTargetConnector, point[0], point[1], true);
|
|
2168 |
placeRunInputs.AddConnectorTarget(_SameRunTargetConnector, point[0], point[1]); |
|
2191 | 2169 |
else if (_SameRunTargetLMSymbol != null && bNeedRemodeling) |
2192 | 2170 |
{ |
2193 | 2171 |
placeRunInputs.AddPoint(point[0], point[1]); |
... | ... | |
2201 | 2179 |
placeRunInputs.AddPoint(point[0], -0.1); |
2202 | 2180 |
} |
2203 | 2181 |
else if (_SameRunTargetLMSymbol != null) |
2204 |
placeRunInputs.AddSymbolTarget(_SameRunTargetLMSymbol, point[0], point[1], true);
|
|
2182 |
placeRunInputs.AddSymbolTarget(_SameRunTargetLMSymbol, point[0], point[1]); |
|
2205 | 2183 |
else |
2206 | 2184 |
placeRunInputs.AddPoint(point[0], point[1]); |
2207 | 2185 |
} |
... | ... | |
2209 | 2187 |
{ |
2210 | 2188 |
if (_BranchTargetConnector != null) |
2211 | 2189 |
{ |
2212 |
placeRunInputs.AddConnectorTarget(_BranchTargetConnector, point[0], point[1], true);
|
|
2190 |
placeRunInputs.AddConnectorTarget(_BranchTargetConnector, point[0], point[1]); |
|
2213 | 2191 |
} |
2214 | 2192 |
else |
2215 | 2193 |
{ |
... | ... | |
2255 | 2233 |
|
2256 | 2234 |
_LMAItem = _placement.PIDCreateItem(symbolPath); |
2257 | 2235 |
placeRunInputs = new PlaceRunInputs(); |
2258 |
placeRunInputs.AddSymbolTarget(_SameRunTargetLMSymbol, point[0], point[1], true);
|
|
2259 |
placeRunInputs.AddConnectorTarget(_LMConnector, point[0], point[1], true);
|
|
2236 |
placeRunInputs.AddSymbolTarget(_SameRunTargetLMSymbol, point[0], point[1]); |
|
2237 |
placeRunInputs.AddConnectorTarget(_LMConnector, point[0], point[1]); |
|
2260 | 2238 |
LMConnector _ZeroLengthLMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
2261 | 2239 |
if (_ZeroLengthLMConnector != null) |
2262 | 2240 |
{ |
... | ... | |
2340 | 2318 |
double y = 0; |
2341 | 2319 |
lineStringGeometry.GetVertex(1, ref x, ref y); |
2342 | 2320 |
|
2343 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, x, y, true);
|
|
2344 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, x, y, true);
|
|
2321 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, x, y); |
|
2322 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, x, y); |
|
2345 | 2323 |
|
2346 | 2324 |
_placement.PIDRemovePlacement(connector.AsLMRepresentation()); |
2347 | 2325 |
newConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
... | ... | |
2363 | 2341 |
if (i == 0) |
2364 | 2342 |
{ |
2365 | 2343 |
if (connector.ConnectItem1SymbolObject != null) |
2366 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, points[0], points[1], true);
|
|
2344 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, points[0], points[1]); |
|
2367 | 2345 |
else |
2368 | 2346 |
placeRunInputs.AddPoint(points[0], points[1]); |
2369 | 2347 |
} |
2370 | 2348 |
else if (i == vertices.Count - 1) |
2371 | 2349 |
{ |
2372 | 2350 |
if (connector.ConnectItem2SymbolObject != null) |
2373 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, points[0], points[1], true);
|
|
2351 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, points[0], points[1]); |
|
2374 | 2352 |
else |
2375 | 2353 |
placeRunInputs.AddPoint(points[0], points[1]); |
2376 | 2354 |
} |
... | ... | |
3665 | 3643 |
} |
3666 | 3644 |
} |
3667 | 3645 |
|
3668 |
List<string> endSymbolUIDs = new List<string>(); |
|
3669 |
// 3개의 Symbol이 뭉쳐 있을 때 |
|
3670 |
foreach (var item in document.SYMBOLS) |
|
3671 |
{ |
|
3672 |
if (!endSymbolUIDs.Contains(item.UID)) |
|
3673 |
{ |
|
3674 |
List<Symbol> group = new List<Symbol>(); |
|
3675 |
SPPIDUtil.FindConnectedSymbolGroup(document, item, group); |
|
3676 |
if (group.Count == 3) |
|
3677 |
{ |
|
3678 |
Symbol symbol = SPPIDUtil.FindCenterAtThreeSymbols(document, group); |
|
3679 |
if (!symbols.Contains(symbol)) |
|
3680 |
symbols.Add(symbol); |
|
3681 |
foreach (var groupItem in group) |
|
3682 |
if (!endSymbolUIDs.Contains(groupItem.UID)) |
|
3683 |
endSymbolUIDs.Add(groupItem.UID); |
|
3684 |
} |
|
3685 |
} |
|
3686 |
} |
|
3687 |
|
|
3688 |
// Connection Point가 3개 이상 |
|
3689 |
foreach (var symbol in document.SYMBOLS) |
|
3690 |
{ |
|
3691 |
if (symbol.CONNECTORS.Count > 2 && !symbols.Contains(symbol)) |
|
3692 |
symbols.Add(symbol); |
|
3693 |
} |
|
3694 |
|
|
3695 |
// 2개이상의 Symbol이 뭉쳐 있을 때 |
|
3696 |
endSymbolUIDs.Clear(); |
|
3646 |
List<Symbol> tempSymbols = new List<Symbol>(); |
|
3647 |
// Conn 갯수 기준 |
|
3697 | 3648 |
foreach (var item in document.SYMBOLS) |
3698 | 3649 |
{ |
3699 |
if (!endSymbolUIDs.Contains(item.UID)) |
|
3700 |
{ |
|
3701 |
List<Symbol> group = new List<Symbol>(); |
|
3702 |
SPPIDUtil.FindConnectedSymbolGroup(document, item, group); |
|
3703 |
if (group.Count != 3 && group.Count > 1) |
|
3704 |
{ |
|
3705 |
if (!symbols.Contains(group[0])) |
|
3706 |
symbols.Add(group[0]); |
|
3707 |
foreach (var groupItem in group) |
|
3708 |
if (!endSymbolUIDs.Contains(groupItem.UID)) |
|
3709 |
endSymbolUIDs.Add(groupItem.UID); |
|
3710 |
} |
|
3711 |
} |
|
3650 |
if (!symbols.Contains(item)) |
|
3651 |
tempSymbols.Add(item); |
|
3712 | 3652 |
} |
3713 |
|
|
3653 |
tempSymbols.Sort(SortSymbolPriority); |
|
3654 |
symbols.AddRange(tempSymbols); |
|
3714 | 3655 |
|
3715 | 3656 |
return symbols; |
3716 | 3657 |
} |
3717 | 3658 |
|
3659 |
private static int SortSymbolPriority(Symbol a, Symbol b) |
|
3660 |
{ |
|
3661 |
int countA = a.CONNECTORS.FindAll(x => !string.IsNullOrEmpty(x.CONNECTEDITEM) && x.CONNECTEDITEM != "None").Count; |
|
3662 |
int countB = b.CONNECTORS.FindAll(x => !string.IsNullOrEmpty(x.CONNECTEDITEM) && x.CONNECTEDITEM != "None").Count; |
|
3663 |
int retval = countB.CompareTo(countA); |
|
3664 |
if (retval != 0) |
|
3665 |
return retval; |
|
3666 |
else |
|
3667 |
return a.SPPID.ORIGINAL_X.CompareTo(b.SPPID.ORIGINAL_X); |
|
3668 |
} |
|
3669 |
|
|
3718 | 3670 |
/// <summary> |
3719 | 3671 |
/// Graphic OID로 해당 Symbol의 크기를 구하여 Zoom |
3720 | 3672 |
/// </summary> |
내보내기 Unified diff