148 |
148 |
foreach (var item in document.EndBreaks)
|
149 |
149 |
EndBreakModeling(item);
|
150 |
150 |
|
|
151 |
// SpecBreak Modeling
|
|
152 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "SpecBreaks Modeling");
|
|
153 |
foreach (var item in document.SpecBreaks)
|
|
154 |
SpecBreakModeling(item);
|
|
155 |
|
151 |
156 |
// LineNumber Modeling
|
152 |
157 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "LineNumbers Modeling");
|
153 |
158 |
foreach (var item in document.LINENUMBERS)
|
... | ... | |
1644 |
1649 |
}
|
1645 |
1650 |
|
1646 |
1651 |
/// <summary>
|
|
1652 |
/// SpecBreak Modeling 메서드
|
|
1653 |
/// </summary>
|
|
1654 |
/// <param name="specBreak"></param>
|
|
1655 |
private void SpecBreakModeling(SpecBreak specBreak)
|
|
1656 |
{
|
|
1657 |
object upStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.UpStreamUID);
|
|
1658 |
object downStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.DownStreamUID);
|
|
1659 |
|
|
1660 |
if (upStreamObj != null &&
|
|
1661 |
downStreamObj != null)
|
|
1662 |
{
|
|
1663 |
LMConnector targetLMConnector = null;
|
|
1664 |
LMSymbol upStreamLMSymbol = null;
|
|
1665 |
LMSymbol downStreamLMSymbol = null;
|
|
1666 |
List<LMConnector> upStreamLMConnectors = null;
|
|
1667 |
List<LMConnector> downStreamLMConnectors = null;
|
|
1668 |
|
|
1669 |
// UpStream = Symbol, DownStream = Symbol 경우
|
|
1670 |
if (upStreamObj.GetType() == typeof(Symbol) && downStreamObj.GetType() == typeof(Symbol))
|
|
1671 |
{
|
|
1672 |
Symbol upStreamSymbol = upStreamObj as Symbol;
|
|
1673 |
Symbol downStreamSymbol = downStreamObj as Symbol;
|
|
1674 |
if (!string.IsNullOrEmpty(upStreamSymbol.SPPID.RepresentationId) && !string.IsNullOrEmpty(downStreamSymbol.SPPID.RepresentationId))
|
|
1675 |
{
|
|
1676 |
upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId);
|
|
1677 |
downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId);
|
|
1678 |
|
|
1679 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors)
|
|
1680 |
{
|
|
1681 |
if (connector.get_ItemStatus() == "Active")
|
|
1682 |
{
|
|
1683 |
if (connector.AvoidItem1SymbolObject.AsLMRepresentation().Id == downStreamLMSymbol.AsLMRepresentation().Id ||
|
|
1684 |
connector.AvoidItem2SymbolObject.AsLMRepresentation().Id == downStreamLMSymbol.AsLMRepresentation().Id)
|
|
1685 |
targetLMConnector = connector;
|
|
1686 |
}
|
|
1687 |
}
|
|
1688 |
|
|
1689 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors)
|
|
1690 |
{
|
|
1691 |
if (connector.get_ItemStatus() == "Active")
|
|
1692 |
{
|
|
1693 |
if (connector.AvoidItem1SymbolObject.AsLMRepresentation().Id == downStreamLMSymbol.AsLMRepresentation().Id ||
|
|
1694 |
connector.AvoidItem2SymbolObject.AsLMRepresentation().Id == downStreamLMSymbol.AsLMRepresentation().Id)
|
|
1695 |
targetLMConnector = connector;
|
|
1696 |
}
|
|
1697 |
}
|
|
1698 |
}
|
|
1699 |
}
|
|
1700 |
// UpStream = Symbol, DownStream = Line 경우
|
|
1701 |
else if (upStreamObj.GetType() == typeof(Symbol) && downStreamObj.GetType() == typeof(Line))
|
|
1702 |
{
|
|
1703 |
Symbol upStreamSymbol = upStreamObj as Symbol;
|
|
1704 |
Line downStreamLine = downStreamObj as Line;
|
|
1705 |
if (!string.IsNullOrEmpty(upStreamSymbol.SPPID.RepresentationId) && !string.IsNullOrEmpty(downStreamLine.SPPID.ModelItemId))
|
|
1706 |
{
|
|
1707 |
upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId);
|
|
1708 |
downStreamLMConnectors = GetConnectors(downStreamLine.SPPID.ModelItemId);
|
|
1709 |
|
|
1710 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors)
|
|
1711 |
{
|
|
1712 |
if (connector.get_ItemStatus() == "Active")
|
|
1713 |
if (downStreamLMConnectors.Find(x => x.AsLMRepresentation().Id == connector.AsLMRepresentation().Id) != null)
|
|
1714 |
targetLMConnector = connector;
|
|
1715 |
}
|
|
1716 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors)
|
|
1717 |
{
|
|
1718 |
if (connector.get_ItemStatus() == "Active")
|
|
1719 |
if (downStreamLMConnectors.Find(x => x.AsLMRepresentation().Id == connector.AsLMRepresentation().Id) != null)
|
|
1720 |
targetLMConnector = connector;
|
|
1721 |
}
|
|
1722 |
}
|
|
1723 |
}
|
|
1724 |
// UpStream = Line, DownStream = Symbol 경우
|
|
1725 |
else if (upStreamObj.GetType() == typeof(Line) && downStreamObj.GetType() == typeof(Symbol))
|
|
1726 |
{
|
|
1727 |
Line upStreamLine = upStreamObj as Line;
|
|
1728 |
Symbol downStreamSymbol = downStreamObj as Symbol;
|
|
1729 |
if (!string.IsNullOrEmpty(upStreamLine.SPPID.ModelItemId) && !string.IsNullOrEmpty(downStreamSymbol.SPPID.RepresentationId))
|
|
1730 |
{
|
|
1731 |
downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId);
|
|
1732 |
upStreamLMConnectors = GetConnectors(upStreamLine.SPPID.ModelItemId);
|
|
1733 |
|
|
1734 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid1Connectors)
|
|
1735 |
{
|
|
1736 |
if (connector.get_ItemStatus() == "Active")
|
|
1737 |
if (upStreamLMConnectors.Find(x => x.AsLMRepresentation().Id == connector.AsLMRepresentation().Id) != null)
|
|
1738 |
targetLMConnector = connector;
|
|
1739 |
}
|
|
1740 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid2Connectors)
|
|
1741 |
{
|
|
1742 |
if (connector.get_ItemStatus() == "Active")
|
|
1743 |
if (upStreamLMConnectors.Find(x => x.AsLMRepresentation().Id == connector.AsLMRepresentation().Id) != null)
|
|
1744 |
targetLMConnector = connector;
|
|
1745 |
}
|
|
1746 |
}
|
|
1747 |
}
|
|
1748 |
// UpStream = Line, DownStream = Line 경우
|
|
1749 |
else if (upStreamObj.GetType() == typeof(Line) && downStreamObj.GetType() == typeof(Line))
|
|
1750 |
{
|
|
1751 |
Line upStreamLine = upStreamObj as Line;
|
|
1752 |
Line downStreamLine = downStreamObj as Line;
|
|
1753 |
|
|
1754 |
if (!string.IsNullOrEmpty(upStreamLine.SPPID.ModelItemId) && !string.IsNullOrEmpty(downStreamLine.SPPID.ModelItemId))
|
|
1755 |
{
|
|
1756 |
upStreamLMConnectors = GetConnectors(upStreamLine.SPPID.ModelItemId);
|
|
1757 |
downStreamLMConnectors = GetConnectors(downStreamLine.SPPID.ModelItemId);
|
|
1758 |
List<LMConnector> findUpStreamConnector = new List<LMConnector>();
|
|
1759 |
List<LMConnector> findDownStreamConnector = new List<LMConnector>();
|
|
1760 |
foreach (LMConnector upStreamConnector in upStreamLMConnectors)
|
|
1761 |
{
|
|
1762 |
foreach (LMConnector downStreamConnector in downStreamLMConnectors)
|
|
1763 |
{
|
|
1764 |
if (upStreamConnector.ConnectItem1SymbolObject != null &&
|
|
1765 |
downStreamConnector.ConnectItem1SymbolObject != null &&
|
|
1766 |
upStreamConnector.ConnectItem1SymbolObject.AsLMRepresentation().Id == downStreamConnector.ConnectItem1SymbolObject.AsLMRepresentation().Id)
|
|
1767 |
{
|
|
1768 |
findUpStreamConnector.Add(upStreamConnector);
|
|
1769 |
findDownStreamConnector.Add(downStreamConnector);
|
|
1770 |
}
|
|
1771 |
if (upStreamConnector.ConnectItem1SymbolObject != null &&
|
|
1772 |
downStreamConnector.ConnectItem2SymbolObject != null &&
|
|
1773 |
upStreamConnector.ConnectItem1SymbolObject.AsLMRepresentation().Id == downStreamConnector.ConnectItem2SymbolObject.AsLMRepresentation().Id)
|
|
1774 |
{
|
|
1775 |
findUpStreamConnector.Add(upStreamConnector);
|
|
1776 |
findDownStreamConnector.Add(downStreamConnector);
|
|
1777 |
}
|
|
1778 |
if (upStreamConnector.ConnectItem2SymbolObject != null &&
|
|
1779 |
downStreamConnector.ConnectItem1SymbolObject != null &&
|
|
1780 |
upStreamConnector.ConnectItem2SymbolObject.AsLMRepresentation().Id == downStreamConnector.ConnectItem1SymbolObject.AsLMRepresentation().Id)
|
|
1781 |
{
|
|
1782 |
findUpStreamConnector.Add(upStreamConnector);
|
|
1783 |
findDownStreamConnector.Add(downStreamConnector);
|
|
1784 |
}
|
|
1785 |
if (upStreamConnector.ConnectItem2SymbolObject != null &&
|
|
1786 |
downStreamConnector.ConnectItem2SymbolObject != null &&
|
|
1787 |
upStreamConnector.ConnectItem2SymbolObject.AsLMRepresentation().Id == downStreamConnector.ConnectItem2SymbolObject.AsLMRepresentation().Id)
|
|
1788 |
{
|
|
1789 |
findUpStreamConnector.Add(upStreamConnector);
|
|
1790 |
findDownStreamConnector.Add(downStreamConnector);
|
|
1791 |
}
|
|
1792 |
}
|
|
1793 |
}
|
|
1794 |
|
|
1795 |
findUpStreamConnector = findUpStreamConnector.Distinct().ToList();
|
|
1796 |
findDownStreamConnector = findDownStreamConnector.Distinct().ToList();
|
|
1797 |
|
|
1798 |
if (findUpStreamConnector.Count == 1)
|
|
1799 |
targetLMConnector = findUpStreamConnector[0];
|
|
1800 |
else if (findDownStreamConnector.Count == 1)
|
|
1801 |
targetLMConnector = findDownStreamConnector[0];
|
|
1802 |
}
|
|
1803 |
}
|
|
1804 |
|
|
1805 |
if (targetLMConnector != null)
|
|
1806 |
{
|
|
1807 |
string MappingPath = specBreak.SPPID.MAPPINGNAME;
|
|
1808 |
Array array = new double[] { 0, specBreak.SPPID.ORIGINAL_X, specBreak.SPPID.ORIGINAL_Y };
|
|
1809 |
LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(MappingPath, ref array, Rotation: specBreak.ANGLE, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: true);
|
|
1810 |
|
|
1811 |
if (_LmLabelPersist != null)
|
|
1812 |
{
|
|
1813 |
ReleaseCOMObjects(_LmLabelPersist);
|
|
1814 |
}
|
|
1815 |
}
|
|
1816 |
|
|
1817 |
if (upStreamLMSymbol != null)
|
|
1818 |
ReleaseCOMObjects(upStreamLMSymbol);
|
|
1819 |
if (downStreamLMSymbol != null)
|
|
1820 |
ReleaseCOMObjects(downStreamLMSymbol);
|
|
1821 |
if (upStreamLMConnectors != null)
|
|
1822 |
foreach (var item in upStreamLMConnectors)
|
|
1823 |
ReleaseCOMObjects(item);
|
|
1824 |
if (downStreamLMConnectors != null)
|
|
1825 |
foreach (var item in downStreamLMConnectors)
|
|
1826 |
ReleaseCOMObjects(item);
|
|
1827 |
}
|
|
1828 |
}
|
|
1829 |
|
|
1830 |
/// <summary>
|
1647 |
1831 |
/// FromModelItem을 ToModelItem으로 PipeRunJoin하는 메서드
|
1648 |
1832 |
/// </summary>
|
1649 |
1833 |
/// <param name="fromModelItemId"></param>
|
... | ... | |
1772 |
1956 |
return connectorVertices;
|
1773 |
1957 |
}
|
1774 |
1958 |
|
|
1959 |
private List<LMConnector> GetConnectors(string modelId)
|
|
1960 |
{
|
|
1961 |
List<LMConnector> connectors = new List<LMConnector>();
|
|
1962 |
LMModelItem modelItem = dataSource.GetModelItem(modelId);
|
|
1963 |
|
|
1964 |
if (modelItem != null)
|
|
1965 |
{
|
|
1966 |
foreach (LMRepresentation rep in modelItem.Representations)
|
|
1967 |
{
|
|
1968 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active")
|
|
1969 |
{
|
|
1970 |
LMConnector _LMConnector = dataSource.GetConnector(rep.Id);
|
|
1971 |
connectors.Add(_LMConnector);
|
|
1972 |
}
|
|
1973 |
}
|
|
1974 |
|
|
1975 |
ReleaseCOMObjects(modelItem);
|
|
1976 |
}
|
|
1977 |
|
|
1978 |
return connectors;
|
|
1979 |
}
|
|
1980 |
|
1775 |
1981 |
/// <summary>
|
1776 |
1982 |
/// 좌표로 PipeRun의 Connector중에 어느 Connector에 가까운지/붙을지 가져오는 메서드 - 두점으로 라인의 교차점을 기준으로 구함
|
1777 |
1983 |
/// </summary>
|