프로젝트

일반

사용자정보

개정판 53c81765

ID53c81765e3bcb220157158984865845bf920b52a
상위 03110d25
하위 7c7bcd10

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #708 : SpecBreakModeling (심볼만)

Change-Id: Ic16888c4aacc51d926299d2858ec06d0c590be79

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
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>
DTI_PID/SPPIDConverter/BaseModel/Document.cs
22 22
        private List<LineNumber> _LINENUMBERS = new List<LineNumber>();
23 23
        private List<TrimLine> _TRIMLINES = new List<TrimLine>();
24 24
        private List<EndBreak> _EndBreaks = new List<EndBreak>();
25
        private List<SpecBreak> _SpecBreaks = new List<SpecBreak>();
25 26
        private List<Equipment> _Equipments = new List<Equipment>();
26 27
        private bool _Enable;
27 28

  
......
33 34
        public List<Line> LINES { get => _LINES; set => _LINES = value; }
34 35
        public List<LineNumber> LINENUMBERS { get => _LINENUMBERS; set => _LINENUMBERS = value; }
35 36
        public List<EndBreak> EndBreaks { get => _EndBreaks; set => _EndBreaks = value; }
37
        public List<SpecBreak> SpecBreaks { get => _SpecBreaks; set => _SpecBreaks = value; }
36 38
        public List<Equipment> Equipments { get => _Equipments; set => _Equipments = value; }
37 39
        public string DWGNAME { get => _DWGNAME; set => _DWGNAME = value; }
38 40
        public string SIZE
......
55 57
        public double SIZE_WIDTH { get => _SIZE_WIDTH; }
56 58
        public double SIZE_HEIGHT { get => _SIZE_HEIGHT; }
57 59
        public List<TrimLine> TRIMLINES { get => _TRIMLINES; set => _TRIMLINES = value; }
60
        
58 61

  
59 62
        public Document(string xmlPath)
60 63
        {
......
88 91
                string sType = item.Element("TYPE").Value;
89 92
                if (sType == "Segment Breaks")
90 93
                {
91
                    continue;
94
                    SpecBreak specBreak = new SpecBreak()
95
                    {
96
                        UID = item.Element("UID").Value,
97
                        DBUID = item.Element("DBUID").Value,
98
                        NAME = item.Element("NAME").Value,
99
                        TYPE = item.Element("TYPE").Value,
100
                        OWNER = item.Element("OWNER").Value,
101
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
102
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
103
                        LOCATION = item.Element("LOCATION").Value,
104
                        SIZE = item.Element("SIZE").Value,
105
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
106
                        PARENT = item.Element("PARENT").Value,
107
                        CHILD = item.Element("CHILD").Value,
108
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
109
                        AREA = item.Element("AREA").Value,
110
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
111
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
112
                    };
113
                    SetAssociations(item.Element("ASSOCIATIONS"), specBreak.ASSOCIATIONS);
114
                    SetSymbolConnectors(item.Element("CONNECTORS"), specBreak.CONNECTORS, specBreak.CONNECTIONPOINT);
115
                    SetProperties(item.Element("PROPERTIES"), specBreak.PROPERTIES);
116
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), specBreak.ATTRIBUTES);
117
                    SetSpecBreakAttribute(specBreak);
118

  
119
                    SpecBreaks.Add(specBreak);
92 120
                }
93 121
                else if (sType == "End Break")
94 122
                {
......
395 423
            }
396 424
        }
397 425

  
426
        private void SetSpecBreakAttribute(SpecBreak specBreak)
427
        {
428
            string upStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "UpStream").VALUE;
429
            string downStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "DownStream").VALUE;
430

  
431
            specBreak.UpStreamUID = upStream;
432
            specBreak.DownStreamUID = downStream;
433
        }
434

  
398 435
        private void SetLineNumberRuns(XElement node, List<LineRun> lineNumberRuns)
399 436
        {
400 437
            foreach (XElement item in node.Elements("RUN"))
DTI_PID/SPPIDConverter/BaseModel/SpecBreak.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6

  
7
namespace Converter.BaseModel
8
{
9
    public class SpecBreak : Symbol
10
    {
11
        public string UpStreamUID { get; set; }
12
        public string DownStreamUID { get; set; }
13
    }
14
}
DTI_PID/SPPIDConverter/SPPIDConverter.csproj
139 139
    <Compile Include="BaseModel\Other\Connector.cs" />
140 140
    <Compile Include="BaseModel\Other\LineNumberRun.cs" />
141 141
    <Compile Include="BaseModel\Other\Property.cs" />
142
    <Compile Include="BaseModel\SpecBreak.cs" />
142 143
    <Compile Include="BaseModel\SPPID\SPPIDLabelLocationInfo.cs" />
143 144
    <Compile Include="BaseModel\SPPID\SPPIDLineInfo.cs" />
144 145
    <Compile Include="BaseModel\SPPID\SPPIDSymbolInfo.cs" />
DTI_PID/SPPIDConverter/SPPIDModel/SPPID_Document.cs
64 64
                    item.SPPID = new SPPIDSymbolInfo();
65 65
            }
66 66

  
67
            foreach (var item in SpecBreaks)
68
            {
69
                if (item.SPPID == null)
70
                    item.SPPID = new SPPIDSymbolInfo();
71
            }
72

  
67 73
            foreach (var item in LINENUMBERS)
68 74
            {
69 75
                if (item.SPPID == null)
......
133 139
                item.SPPID.ORIGINAL_Y = y;
134 140
            }
135 141

  
142
            foreach (var item in SpecBreaks)
143
            {
144
                double x = double.NaN;
145
                double y = double.NaN;
146
                SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
147
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
148

  
149
                item.SPPID.ORIGINAL_X = x;
150
                item.SPPID.ORIGINAL_Y = y;
151
            }
152

  
136 153
            foreach (var item in LINENUMBERS)
137 154
            {
138 155
                double x = double.NaN;
......
386 403
                    return false;
387 404
            }
388 405

  
406
            foreach (var item in SpecBreaks)
407
            {
408
                item.SPPID.MAPPINGNAME = @"\Piping\Segment Breaks\Piping Materials Class.sym";
409
            }
410

  
389 411
            foreach (var item in LINENUMBERS)
390 412
            {
391 413
                if (LineNumberMappings.Count > 0)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)