개정판 bca81f4c
dev issue #000 : add grouping
Change-Id: I2d73f7cf5a88d09ff8e3f51bd45cc70369c34c24
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs | ||
---|---|---|
8 | 8 |
using Converter.SPPID.DB; |
9 | 9 |
using Converter.BaseModel; |
10 | 10 |
using System.Windows.Forms; |
11 |
using Converter.SPPID.Model; |
|
11 | 12 |
|
12 | 13 |
namespace Converter.SPPID.Util |
13 | 14 |
{ |
... | ... | |
62 | 63 |
} |
63 | 64 |
return true; |
64 | 65 |
} |
66 |
|
|
67 |
public static string GetSPPIDMappingPath(SPPID_Document document, object itemObj) |
|
68 |
{ |
|
69 |
if (itemObj.GetType() == typeof(Symbol)) |
|
70 |
{ |
|
71 |
Symbol item = itemObj as Symbol; |
|
72 |
return document.SymbolMappings.Find(x => x.SYMBOLNAME == item.NAME).SPPIDSYMBOLNAME; |
|
73 |
} |
|
74 |
else if (itemObj.GetType() == typeof(Line)) |
|
75 |
{ |
|
76 |
Line item = itemObj as Line; |
|
77 |
return document.LineMappings.Find(x => x.LINENAME == item.TYPE).SPPIDSYMBOLNAME; |
|
78 |
} |
|
79 |
else if (itemObj.GetType() == typeof(Text)) |
|
80 |
{ |
|
81 |
|
|
82 |
} |
|
83 |
else if (itemObj.GetType() == typeof(Note)) |
|
84 |
{ |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
return null; |
|
89 |
} |
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
#region |
|
94 |
public static bool IsBranchLine(string UID, Line connectedLine) |
|
95 |
{ |
|
96 |
try |
|
97 |
{ |
|
98 |
if (connectedLine.CONNECTORS[0].CONNECTEDITEM != UID && connectedLine.CONNECTORS[1].CONNECTEDITEM != UID) |
|
99 |
return true; |
|
100 |
} |
|
101 |
catch (Exception ex) |
|
102 |
{ |
|
103 |
|
|
104 |
} |
|
105 |
|
|
106 |
return false; |
|
107 |
} |
|
108 |
public static object FindObjectByUID(Document document, string UID) |
|
109 |
{ |
|
110 |
foreach (Symbol item in document.SYMBOLS) |
|
111 |
{ |
|
112 |
if (item.UID == UID) |
|
113 |
return item; |
|
114 |
} |
|
115 |
|
|
116 |
foreach (Line item in document.LINES) |
|
117 |
{ |
|
118 |
if (item.UID == UID) |
|
119 |
return item; |
|
120 |
} |
|
121 |
|
|
122 |
foreach (Text item in document.TEXTINFOS) |
|
123 |
{ |
|
124 |
if (item.UID == UID) |
|
125 |
return item; |
|
126 |
} |
|
127 |
|
|
128 |
foreach (Note item in document.NOTES) |
|
129 |
{ |
|
130 |
if (item.UID == UID) |
|
131 |
return item; |
|
132 |
} |
|
133 |
|
|
134 |
foreach (LineNumber item in document.LINENUMBERS) |
|
135 |
{ |
|
136 |
if (item.UID == UID) |
|
137 |
return item; |
|
138 |
} |
|
139 |
|
|
140 |
return null; |
|
141 |
} |
|
142 |
#endregion |
|
65 | 143 |
} |
66 | 144 |
} |
내보내기 Unified diff