개정판 28d05cc2
dev issue #1191 : Segment 위치 보정
Change-Id: I58af2164ad4152b34d61e67ae62ff66ff3cdfa21
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
2471 | 2471 |
downStreamObj != null) |
2472 | 2472 |
{ |
2473 | 2473 |
LMConnector targetLMConnector = FindBreakLineTarget(upStreamObj, downStreamObj); |
2474 |
|
|
2475 | 2474 |
if (targetLMConnector != null) |
2476 | 2475 |
{ |
2477 | 2476 |
foreach (var attribute in specBreak.ATTRIBUTES) |
... | ... | |
2637 | 2636 |
private double[] GetSegmentPoint(object targetObj, object connObj, LMConnector targetConnector) |
2638 | 2637 |
{ |
2639 | 2638 |
double[] result = null; |
2639 |
Line targetLine = targetObj as Line; |
|
2640 |
Symbol targetSymbol = targetObj as Symbol; |
|
2641 |
Line connLine = connObj as Line; |
|
2642 |
Symbol connSymbol = connObj as Symbol; |
|
2643 |
|
|
2644 |
double move = GridSetting.GetInstance().Length * 3; |
|
2640 | 2645 |
if (Convert.ToBoolean(targetConnector.get_IsZeroLength())) |
2641 | 2646 |
{ |
2642 |
return GetConnectorVertices(targetConnector)[0]; |
|
2647 |
result = GetConnectorVertices(targetConnector)[0]; |
|
2648 |
if (targetSymbol != null && connSymbol != null) |
|
2649 |
{ |
|
2650 |
SlopeType slopeType = SPPIDUtil.CalcSlope(targetSymbol.SPPID.SPPID_X, targetSymbol.SPPID.SPPID_Y, connSymbol.SPPID.SPPID_X, connSymbol.SPPID.SPPID_Y); |
|
2651 |
if (slopeType == SlopeType.HORIZONTAL) |
|
2652 |
result = new double[] { result[0], result[1] - move }; |
|
2653 |
else if (slopeType == SlopeType.VERTICAL) |
|
2654 |
result = new double[] { result[0] - move, result[1] }; |
|
2655 |
} |
|
2656 |
else if (targetLine != null) |
|
2657 |
{ |
|
2658 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
|
2659 |
result = new double[] { result[0], result[1] - move }; |
|
2660 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
|
2661 |
result = new double[] { result[0] - move, result[1] }; |
|
2662 |
} |
|
2663 |
else if (connLine != null) |
|
2664 |
{ |
|
2665 |
if (connLine.SlopeType == SlopeType.HORIZONTAL) |
|
2666 |
result = new double[] { result[0], result[1] - move }; |
|
2667 |
else if (connLine.SlopeType == SlopeType.VERTICAL) |
|
2668 |
result = new double[] { result[0] - move, result[1] }; |
|
2669 |
} |
|
2643 | 2670 |
} |
2644 | 2671 |
else |
2645 | 2672 |
{ |
... | ... | |
2659 | 2686 |
if (vertices.Count > 0) |
2660 | 2687 |
{ |
2661 | 2688 |
if (connIndex == 1) |
2662 |
return vertices[0];
|
|
2689 |
result = vertices[0];
|
|
2663 | 2690 |
else if (connIndex == 2) |
2664 |
return vertices[vertices.Count - 1]; |
|
2691 |
result = vertices[vertices.Count - 1]; |
|
2692 |
|
|
2693 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
|
2694 |
{ |
|
2695 |
result = new double[] { result[0], result[1] - move }; |
|
2696 |
if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X < targetLine.SPPID.END_X) |
|
2697 |
{ |
|
2698 |
result = new double[] { result[0] + move, result[1] }; |
|
2699 |
} |
|
2700 |
else if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X > targetLine.SPPID.END_X) |
|
2701 |
{ |
|
2702 |
result = new double[] { result[0] - move, result[1] }; |
|
2703 |
} |
|
2704 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X < targetLine.SPPID.END_X) |
|
2705 |
{ |
|
2706 |
result = new double[] { result[0] - move, result[1] }; |
|
2707 |
} |
|
2708 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X > targetLine.SPPID.END_X) |
|
2709 |
{ |
|
2710 |
result = new double[] { result[0] + move, result[1] }; |
|
2711 |
} |
|
2712 |
} |
|
2713 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
|
2714 |
{ |
|
2715 |
result = new double[] { result[0] - move, result[1] }; |
|
2716 |
if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y < targetLine.SPPID.END_Y) |
|
2717 |
{ |
|
2718 |
result = new double[] { result[0], result[1] + move }; |
|
2719 |
} |
|
2720 |
else if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y > targetLine.SPPID.END_Y) |
|
2721 |
{ |
|
2722 |
result = new double[] { result[0], result[1] - move }; |
|
2723 |
} |
|
2724 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y < targetLine.SPPID.END_Y) |
|
2725 |
{ |
|
2726 |
result = new double[] { result[0], result[1] - move }; |
|
2727 |
} |
|
2728 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y > targetLine.SPPID.END_Y) |
|
2729 |
{ |
|
2730 |
result = new double[] { result[0], result[1] + move }; |
|
2731 |
} |
|
2732 |
} |
|
2733 |
|
|
2665 | 2734 |
} |
2666 | 2735 |
} |
2667 | 2736 |
else |
... | ... | |
4049 | 4118 |
loop = false; |
4050 | 4119 |
foreach (var overlap in endList) |
4051 | 4120 |
{ |
4052 |
if (SPPIDUtil.IsOverlap(overlap.SPPID.Range, note.SPPID.Range))
|
|
4121 |
if (overlap.SPPID.Range != null && note.SPPID.Range !=null)
|
|
4053 | 4122 |
{ |
4054 |
double tempX = 0; |
|
4055 |
double tempY = 0; |
|
4056 |
bool overlapX = false; |
|
4057 |
bool overlapY = false; |
|
4058 |
SPPIDUtil.CalcOverlap(note.SPPID.Range, overlap.SPPID.Range, ref tempX, ref tempY, ref overlapX, ref overlapY); |
|
4059 |
double angle = SPPIDUtil.CalcAngle(note.LOCATION_X, note.LOCATION_Y, overlap.LOCATION_X, overlap.LOCATION_Y); |
|
4060 |
if (overlapY && angle >= 45) |
|
4123 |
if (SPPIDUtil.IsOverlap(overlap.SPPID.Range, note.SPPID.Range)) |
|
4061 | 4124 |
{ |
4062 |
int count = Convert.ToInt32(tempY / gridSetting.Length) + 1; |
|
4063 |
double move = gridSetting.Length * count; |
|
4064 |
note.SPPID.SPPID_Y = note.SPPID.SPPID_Y - move; |
|
4065 |
note.SPPID.Range = new double[] { note.SPPID.Range[0], note.SPPID.Range[1] - move, note.SPPID.Range[2], note.SPPID.Range[3] - move }; |
|
4066 |
needRemodeling = true; |
|
4067 |
loop = true; |
|
4068 |
} |
|
4069 |
if (overlapX && angle <= 45) |
|
4070 |
{ |
|
4071 |
int count = Convert.ToInt32(tempX / gridSetting.Length) + 1; |
|
4072 |
double move = gridSetting.Length * count; |
|
4073 |
note.SPPID.SPPID_X = note.SPPID.SPPID_X + move; |
|
4074 |
note.SPPID.Range = new double[] { note.SPPID.Range[0] + move, note.SPPID.Range[1], note.SPPID.Range[2] + move, note.SPPID.Range[3] }; |
|
4075 |
needRemodeling = true; |
|
4076 |
loop = true; |
|
4125 |
double tempX = 0; |
|
4126 |
double tempY = 0; |
|
4127 |
bool overlapX = false; |
|
4128 |
bool overlapY = false; |
|
4129 |
SPPIDUtil.CalcOverlap(note.SPPID.Range, overlap.SPPID.Range, ref tempX, ref tempY, ref overlapX, ref overlapY); |
|
4130 |
double angle = SPPIDUtil.CalcAngle(note.LOCATION_X, note.LOCATION_Y, overlap.LOCATION_X, overlap.LOCATION_Y); |
|
4131 |
if (overlapY && angle >= 45) |
|
4132 |
{ |
|
4133 |
int count = Convert.ToInt32(tempY / gridSetting.Length) + 1; |
|
4134 |
double move = gridSetting.Length * count; |
|
4135 |
note.SPPID.SPPID_Y = note.SPPID.SPPID_Y - move; |
|
4136 |
note.SPPID.Range = new double[] { note.SPPID.Range[0], note.SPPID.Range[1] - move, note.SPPID.Range[2], note.SPPID.Range[3] - move }; |
|
4137 |
needRemodeling = true; |
|
4138 |
loop = true; |
|
4139 |
} |
|
4140 |
if (overlapX && angle <= 45) |
|
4141 |
{ |
|
4142 |
int count = Convert.ToInt32(tempX / gridSetting.Length) + 1; |
|
4143 |
double move = gridSetting.Length * count; |
|
4144 |
note.SPPID.SPPID_X = note.SPPID.SPPID_X + move; |
|
4145 |
note.SPPID.Range = new double[] { note.SPPID.Range[0] + move, note.SPPID.Range[1], note.SPPID.Range[2] + move, note.SPPID.Range[3] }; |
|
4146 |
needRemodeling = true; |
|
4147 |
loop = true; |
|
4148 |
} |
|
4077 | 4149 |
} |
4078 | 4150 |
} |
4151 |
else |
|
4152 |
{ |
|
4153 |
|
|
4154 |
} |
|
4155 |
|
|
4079 | 4156 |
} |
4080 | 4157 |
} |
4081 | 4158 |
|
내보내기 Unified diff