개정판 f676f99a
dev issue #507 : vent drain line length 설정
Change-Id: Ib25dcccae300059594f237dde9296a89a3e891f4
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
332 | 332 |
if (connector != null) |
333 | 333 |
{ |
334 | 334 |
SetCoordinate(); |
335 |
SymbolModelingBySymbol(connector.ConnectedObject as Symbol); |
|
335 |
Symbol connSymbol = connector.ConnectedObject as Symbol; |
|
336 |
SymbolModeling(connSymbol, null); |
|
336 | 337 |
NewLineModeling(item, true); |
338 |
|
|
339 |
GridSetting grid = GridSetting.GetInstance(); |
|
340 |
int count = grid.DrainValveCellCount; |
|
341 |
double length = grid.Length; |
|
342 |
|
|
343 |
// 길이 확인 |
|
344 |
if (!string.IsNullOrEmpty(item.SPPID.ModelItemId)) |
|
345 |
{ |
|
346 |
LMConnector _LMConnector = GetLMConnectorOnlyOne(item.SPPID.ModelItemId); |
|
347 |
if (_LMConnector != null) |
|
348 |
{ |
|
349 |
double[] connectorRange = GetConnectorRange(_LMConnector); |
|
350 |
double connectorLength = double.NaN; |
|
351 |
if (item.SlopeType == SlopeType.HORIZONTAL) |
|
352 |
connectorLength = connectorRange[2] - connectorRange[0]; |
|
353 |
else if (item.SlopeType == SlopeType.VERTICAL) |
|
354 |
connectorLength = connectorRange[3] - connectorRange[1]; |
|
355 |
|
|
356 |
if (!double.IsNaN(connectorLength) && connectorLength != count * length) |
|
357 |
{ |
|
358 |
double move = count * length - connectorLength; |
|
359 |
List<Symbol> group = new List<Symbol>(); |
|
360 |
SPPIDUtil.FindConnectedSymbolGroup(document, connSymbol, group); |
|
361 |
foreach (var symbol in group) |
|
362 |
{ |
|
363 |
int connSymbolIndex = item.CONNECTORS.IndexOf(item.CONNECTORS.Find(x => x.ConnectedObject == connSymbol)); |
|
364 |
if (item.SlopeType == SlopeType.HORIZONTAL) |
|
365 |
{ |
|
366 |
if (connSymbolIndex == 0) |
|
367 |
{ |
|
368 |
if (item.SPPID.START_X > item.SPPID.END_X) |
|
369 |
symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X + move; |
|
370 |
else |
|
371 |
symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X - move; |
|
372 |
} |
|
373 |
else |
|
374 |
{ |
|
375 |
if (item.SPPID.START_X < item.SPPID.END_X) |
|
376 |
symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X + move; |
|
377 |
else |
|
378 |
symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X - move; |
|
379 |
} |
|
380 |
} |
|
381 |
else if (item.SlopeType == SlopeType.VERTICAL) |
|
382 |
{ |
|
383 |
if (connSymbolIndex == 0) |
|
384 |
{ |
|
385 |
if (item.SPPID.START_Y > item.SPPID.END_Y) |
|
386 |
symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y + move; |
|
387 |
else |
|
388 |
symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y - move; |
|
389 |
} |
|
390 |
else |
|
391 |
{ |
|
392 |
if (item.SPPID.START_Y < item.SPPID.END_Y) |
|
393 |
symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y + move; |
|
394 |
else |
|
395 |
symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y - move; |
|
396 |
} |
|
397 |
} |
|
398 |
} |
|
399 |
|
|
400 |
// 제거 |
|
401 |
RemoveSymbol(connSymbol); |
|
402 |
RemoveLine(item); |
|
403 |
|
|
404 |
// 재생성 |
|
405 |
SymbolModelingBySymbol(connSymbol); |
|
406 |
NewLineModeling(item, true); |
|
407 |
} |
|
408 |
} |
|
409 |
|
|
410 |
ReleaseCOMObjects(_LMConnector); |
|
411 |
_LMConnector = null; |
|
412 |
} |
|
337 | 413 |
} |
338 | 414 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
339 | 415 |
} |
... | ... | |
2392 | 2468 |
} |
2393 | 2469 |
} |
2394 | 2470 |
|
2471 |
private void RemoveLine(Line line) |
|
2472 |
{ |
|
2473 |
LMModelItem modelItem = dataSource.GetModelItem(line.SPPID.ModelItemId); |
|
2474 |
if (modelItem != null) |
|
2475 |
{ |
|
2476 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
2477 |
{ |
|
2478 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
2479 |
_placement.PIDRemovePlacement(rep); |
|
2480 |
} |
|
2481 |
ReleaseCOMObjects(modelItem); |
|
2482 |
} |
|
2483 |
line.SPPID.ModelItemId = null; |
|
2484 |
} |
|
2485 |
|
|
2395 | 2486 |
private void GetConnectedLineGroup(Line line, List<Line> group) |
2396 | 2487 |
{ |
2397 | 2488 |
if (!group.Contains(line)) |
... | ... | |
3633 | 3724 |
} |
3634 | 3725 |
return result; |
3635 | 3726 |
} |
3727 |
private double[] GetConnectorRange(LMConnector connector) |
|
3728 |
{ |
|
3729 |
double[] result = null; |
|
3730 |
List<double[]> vertices = new List<double[]>(); |
|
3731 |
if (connector != null) |
|
3732 |
{ |
|
3733 |
dynamic OID = connector.get_GraphicOID().ToString(); |
|
3734 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID]; |
|
3735 |
double minX = 0; |
|
3736 |
double minY = 0; |
|
3737 |
double maxX = 0; |
|
3738 |
double maxY = 0; |
|
3739 |
|
|
3740 |
drawingObject.Range(out minX, out minY, out maxX, out maxY); |
|
3741 |
result = new double[] { minX, minY, maxX, maxY }; |
|
3742 |
} |
|
3743 |
return result; |
|
3744 |
} |
|
3636 | 3745 |
private List<double[]> GetConnectorVertices(dynamic graphicOID) |
3637 | 3746 |
{ |
3638 | 3747 |
List<double[]> vertices = null; |
내보내기 Unified diff