프로젝트

일반

사용자정보

개정판 21be5063

ID21be5063ab52b9a31486501db2dbdb2a331437f6
상위 c2ee2b00
하위 254f24a8

gaqhf 이(가) 약 6년 전에 추가함

dev issue #728: Convert vb to c#

차이점 보기:

DTI_PID/SPPIDAutoModeling/AutoModeling.cs
3 3
using System.Linq;
4 4
using System.Text;
5 5
using System.Threading.Tasks;
6
using System.Xml;
6
using System.Xml.Linq;
7 7

  
8 8
namespace SPPIDAutoModeling
9 9
{
10 10
    public class AutoModeling
11 11
    {
12 12
        public static Drawing DrawingItem;
13
        XmlReader xml;
13
        private string xmlPath;
14

  
15
        public AutoModeling(string xmlPath)
16
        {
17
            this.xmlPath = xmlPath;
18
            CreateDrawingItem();
19
        }
14 20

  
15 21
        #region Xml Read and Data Setting
16
        public void SetXMLFile(string filePath)
22
        private void CreateDrawingItem()
17 23
        {
18 24
            try
19 25
            {
20
                xml = XmlReader.Create(filePath);
21

  
26
                XElement xml = XElement.Load(xmlPath);
27
                DrawingItem = new Drawing();
28
                DrawingItem.DWGNAME = xml.Element("DWGNAME").Value;
29
                DrawingItem.SIZE = xml.Element("SIZE").Value;
30
                SetSymbol(xml.Element("SYMBOLS"));
31
                SetLine(xml.Element("LINEINFOS"));
32
                SetLineNumber(xml.Element("LINENOS"));
33
                SetText(xml.Element("TEXTINFOS"));
34
                SetTrimLine(xml.Element("TRIMLINENOS"));
35
                SetNote(xml.Element("NOTES"));
22 36
            }
23 37
            catch (Exception)
24 38
            {
25 39

  
26 40
            }
27 41
        }
42

  
43
        private void SetSymbol(XElement node)
44
        {
45
            foreach (XElement item in node.Elements("SYMBOL"))
46
            {
47
                Symbol symbol = new Symbol()
48
                {
49
                    UID = item.Element("UID").Value,
50
                    NAME = item.Element("NAME").Value,
51
                    TYPE = item.Element("TYPE").Value,
52
                    ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
53
                    CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
54
                    LOCATION = item.Element("LOCATION").Value,
55
                    SIZE = item.Element("SIZE").Value,
56
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
57
                    PARENT = item.Element("PARENT").Value,
58
                    CHILD = item.Element("CHILD").Value,
59
                    HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
60
                    AREA = item.Element("AREA").Value
61
                };
62
                SetConnectors(item.Element("CONNECTORS"), symbol.CONNECTORS);
63
                SetAttributes(item.Element("SYMBOLATTRIBUTES"), symbol.ATTRIBUTES);
64
                symbol.AfterSetting();
65
            }
66
        }
67

  
68
        private void SetLine(XElement node)
69
        {
70

  
71
        }
72

  
73
        private void SetLineNumber(XElement node)
74
        {
75

  
76
        }
77

  
78
        private void SetTrimLine(XElement node)
79
        {
80

  
81
        }
82

  
83
        private void SetText(XElement node)
84
        {
85

  
86
        }
87

  
88
        private void SetNote(XElement node)
89
        {
90

  
91
        }
92

  
93
        private void SetConnectors(XElement node, List<Connector> connectors)
94
        {
95
            foreach (XElement item in node.Elements("CONNECTOR"))
96
            {
97
                connectors.Add(new Connector()
98
                {
99
                    CONNECTEDITEM = item.Element("CONNECTEDITEM").Value,
100
                    CONNECTPOINT = item.Element("CONNECTPOINT").Value,
101
                    SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value
102
                });
103
            }
104
        }
105

  
106
        private void SetAttributes(XElement node, List<Attribute> attributes)
107
        {
108

  
109
        }
110

  
28 111
        #endregion
29 112

  
113
        
30 114

  
31 115
        public void Run()
32 116
        {
33

  
117
            foreach (Symbol item in DrawingItem.SYMBOLS)
118
            {
119
                item.Modeling();
120
            }
34 121
        }
35 122
    }
36 123
}

내보내기 Unified diff

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