개정판 69222bff
dev issue #507 : segment break 위치 보정
Change-Id: I4a109e9f532c1737b19b77c2caa55b0ec8e1aa61
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
24 | 24 |
using DevExpress.XtraSplashScreen; |
25 | 25 |
namespace Converter.SPPID |
26 | 26 |
{ |
27 |
[Flags] |
|
28 |
public enum SegmentLocation |
|
29 |
{ |
|
30 |
None = 0, |
|
31 |
Right = 1, |
|
32 |
Left = 2, |
|
33 |
Down = 4, |
|
34 |
Up = 8 |
|
35 |
} |
|
27 | 36 |
public class AutoModeling : IDisposable |
28 | 37 |
{ |
29 | 38 |
Placement _placement; |
... | ... | |
3021 | 3030 |
if (symbolMapping != null) |
3022 | 3031 |
leaderLine = symbolMapping.LEADERLINE; |
3023 | 3032 |
|
3024 |
double[] point = GetSegmentPoint(ownerObj, connectedItem, targetLMConnector); |
|
3033 |
SegmentLocation location; |
|
3034 |
double[] point = GetSegmentPoint(ownerObj, connectedItem, targetLMConnector, out location); |
|
3025 | 3035 |
Array array = null; |
3026 | 3036 |
if (point != null) |
3027 | 3037 |
array = new double[] { 0, point[0], point[1] }; |
... | ... | |
3035 | 3045 |
if (_LmLabelPersist.ModelItemObject != null) |
3036 | 3046 |
endBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID; |
3037 | 3047 |
endBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID().ToString(); |
3048 |
|
|
3049 |
MoveDependencyObject(endBreak.SPPID.GraphicOID, location); |
|
3050 |
|
|
3038 | 3051 |
ReleaseCOMObjects(_LmLabelPersist); |
3039 | 3052 |
} |
3040 | 3053 |
ReleaseCOMObjects(targetLMConnector); |
... | ... | |
3046 | 3059 |
} |
3047 | 3060 |
} |
3048 | 3061 |
|
3062 |
private void MoveDependencyObject(string graphicOID, SegmentLocation location) |
|
3063 |
{ |
|
3064 |
double x = 0, y = 0; |
|
3065 |
if (location.HasFlag(SegmentLocation.Up)) |
|
3066 |
y = GridSetting.GetInstance().Length * 3; |
|
3067 |
else if (location.HasFlag(SegmentLocation.Down)) |
|
3068 |
y = -GridSetting.GetInstance().Length * 3; |
|
3069 |
|
|
3070 |
if (location.HasFlag(SegmentLocation.Right)) |
|
3071 |
x = GridSetting.GetInstance().Length * 3; |
|
3072 |
else if (location.HasFlag(SegmentLocation.Left)) |
|
3073 |
x = -GridSetting.GetInstance().Length * 3; |
|
3074 |
|
|
3075 |
if (x != 0 || y != 0) |
|
3076 |
{ |
|
3077 |
radApp.ActiveSelectSet.RemoveAll(); |
|
3078 |
DependencyObject dependency = radApp.ActiveDocument.ActiveSheet.DrawingObjects[graphicOID] as DependencyObject; |
|
3079 |
if (dependency != null) |
|
3080 |
{ |
|
3081 |
radApp.ActiveSelectSet.Add(dependency); |
|
3082 |
Ingr.RAD2D.Transform transform = dependency.GetTransform(); |
|
3083 |
transform.DefineByMove2d(x, y); |
|
3084 |
radApp.ActiveSelectSet.Transform(transform, true); |
|
3085 |
radApp.ActiveSelectSet.RemoveAll(); |
|
3086 |
} |
|
3087 |
} |
|
3088 |
} |
|
3089 |
|
|
3049 | 3090 |
private LMConnector ReModelingZeroLengthLMConnectorForSegment(LMConnector connector, string changeSymbolPath = null) |
3050 | 3091 |
{ |
3051 | 3092 |
string symbolPath = string.Empty; |
... | ... | |
3150 | 3191 |
if (mapping != null && !string.IsNullOrEmpty(mapping.SPPIDSYMBOLNAME) && mapping.SPPIDSYMBOLNAME != "None") |
3151 | 3192 |
{ |
3152 | 3193 |
string MappingPath = mapping.SPPIDSYMBOLNAME; |
3153 |
double[] point = GetSegmentPoint(upStreamObj, downStreamObj, targetLMConnector); |
|
3194 |
SegmentLocation location; |
|
3195 |
double[] point = GetSegmentPoint(upStreamObj, downStreamObj, targetLMConnector, out location); |
|
3154 | 3196 |
Array array = null; |
3155 | 3197 |
if (point != null) |
3156 | 3198 |
array = new double[] { 0, point[0], point[1] }; |
... | ... | |
3165 | 3207 |
if (_LmLabelPersist.ModelItemObject != null) |
3166 | 3208 |
specBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID; |
3167 | 3209 |
specBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID().ToString(); |
3210 |
|
|
3211 |
MoveDependencyObject(specBreak.SPPID.GraphicOID, location); |
|
3212 |
|
|
3168 | 3213 |
ReleaseCOMObjects(_LmLabelPersist); |
3169 | 3214 |
} |
3170 | 3215 |
|
... | ... | |
3312 | 3357 |
return targetConnector; |
3313 | 3358 |
} |
3314 | 3359 |
|
3315 |
private double[] GetSegmentPoint(object targetObj, object connObj, LMConnector targetConnector) |
|
3360 |
private double[] GetSegmentPoint(object targetObj, object connObj, LMConnector targetConnector, out SegmentLocation location)
|
|
3316 | 3361 |
{ |
3317 | 3362 |
double[] result = null; |
3318 | 3363 |
Line targetLine = targetObj as Line; |
3319 | 3364 |
Symbol targetSymbol = targetObj as Symbol; |
3320 | 3365 |
Line connLine = connObj as Line; |
3321 | 3366 |
Symbol connSymbol = connObj as Symbol; |
3322 |
|
|
3323 |
double zeroLengthMove = GridSetting.GetInstance().Length * 3; |
|
3324 |
double lineMove = GridSetting.GetInstance().Length * 3; |
|
3367 |
location = SegmentLocation.None; |
|
3325 | 3368 |
if (Convert.ToBoolean(targetConnector.get_IsZeroLength())) |
3326 | 3369 |
{ |
3327 | 3370 |
result = GetConnectorVertices(targetConnector)[0]; |
3328 | 3371 |
if (targetSymbol != null && connSymbol != null) |
3329 | 3372 |
{ |
3330 | 3373 |
SlopeType slopeType = SPPIDUtil.CalcSlope(targetSymbol.SPPID.SPPID_X, targetSymbol.SPPID.SPPID_Y, connSymbol.SPPID.SPPID_X, connSymbol.SPPID.SPPID_Y); |
3374 |
result = new double[] { result[0], result[1] }; |
|
3331 | 3375 |
if (slopeType == SlopeType.HORIZONTAL) |
3332 |
result = new double[] { result[0], result[1] - zeroLengthMove };
|
|
3376 |
location = SegmentLocation.Up;
|
|
3333 | 3377 |
else if (slopeType == SlopeType.VERTICAL) |
3334 |
result = new double[] { result[0] + zeroLengthMove, result[1] };
|
|
3378 |
location = SegmentLocation.Right;
|
|
3335 | 3379 |
} |
3336 | 3380 |
else if (targetLine != null) |
3337 | 3381 |
{ |
3382 |
result = new double[] { result[0], result[1] }; |
|
3338 | 3383 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
3339 |
result = new double[] { result[0], result[1] - zeroLengthMove };
|
|
3384 |
location = SegmentLocation.Up;
|
|
3340 | 3385 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
3341 |
result = new double[] { result[0] + zeroLengthMove, result[1] };
|
|
3386 |
location = SegmentLocation.Right;
|
|
3342 | 3387 |
} |
3343 | 3388 |
else if (connLine != null) |
3344 | 3389 |
{ |
3390 |
result = new double[] { result[0], result[1] }; |
|
3345 | 3391 |
if (connLine.SlopeType == SlopeType.HORIZONTAL) |
3346 |
result = new double[] { result[0], result[1] - zeroLengthMove };
|
|
3392 |
location = SegmentLocation.Up;
|
|
3347 | 3393 |
else if (connLine.SlopeType == SlopeType.VERTICAL) |
3348 |
result = new double[] { result[0] + zeroLengthMove, result[1] };
|
|
3394 |
location = SegmentLocation.Right;
|
|
3349 | 3395 |
} |
3350 | 3396 |
} |
3351 | 3397 |
else |
... | ... | |
3372 | 3418 |
|
3373 | 3419 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
3374 | 3420 |
{ |
3375 |
result = new double[] { result[0], result[1] - lineMove }; |
|
3421 |
result = new double[] { result[0], result[1] }; |
|
3422 |
location = SegmentLocation.Up; |
|
3376 | 3423 |
if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X < targetLine.SPPID.END_X) |
3377 |
{ |
|
3378 |
result = new double[] { result[0] - lineMove, result[1] }; |
|
3379 |
} |
|
3424 |
location = location | SegmentLocation.Right; |
|
3380 | 3425 |
else if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X > targetLine.SPPID.END_X) |
3381 |
{ |
|
3382 |
result = new double[] { result[0] + lineMove, result[1] }; |
|
3383 |
} |
|
3426 |
location = location | SegmentLocation.Left; |
|
3384 | 3427 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X < targetLine.SPPID.END_X) |
3385 |
{ |
|
3386 |
result = new double[] { result[0] + lineMove, result[1] }; |
|
3387 |
} |
|
3428 |
location = location | SegmentLocation.Left; |
|
3388 | 3429 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X > targetLine.SPPID.END_X) |
3389 |
{ |
|
3390 |
result = new double[] { result[0] - lineMove, result[1] }; |
|
3391 |
} |
|
3430 |
location = location | SegmentLocation.Right; |
|
3392 | 3431 |
} |
3393 | 3432 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
3394 | 3433 |
{ |
3395 |
result = new double[] { result[0] - lineMove, result[1] }; |
|
3434 |
result = new double[] { result[0], result[1] }; |
|
3435 |
location = SegmentLocation.Right; |
|
3396 | 3436 |
if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y < targetLine.SPPID.END_Y) |
3397 |
{ |
|
3398 |
result = new double[] { result[0], result[1] - lineMove }; |
|
3399 |
} |
|
3437 |
location = location | SegmentLocation.Up; |
|
3400 | 3438 |
else if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y > targetLine.SPPID.END_Y) |
3401 |
{ |
|
3402 |
result = new double[] { result[0], result[1] + lineMove }; |
|
3403 |
} |
|
3439 |
location = location | SegmentLocation.Down; |
|
3404 | 3440 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y < targetLine.SPPID.END_Y) |
3405 |
{ |
|
3406 |
result = new double[] { result[0], result[1] + lineMove }; |
|
3407 |
} |
|
3441 |
location = location | SegmentLocation.Down; |
|
3408 | 3442 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y > targetLine.SPPID.END_Y) |
3409 |
{ |
|
3410 |
result = new double[] { result[0], result[1] - lineMove }; |
|
3411 |
} |
|
3443 |
location = location | SegmentLocation.Up; |
|
3412 | 3444 |
} |
3413 | 3445 |
|
3414 | 3446 |
} |
내보내기 Unified diff