hytos / DTI_PID / SPPIDAutoModeling / AutoModeling.cs @ 21be5063
이력 | 보기 | 이력해설 | 다운로드 (3.43 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
using System.Xml.Linq; |
7 |
|
8 |
namespace SPPIDAutoModeling |
9 |
{ |
10 |
public class AutoModeling |
11 |
{ |
12 |
public static Drawing DrawingItem; |
13 |
private string xmlPath; |
14 |
|
15 |
public AutoModeling(string xmlPath) |
16 |
{ |
17 |
this.xmlPath = xmlPath; |
18 |
CreateDrawingItem(); |
19 |
} |
20 |
|
21 |
#region Xml Read and Data Setting |
22 |
private void CreateDrawingItem() |
23 |
{ |
24 |
try |
25 |
{ |
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")); |
36 |
} |
37 |
catch (Exception) |
38 |
{ |
39 |
|
40 |
} |
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 |
|
111 |
#endregion |
112 |
|
113 |
|
114 |
|
115 |
public void Run() |
116 |
{ |
117 |
foreach (Symbol item in DrawingItem.SYMBOLS) |
118 |
{ |
119 |
item.Modeling(); |
120 |
} |
121 |
} |
122 |
} |
123 |
} |