개정판 10c7195c
dev issue #000 : End Break Owner가 심볼일때도 가능하게 수정
Change-Id: I2d84b0faf6a70bde41086f8c6190e9fea16ca29e
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
819 | 819 |
|
820 | 820 |
private void EndBreakModeling(EndBreak endBreak) |
821 | 821 |
{ |
822 |
Line ownerLine = SPPIDUtil.FindObjectByUID(document, endBreak.OWNER) as Line; |
|
823 |
|
|
824 |
if (ownerLine != null) |
|
822 |
object ownerObj = SPPIDUtil.FindObjectByUID(document, endBreak.OWNER); |
|
823 |
if (ownerObj !=null && ownerObj.GetType() == typeof(Line)) |
|
825 | 824 |
{ |
825 |
Line ownerLine = ownerObj as Line; |
|
826 | 826 |
LMLabelPersist _LmLabelPersist = null; |
827 | 827 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(ownerLine.SPPID.ModelItemId); |
828 | 828 |
|
... | ... | |
842 | 842 |
foreach (var item in connectorVertices) |
843 | 843 |
ReleaseCOMObjects(item.Key); |
844 | 844 |
} |
845 |
else if (ownerObj != null && ownerObj.GetType() == typeof(Symbol)) |
|
846 |
{ |
|
847 |
Symbol ownerSymbol = ownerObj as Symbol; |
|
848 |
LMSymbol _LMSymbol = dataSource.GetSymbol(ownerSymbol.SPPID.RepresentationId); |
|
849 |
|
|
850 |
LMConnector targetLMConnector = null; |
|
851 |
double distance = double.MaxValue; |
|
852 |
foreach (LMConnector connector in _LMSymbol.Avoid1Connectors) |
|
853 |
{ |
|
854 |
dynamic OID = connector.get_GraphicOID(); |
|
855 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID]; |
|
856 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d; |
|
857 |
int verticesCount = lineStringGeometry.VertexCount; |
|
858 |
double[] vertices = null; |
|
859 |
lineStringGeometry.GetVertices(ref verticesCount, ref vertices); |
|
860 |
for (int i = 0; i < verticesCount; i++) |
|
861 |
{ |
|
862 |
double x = 0; |
|
863 |
double y = 0; |
|
864 |
lineStringGeometry.GetVertex(i + 1, ref x, ref y); |
|
865 |
|
|
866 |
double result = SPPIDUtil.CalcPointToPointdDistance(x, y, ownerSymbol.SPPID.ORIGINAL_X, ownerSymbol.SPPID.ORIGINAL_Y); |
|
867 |
if (result < distance) |
|
868 |
{ |
|
869 |
targetLMConnector = connector; |
|
870 |
distance = result; |
|
871 |
} |
|
872 |
} |
|
873 |
} |
|
874 |
|
|
875 |
foreach (LMConnector connector in _LMSymbol.Avoid2Connectors) |
|
876 |
{ |
|
877 |
dynamic OID = connector.get_GraphicOID(); |
|
878 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID]; |
|
879 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d; |
|
880 |
int verticesCount = lineStringGeometry.VertexCount; |
|
881 |
double[] vertices = null; |
|
882 |
lineStringGeometry.GetVertices(ref verticesCount, ref vertices); |
|
883 |
for (int i = 0; i < verticesCount; i++) |
|
884 |
{ |
|
885 |
double x = 0; |
|
886 |
double y = 0; |
|
887 |
lineStringGeometry.GetVertex(i + 1, ref x, ref y); |
|
888 |
|
|
889 |
double result = SPPIDUtil.CalcPointToPointdDistance(x, y, ownerSymbol.SPPID.ORIGINAL_X, ownerSymbol.SPPID.ORIGINAL_Y); |
|
890 |
if (result < distance) |
|
891 |
{ |
|
892 |
targetLMConnector = connector; |
|
893 |
distance = result; |
|
894 |
} |
|
895 |
} |
|
896 |
} |
|
897 |
|
|
898 |
if (targetLMConnector != null) |
|
899 |
{ |
|
900 |
LMLabelPersist _LmLabelPersist = null; |
|
901 |
Array array = new double[] { 0, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y }; |
|
902 |
_LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, Rotation: 0, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: true); |
|
903 |
if (_LmLabelPersist != null) |
|
904 |
{ |
|
905 |
_LmLabelPersist.Commit(); |
|
906 |
ReleaseCOMObjects(_LmLabelPersist); |
|
907 |
} |
|
908 |
} |
|
909 |
ReleaseCOMObjects(_LMSymbol); |
|
910 |
} |
|
845 | 911 |
} |
846 | 912 |
|
847 | 913 |
private void JoinPipeRun(string fromModelItemId, string toModelItemId) |
DTI_PID/SPPIDConverter/ConverterForm.cs | ||
---|---|---|
545 | 545 |
#if DEBUG |
546 | 546 |
this.Visible = false; |
547 | 547 |
|
548 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
|
|
548 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml"); |
|
549 | 549 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml"); |
550 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\Isocynates-325_Page49.xml"); |
|
550 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\Isocynates-325_Page49.xml");
|
|
551 | 551 |
document.SymbolMappings = symbolMappings; |
552 | 552 |
document.ChildSymbolMappings = childSymbolMappings; |
553 | 553 |
document.LineMappings = lineMappings; |
내보내기 Unified diff