개정판 310aeb31
dev issue #000 : Instrument Lable 임시 모델링 개발 / Signal Run Branch 안되던 현상 수정
Change-Id: I245c21b40b7e9aa69731f69fb9fc7cc656691121
DTI_PID/SPPIDConverter/Model/SPPID_Document.cs | ||
---|---|---|
226 | 226 |
|
227 | 227 |
return true; |
228 | 228 |
} |
229 |
#region Grouping Source |
|
230 |
private bool SetGrouping() |
|
231 |
{ |
|
232 |
try |
|
233 |
{ |
|
234 |
// Line 기준으로 묶음 |
|
235 |
foreach (Line item in LINES) |
|
236 |
if (!item.SPPID.IsGroup) |
|
237 |
SetGroupingByItem(item); |
|
238 |
// End |
|
239 |
|
|
240 |
// Symbol 기준으로 묶음 |
|
241 |
foreach (Symbol item in SYMBOLS) |
|
242 |
if (!item.SPPID.IsGroup) |
|
243 |
SetGroupingByItem(item); |
|
244 |
// End |
|
245 |
} |
|
246 |
catch (Exception ex) |
|
247 |
{ |
|
248 |
return false; |
|
249 |
} |
|
250 |
return true; |
|
251 |
} |
|
252 |
|
|
253 |
private void SetGroupingByItem(object item) |
|
254 |
{ |
|
255 |
Group group = new Group(); |
|
256 |
group.Items.Add(item); |
|
257 |
bool forward = true; |
|
258 |
SetGroupingByConnectedItem(item, group.Items, ref forward); |
|
259 |
|
|
260 |
GROUPS.Add(group); |
|
261 |
} |
|
262 |
|
|
263 |
private void SetGroupingByConnectedItem(object item, List<object> list, ref bool IsForward) |
|
264 |
{ |
|
265 |
if (typeof(Line) == item.GetType()) |
|
266 |
{ |
|
267 |
Line line = item as Line; |
|
268 |
line.SPPID.IsGroup = true; |
|
269 |
SetGroupingByConnectedItem_ConnectorsLogic(item, list, ref IsForward, line.CONNECTORS); |
|
270 |
} |
|
271 |
else if (typeof(Symbol) == item.GetType()) |
|
272 |
{ |
|
273 |
Symbol symbol = item as Symbol; |
|
274 |
symbol.SPPID.IsGroup = true; |
|
275 |
// Symbol의 경우 BaseSymbol Connector가 2개 이하때 진행 / 나머지는 Grouping 종료 |
|
276 |
int baseSymbolCount = 0; |
|
277 |
if (symbol.CONNECTORS.Count > 0) |
|
278 |
{ |
|
279 |
foreach (Connector symbolConnector in symbol.CONNECTORS) |
|
280 |
if (symbolConnector.Index == 0) |
|
281 |
baseSymbolCount++; |
|
282 |
|
|
283 |
if (baseSymbolCount <= 2) |
|
284 |
SetGroupingByConnectedItem_ConnectorsLogic(item, list, ref IsForward, symbol.CONNECTORS); |
|
285 |
} |
|
286 |
} |
|
287 |
IsForward = false; |
|
288 |
} |
|
289 |
|
|
290 |
private void SetGroupingByConnectedItem_ConnectorsLogic(object item, List<object> list, ref bool IsForward, List<Connector> connectors) |
|
291 |
{ |
|
292 |
foreach (Connector connector in connectors) |
|
293 |
{ |
|
294 |
object connItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
|
295 |
if (connItem != null) |
|
296 |
{ |
|
297 |
bool result = false; |
|
298 |
if (typeof(Line) == connItem.GetType()) |
|
299 |
{ |
|
300 |
Line connLine = connItem as Line; |
|
301 |
// 연결되는 Item이 전부 Line일 경우 Branch, Line Type을 확인 |
|
302 |
if (item.GetType() == connLine.GetType()) |
|
303 |
{ |
|
304 |
Line line = item as Line; |
|
305 |
if (SPPIDUtil.IsBranchLine(line.UID, connLine) || line.SPPID.MAPPINGNAME != connLine.SPPID.MAPPINGNAME) |
|
306 |
continue; |
|
307 |
} |
|
308 |
|
|
309 |
result = true; |
|
310 |
} |
|
311 |
else if (typeof(Symbol) == connItem.GetType()) |
|
312 |
{ |
|
313 |
Symbol connSymbol = connItem as Symbol; |
|
314 |
// 연결되는 Symbol의 Connector가 부가 심볼일 경우는 result = false |
|
315 |
foreach (Connector symbolConnector in connSymbol.CONNECTORS) |
|
316 |
{ |
|
317 |
string itemUID = item as Symbol != null ? ((Symbol)item).UID : ((Line)item).UID; |
|
318 |
|
|
319 |
if (symbolConnector.CONNECTEDITEM == itemUID) |
|
320 |
{ |
|
321 |
if (symbolConnector.Index == 0) |
|
322 |
result = true; |
|
323 |
else |
|
324 |
result = false; |
|
325 |
break; |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 |
|
|
330 |
if (!(connItem as Symbol != null ? ((Symbol)connItem).SPPID.IsGroup : ((Line)connItem).SPPID.IsGroup) && result) |
|
331 |
{ |
|
332 |
if (IsForward) |
|
333 |
list.Add(connItem); |
|
334 |
else |
|
335 |
list.Insert(0, connItem); |
|
336 |
SetGroupingByConnectedItem(connItem, list, ref IsForward); |
|
337 |
} |
|
338 |
} |
|
339 |
} |
|
340 |
} |
|
341 |
#endregion |
|
342 | 229 |
} |
343 | 230 |
} |
내보내기 Unified diff