개정판 340515a2
dev issue #000 : note, fix bug
Change-Id: I523a117215bc70e3d20191bea0b57e537bba8180
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
177 | 177 |
foreach (var item in document.LINES) |
178 | 178 |
FlowMarkModeling(item); |
179 | 179 |
|
180 |
// Note Symbol Modeling |
|
181 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Note Symbol Modeling"); |
|
182 |
foreach (var item in document.SYMBOLS) |
|
183 |
NoteSymbolModeling(item); |
|
184 |
|
|
180 | 185 |
// Note Modeling |
181 | 186 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Notes Modeling"); |
182 | 187 |
foreach (var item in document.NOTES) |
... | ... | |
2008 | 2013 |
} |
2009 | 2014 |
else |
2010 | 2015 |
{ |
2011 |
LMSymbol connectedLMSymbol = connectedSymbol != null ? |
|
2012 |
dataSource.GetSymbol(connectedSymbol.SPPID.RepresentationId) : dataSource.GetSymbol(targetSymbol.SPPID.RepresentationId); |
|
2013 |
LMModelItem targetModelItem = targetLine != null ? |
|
2014 |
dataSource.GetModelItem(targetLine.SPPID.ModelItemId) : dataSource.GetModelItem(connectedLine.SPPID.ModelItemId); |
|
2016 |
LMSymbol connectedLMSymbol = null; |
|
2017 |
if (connectedSymbol != null) |
|
2018 |
connectedLMSymbol = dataSource.GetSymbol(connectedSymbol.SPPID.RepresentationId); |
|
2019 |
else if (targetSymbol != null) |
|
2020 |
connectedLMSymbol = dataSource.GetSymbol(targetSymbol.SPPID.RepresentationId); |
|
2021 |
else |
|
2022 |
{ |
|
2023 |
|
|
2024 |
} |
|
2025 |
LMModelItem targetModelItem = null; |
|
2026 |
if (targetLine != null) |
|
2027 |
targetModelItem = dataSource.GetModelItem(targetLine.SPPID.ModelItemId); |
|
2028 |
else if (connectedLine != null) |
|
2029 |
targetModelItem = dataSource.GetModelItem(connectedLine.SPPID.ModelItemId); |
|
2030 |
else |
|
2031 |
{ |
|
2032 |
|
|
2033 |
} |
|
2015 | 2034 |
if (connectedLMSymbol != null && targetModelItem != null) |
2016 | 2035 |
{ |
2017 | 2036 |
foreach (LMConnector connector in connectedLMSymbol.Avoid1Connectors) |
... | ... | |
2443 | 2462 |
/// <param name="lineNumber"></param> |
2444 | 2463 |
private void LineNumberModeling(LineNumber lineNumber) |
2445 | 2464 |
{ |
2446 |
Line line = SPPIDUtil.FindObjectByUID(document, lineNumber.CONNLINE) as Line; |
|
2447 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId); |
|
2448 |
LMConnector connectedLMConnector = FindTargetLMConnectorForLabel(connectorVertices, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y); |
|
2449 |
if (connectedLMConnector != null) |
|
2465 |
object obj = SPPIDUtil.FindObjectByUID(document, lineNumber.CONNLINE); |
|
2466 |
if (obj != null) |
|
2450 | 2467 |
{ |
2451 |
double x = 0; |
|
2452 |
double y = 0; |
|
2453 |
CalcLabelLocation(ref x, ref y, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y, lineNumber.SPPIDLabelLocation, _ETCSetting.LineNumberLocation); |
|
2468 |
Line line = obj as Line; |
|
2469 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId); |
|
2470 |
LMConnector connectedLMConnector = FindTargetLMConnectorForLabel(connectorVertices, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y); |
|
2471 |
if (connectedLMConnector != null) |
|
2472 |
{ |
|
2473 |
double x = 0; |
|
2474 |
double y = 0; |
|
2475 |
CalcLabelLocation(ref x, ref y, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y, lineNumber.SPPIDLabelLocation, _ETCSetting.LineNumberLocation); |
|
2454 | 2476 |
|
2455 |
Array points = new double[] { 0, x, y }; |
|
2456 |
LMLabelPersist _LmLabelPresist = _placement.PIDPlaceLabel(lineNumber.SPPID.MAPPINGNAME, ref points, Rotation: lineNumber.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: false); |
|
2477 |
Array points = new double[] { 0, x, y };
|
|
2478 |
LMLabelPersist _LmLabelPresist = _placement.PIDPlaceLabel(lineNumber.SPPID.MAPPINGNAME, ref points, Rotation: lineNumber.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: false);
|
|
2457 | 2479 |
|
2458 |
foreach (var item in connectorVertices) |
|
2459 |
ReleaseCOMObjects(item.Key); |
|
2460 |
if (_LmLabelPresist != null) |
|
2461 |
{ |
|
2462 |
_LmLabelPresist.Commit(); |
|
2463 |
lineNumber.SPPID.RepresentationId = _LmLabelPresist.AsLMRepresentation().Id; |
|
2464 |
ReleaseCOMObjects(_LmLabelPresist); |
|
2465 |
} |
|
2466 |
else |
|
2467 |
{ |
|
2480 |
foreach (var item in connectorVertices)
|
|
2481 |
ReleaseCOMObjects(item.Key);
|
|
2482 |
if (_LmLabelPresist != null)
|
|
2483 |
{
|
|
2484 |
_LmLabelPresist.Commit();
|
|
2485 |
lineNumber.SPPID.RepresentationId = _LmLabelPresist.AsLMRepresentation().Id;
|
|
2486 |
ReleaseCOMObjects(_LmLabelPresist);
|
|
2487 |
}
|
|
2488 |
else
|
|
2489 |
{
|
|
2468 | 2490 |
|
2491 |
} |
|
2469 | 2492 |
} |
2470 | 2493 |
} |
2471 | 2494 |
|
... | ... | |
2623 | 2646 |
{ |
2624 | 2647 |
Symbol symbol = item as Symbol; |
2625 | 2648 |
LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId); |
2626 |
LMModelItem _LMModelItem = _LMSymbol.ModelItemObject; |
|
2627 |
|
|
2628 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active") |
|
2649 |
if (_LMSymbol != null) |
|
2629 | 2650 |
{ |
2630 |
foreach (var attribute in lineNumber.ATTRIBUTES) |
|
2651 |
LMModelItem _LMModelItem = _LMSymbol.ModelItemObject; |
|
2652 |
|
|
2653 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active") |
|
2631 | 2654 |
{ |
2632 |
LineNumberMapping mapping = document.LineNumberMappings.Find(x => x.UID == attribute.UID); |
|
2633 |
if (mapping != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None") |
|
2655 |
foreach (var attribute in lineNumber.ATTRIBUTES) |
|
2634 | 2656 |
{ |
2635 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[mapping.SPPIDATTRIBUTENAME];
|
|
2636 |
if (_LMAAttribute != null)
|
|
2657 |
LineNumberMapping mapping = document.LineNumberMappings.Find(x => x.UID == attribute.UID);
|
|
2658 |
if (mapping != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
|
|
2637 | 2659 |
{ |
2638 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2639 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
2640 |
else if (_LMAAttribute.get_Value() != attribute.VALUE) |
|
2641 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
2660 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
2661 |
if (_LMAAttribute != null) |
|
2662 |
{ |
|
2663 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2664 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
2665 |
else if (_LMAAttribute.get_Value() != attribute.VALUE) |
|
2666 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
2667 |
} |
|
2642 | 2668 |
} |
2643 | 2669 |
} |
2670 |
_LMModelItem.Commit(); |
|
2644 | 2671 |
} |
2645 |
_LMModelItem.Commit(); |
|
2672 |
if (_LMModelItem != null) |
|
2673 |
ReleaseCOMObjects(_LMModelItem); |
|
2646 | 2674 |
} |
2647 |
if (_LMModelItem != null) |
|
2648 |
ReleaseCOMObjects(_LMModelItem); |
|
2649 | 2675 |
if (_LMSymbol != null) |
2650 | 2676 |
ReleaseCOMObjects(_LMSymbol); |
2651 | 2677 |
} |
... | ... | |
3089 | 3115 |
|
3090 | 3116 |
try |
3091 | 3117 |
{ |
3092 |
double x = 0; |
|
3093 |
double y = 0; |
|
3118 |
if (string.IsNullOrEmpty(note.OWNER) || note.OWNER == "None") |
|
3119 |
{ |
|
3120 |
double x = 0; |
|
3121 |
double y = 0; |
|
3094 | 3122 |
|
3095 |
CalcLabelLocation(ref x, ref y, note.SPPID.ORIGINAL_X, note.SPPID.ORIGINAL_Y, note.SPPIDLabelLocation, _ETCSetting.NoteLocation); |
|
3123 |
CalcLabelLocation(ref x, ref y, note.SPPID.ORIGINAL_X, note.SPPID.ORIGINAL_Y, note.SPPIDLabelLocation, _ETCSetting.NoteLocation);
|
|
3096 | 3124 |
|
3097 |
_LMSymbol = _placement.PIDPlaceSymbol(note.SPPID.MAPPINGNAME, x, y); |
|
3098 |
_LMSymbol.Commit(); |
|
3099 |
_LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID); |
|
3100 |
_LMItemNote.Commit(); |
|
3101 |
_LMAAttribute = _LMItemNote.Attributes["Note.Body"]; |
|
3102 |
_LMAAttribute.set_Value(note.VALUE); |
|
3103 |
_LMItemNote.Commit(); |
|
3125 |
_LMSymbol = _placement.PIDPlaceSymbol(note.SPPID.MAPPINGNAME, x, y); |
|
3126 |
_LMSymbol.Commit(); |
|
3127 |
_LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID); |
|
3128 |
_LMItemNote.Commit(); |
|
3129 |
_LMAAttribute = _LMItemNote.Attributes["Note.Body"]; |
|
3130 |
_LMAAttribute.set_Value(note.VALUE); |
|
3131 |
_LMItemNote.Commit(); |
|
3132 |
} |
|
3104 | 3133 |
} |
3105 | 3134 |
catch (Exception ex) |
3106 | 3135 |
{ |
... | ... | |
3119 | 3148 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount); |
3120 | 3149 |
} |
3121 | 3150 |
|
3151 |
private void NoteSymbolModeling(Symbol symbol) |
|
3152 |
{ |
|
3153 |
if (symbol.TYPE == "Notes") |
|
3154 |
{ |
|
3155 |
string mappingPath = symbol.SPPID.MAPPINGNAME; |
|
3156 |
double x = symbol.SPPID.ORIGINAL_X; |
|
3157 |
double y = symbol.SPPID.ORIGINAL_Y; |
|
3158 |
int mirror = 0; |
|
3159 |
double angle = symbol.ANGLE; |
|
3160 |
|
|
3161 |
LMSymbol _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle); |
|
3162 |
ReleaseCOMObjects(_LMSymbol); |
|
3163 |
} |
|
3164 |
} |
|
3165 |
|
|
3122 | 3166 |
/// <summary> |
3123 | 3167 |
/// Label의 좌표를 구하는 메서드(ID2 기준의 좌표 -> SPPID 좌표) |
3124 | 3168 |
/// </summary> |
내보내기 Unified diff