개정판 a9f6ef3c
Fix Line Scope Disconnection. Match Up/Down Stream.
Change-Id: I4619476926a03958f75a8480412bdb5cce814df8
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
53 | 53 |
|
54 | 54 |
List<Line> BranchLines = new List<Line>(); |
55 | 55 |
List<string> ZeroLengthSymbolToSymbolModelItemID = new List<string>(); |
56 |
List<string> ZeroLengthModelItemID = new List<string>(); |
|
57 |
List<string> ZeroLengthModelItemIDReverse = new List<string>(); |
|
58 | 56 |
List<Symbol> prioritySymbols; |
59 | 57 |
List<string> FlowMarkRepIds = new List<string>(); |
60 | 58 |
|
... | ... | |
1761 | 1759 |
/// <param name="y"></param> |
1762 | 1760 |
private void GetTargetSymbolConnectorPoint(Connector targetConnector, Symbol targetSymbol, ref double x, ref double y) |
1763 | 1761 |
{ |
1762 |
if (targetSymbol == null || targetSymbol.SPPID.RepresentationId == null) return; |
|
1763 |
|
|
1764 | 1764 |
LMSymbol _TargetItem = dataSource.GetSymbol(targetSymbol.SPPID.RepresentationId); |
1765 | 1765 |
|
1766 | 1766 |
double[] range = null; |
... | ... | |
1834 | 1834 |
/// <param name="range"></param> |
1835 | 1835 |
private void GetSPPIDSymbolRangeAndConnectionPoints(Symbol symbol, ref double[] range, List<double[]> points) |
1836 | 1836 |
{ |
1837 |
if (symbol == null || symbol.SPPID.RepresentationId == null) return; |
|
1837 | 1838 |
LMSymbol _TargetItem = dataSource.GetSymbol(symbol.SPPID.RepresentationId); |
1838 | 1839 |
Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveDocument.ActiveSheet.DrawingObjects[_TargetItem.get_GraphicOID().ToString()]; |
1839 | 1840 |
double x1 = 0; |
... | ... | |
2575 | 2576 |
CreateChildSymbol(item, _LMSymbol, parent); |
2576 | 2577 |
} |
2577 | 2578 |
|
2578 |
|
|
2579 | 2579 |
ReleaseCOMObjects(_LMSymbol); |
2580 | 2580 |
} |
2581 | 2581 |
double index = 0; |
... | ... | |
2591 | 2591 |
|
2592 | 2592 |
for (int i = 0; i < group.Count; i++) |
2593 | 2593 |
{ |
2594 |
string targetModelItemId = null; |
|
2594 | 2595 |
var currentLine = group[i]; |
2595 | 2596 |
|
2596 | 2597 |
if (!isBranchModeling && SPPIDUtil.IsBranchLine(currentLine)) |
... | ... | |
2638 | 2639 |
{ |
2639 | 2640 |
lMSymbolStart = GetTargetSymbol(targetSymbol, currentLine); |
2640 | 2641 |
if (lMSymbolStart != null) |
2642 |
{ |
|
2643 |
foreach (LMConnector item in lMSymbolStart.Connect1Connectors) |
|
2644 |
{ |
|
2645 |
if (item.Attributes["ItemStatus"].get_Value() == "Active" && item.Attributes["IsZeroLength"].get_Value() == "True") |
|
2646 |
{ |
|
2647 |
targetModelItemId = item.ModelItemID; |
|
2648 |
break; |
|
2649 |
} |
|
2650 |
} |
|
2651 |
foreach (LMConnector item in lMSymbolStart.Connect2Connectors) |
|
2652 |
{ |
|
2653 |
if (item.Attributes["ItemStatus"].get_Value() == "Active" && item.Attributes["IsZeroLength"].get_Value() == "True") |
|
2654 |
{ |
|
2655 |
targetModelItemId = item.ModelItemID; |
|
2656 |
break; |
|
2657 |
} |
|
2658 |
} |
|
2659 |
|
|
2641 | 2660 |
placeRunInputs.AddSymbolTarget(lMSymbolStart, x, y, diagonal); |
2661 |
} |
|
2642 | 2662 |
else |
2643 | 2663 |
placeRunInputs.AddPoint(x, y); |
2644 | 2664 |
} |
... | ... | |
2718 | 2738 |
if (lMConnector != null) |
2719 | 2739 |
{ |
2720 | 2740 |
lMConnector.Commit(); |
2741 |
if (!string.IsNullOrWhiteSpace(targetModelItemId)) |
|
2742 |
{ |
|
2743 |
LMModelItem modelItem1 = dataSource.GetModelItem(targetModelItemId); |
|
2744 |
LMModelItem modelItem2 = dataSource.GetModelItem(lMConnector.ModelItemID); |
|
2745 |
_LMAItem item1 = modelItem1.AsLMAItem(); |
|
2746 |
_LMAItem item2 = modelItem2.AsLMAItem(); |
|
2747 |
_placement.PIDJoinRuns(item1, item2); |
|
2748 |
item1.Commit(); |
|
2749 |
item2.Commit(); |
|
2750 |
ReleaseCOMObjects(item1); |
|
2751 |
ReleaseCOMObjects(item2); |
|
2752 |
ReleaseCOMObjects(modelItem1); |
|
2753 |
ReleaseCOMObjects(modelItem2); |
|
2754 |
} |
|
2755 |
|
|
2721 | 2756 |
currentLine.SPPID.ModelItemId = lMConnector.ModelItemID; |
2722 | 2757 |
|
2723 | 2758 |
bool bRemodelingStart = false; |
... | ... | |
3123 | 3158 |
diagonal = true; |
3124 | 3159 |
_LMAItem lMAItem = _placement.PIDCreateItem(symbolPath); |
3125 | 3160 |
LMConnector newConnector = null; |
3161 |
LMConnector newFirstConnector = null; |
|
3126 | 3162 |
dynamic OID = prevLMConnector.get_GraphicOID().ToString(); |
3127 | 3163 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID]; |
3128 | 3164 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d; |
... | ... | |
3166 | 3202 |
{ |
3167 | 3203 |
if (bEnd) |
3168 | 3204 |
{ |
3169 |
placeRunInputs.AddPoint(points[0], points[1]); |
|
3205 |
_placement.PIDRemovePlacement(prevLMConnector.AsLMRepresentation()); |
|
3206 |
PlaceRunInputs placeFirstRunInputs = new PlaceRunInputs(); |
|
3170 | 3207 |
|
3171 |
SlopeType slopeType = SPPIDUtil.CalcSlope(points[0], points[1], vertices[i - 1][0], vertices[i - 1][1]); |
|
3172 |
if (slopeType == SlopeType.HORIZONTAL) |
|
3173 |
placeRunInputs.AddPoint(points[0], -0.1); |
|
3174 |
else if (slopeType == SlopeType.VERTICAL) |
|
3175 |
placeRunInputs.AddPoint(-0.1, points[1]); |
|
3176 |
else |
|
3177 |
placeRunInputs.AddPoint(points[0], -0.1); |
|
3208 |
placeFirstRunInputs.AddPoint(points[0], points[1]); |
|
3209 |
placeFirstRunInputs.AddSymbolTarget(endSymbol, points[0], points[1], diagonal); |
|
3210 |
|
|
3211 |
string otherSymbolPath = symbolPath; |
|
3212 |
Symbol symbolDef = document.SYMBOLS.FirstOrDefault(f => f.SPPID.RepresentationId == endSymbol.AsLMRepresentation().Id); |
|
3213 |
if (symbolDef != null) |
|
3214 |
{ |
|
3215 |
Connector otherConn = symbolDef.CONNECTORS.FirstOrDefault(f => f.ConnectedObject != null && f.ConnectedObject.GetType() == typeof(Line) && ((Line)f.ConnectedObject).UID != line.UID); |
|
3216 |
if (otherConn != null) |
|
3217 |
{ |
|
3218 |
otherSymbolPath = ((Line)otherConn.ConnectedObject).SPPID.MAPPINGNAME; |
|
3219 |
} |
|
3220 |
} |
|
3221 |
|
|
3222 |
_LMAItem lMAFirstItem = _placement.PIDCreateItem(otherSymbolPath); |
|
3223 |
newFirstConnector = _placement.PIDPlaceRun(lMAFirstItem, placeFirstRunInputs); |
|
3224 |
newFirstConnector.Commit(); |
|
3225 |
|
|
3226 |
placeRunInputs.AddConnectorTarget(newFirstConnector, points[0], points[1], diagonal); |
|
3227 |
ReleaseCOMObjects(placeFirstRunInputs); |
|
3228 |
ReleaseCOMObjects(lMAFirstItem); |
|
3178 | 3229 |
} |
3179 | 3230 |
else |
3180 | 3231 |
{ |
... | ... | |
3212 | 3263 |
{ |
3213 | 3264 |
lMConnector.Commit(); |
3214 | 3265 |
RemoveConnectorForReModelingLine(newConnector); |
3215 |
ZeroLengthModelItemID.Add(lMConnector.ModelItemID); |
|
3216 | 3266 |
ReleaseCOMObjects(lMConnector); |
3217 | 3267 |
} |
3218 | 3268 |
ReleaseCOMObjects(placeRunInputs); |
... | ... | |
3221 | 3271 |
|
3222 | 3272 |
if (endSymbol != null && bEnd) |
3223 | 3273 |
{ |
3224 |
if (startSymbol != null) |
|
3225 |
{ |
|
3226 |
Dictionary<LMConnector, List<double[]>> dicVertices = GetPipeRunVertices(newConnector.ModelItemID); |
|
3227 |
newConnector = dicVertices.First().Key; |
|
3228 |
} |
|
3229 |
|
|
3230 |
lMAItem = _placement.PIDCreateItem(symbolPath); |
|
3231 |
placeRunInputs = new PlaceRunInputs(); |
|
3232 |
placeRunInputs.AddSymbolTarget(endSymbol, vertices[vertices.Count - 1][0], vertices[vertices.Count - 1][1]); |
|
3233 |
placeRunInputs.AddConnectorTarget(newConnector, vertices[vertices.Count - 1][0], vertices[vertices.Count - 1][1]); |
|
3234 |
LMConnector lMConnector = _placement.PIDPlaceRun(lMAItem, placeRunInputs); |
|
3235 |
if (lMConnector != null) |
|
3236 |
{ |
|
3237 |
lMConnector.Commit(); |
|
3238 |
RemoveConnectorForReModelingLine(newConnector); |
|
3239 |
ZeroLengthModelItemIDReverse.Add(lMConnector.ModelItemID); |
|
3240 |
ReleaseCOMObjects(lMConnector); |
|
3241 |
} |
|
3274 |
ReleaseCOMObjects(newFirstConnector); |
|
3242 | 3275 |
ReleaseCOMObjects(placeRunInputs); |
3243 | 3276 |
ReleaseCOMObjects(lMAItem); |
3244 | 3277 |
} |
... | ... | |
3362 | 3395 |
|
3363 | 3396 |
SegmentLocation location; |
3364 | 3397 |
double[] point = GetSegmentPoint(ownerObj, connectedItem, targetLMConnector, out location); |
3398 |
|
|
3365 | 3399 |
Array array = null; |
3366 | 3400 |
if (point != null) |
3367 | 3401 |
array = new double[] { 0, point[0], point[1] }; |
... | ... | |
3374 | 3408 |
if (property != null && !string.IsNullOrEmpty(property.VALUE) && property.VALUE.Equals("True")) |
3375 | 3409 |
{ |
3376 | 3410 |
_LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, null, Rotation: endBreak.ANGLE, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: leaderLine); |
3411 |
if (_LmLabelPersist == null) |
|
3412 |
{ |
|
3413 |
_LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, null, Rotation: endBreak.ANGLE, IsLeaderVisible: leaderLine); |
|
3414 |
} |
|
3377 | 3415 |
} |
3378 | 3416 |
else |
3379 | 3417 |
{ |
3380 | 3418 |
_LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, null, null, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: leaderLine); |
3419 |
if (_LmLabelPersist == null) |
|
3420 |
{ |
|
3421 |
_LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, null, null, IsLeaderVisible: leaderLine); |
|
3422 |
} |
|
3381 | 3423 |
} |
3382 | 3424 |
|
3383 | 3425 |
if (_LmLabelPersist != null) |
내보내기 Unified diff