hytos / DTI_PID / SPPIDConverter / SPPIDModel / SPPID_Document.cs @ f9cc5190
이력 | 보기 | 이력해설 | 다운로드 (20.2 KB)
1 | bca86986 | gaqhf | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | f1c9dbaa | gaqhf | using System.Data; |
7 | bca86986 | gaqhf | using Converter.BaseModel; |
8 | bca81f4c | gaqhf | using Converter.SPPID.Util; |
9 | bca86986 | gaqhf | |
10 | b8e2644e | gaqhf | namespace Converter.SPPID.Model |
11 | bca86986 | gaqhf | { |
12 | public class SPPID_Document : Document |
||
13 | { |
||
14 | public SPPID_Document(string xmlPath) : base(xmlPath) |
||
15 | { |
||
16 | f1c9dbaa | gaqhf | |
17 | bca86986 | gaqhf | } |
18 | 88365b05 | gaqhf | |
19 | 39a2a688 | gaqhf | public List<SymbolMapping> SymbolMappings; |
20 | 4b4dbca9 | gaqhf | public List<ChildSymbolMapping> ChildSymbolMappings; |
21 | 39a2a688 | gaqhf | public List<LineMapping> LineMappings; |
22 | public List<LineNumberMapping> LineNumberMappings; |
||
23 | 1efc25a3 | gaqhf | public List<AttributeMapping> AttributeMappings; |
24 | 39a2a688 | gaqhf | public ETCSetting ETCSetting; |
25 | 4d2571ab | gaqhf | public DataTable SymbolTable { get; set; } |
26 | 39a2a688 | gaqhf | |
27 | f1c9dbaa | gaqhf | public List<Group> GROUPS = new List<Group>(); |
28 | 5dfb8a24 | gaqhf | |
29 | bca86986 | gaqhf | public string DrawingName { get; set; } |
30 | public string DrawingNumber { get; set; } |
||
31 | public string Unit { get; set; } |
||
32 | 4314b3f3 | gaqhf | public string Template { get; set; } |
33 | 88bac50c | gaqhf | public string SPPID_DrawingNumber { get; set; } |
34 | public string SPPID_DrawingName { get; set; } |
||
35 | f947c634 | gaqhf | |
36 | public void SetSPPIDInfo() |
||
37 | { |
||
38 | foreach (var item in SYMBOLS) |
||
39 | { |
||
40 | 39a2a688 | gaqhf | if (item.SPPID == null) |
41 | item.SPPID = new SPPIDSymbolInfo(); |
||
42 | 4b4dbca9 | gaqhf | |
43 | foreach (var childSymbol in item.ChildSymbols) |
||
44 | { |
||
45 | if (childSymbol.SPPID == null) |
||
46 | childSymbol.SPPID = new SPPIDSymbolInfo(); |
||
47 | SetChildSymbolSPPIDInfo(childSymbol); |
||
48 | } |
||
49 | 39a2a688 | gaqhf | } |
50 | |||
51 | foreach (var item in LINES) |
||
52 | { |
||
53 | if (item.SPPID == null) |
||
54 | item.SPPID = new SPPIDLineInfo(); |
||
55 | 1ba9c671 | gaqhf | } |
56 | |||
57 | foreach (var item in Equipments) |
||
58 | { |
||
59 | if (item.SPPID == null) |
||
60 | item.SPPID = new SPPIDSymbolInfo(); |
||
61 | } |
||
62 | |||
63 | foreach (var item in EndBreaks) |
||
64 | { |
||
65 | if (item.SPPID == null) |
||
66 | item.SPPID = new SPPIDSymbolInfo(); |
||
67 | } |
||
68 | |||
69 | 53c81765 | gaqhf | foreach (var item in SpecBreaks) |
70 | { |
||
71 | if (item.SPPID == null) |
||
72 | item.SPPID = new SPPIDSymbolInfo(); |
||
73 | } |
||
74 | |||
75 | 1ba9c671 | gaqhf | foreach (var item in LINENUMBERS) |
76 | { |
||
77 | if (item.SPPID == null) |
||
78 | item.SPPID = new SPPIDSymbolInfo(); |
||
79 | } |
||
80 | |||
81 | foreach (var item in TEXTINFOS) |
||
82 | { |
||
83 | if (item.SPPID == null) |
||
84 | item.SPPID = new SPPIDSymbolInfo(); |
||
85 | } |
||
86 | |||
87 | foreach (var item in NOTES) |
||
88 | { |
||
89 | if (item.SPPID == null) |
||
90 | item.SPPID = new SPPIDSymbolInfo(); |
||
91 | } |
||
92 | } |
||
93 | |||
94 | public void SetSPPIDLocation(double SPPIDDocumentX, double SPPIDDocumentY) |
||
95 | { |
||
96 | foreach (var item in SYMBOLS) |
||
97 | { |
||
98 | double x = double.NaN; |
||
99 | double y = double.NaN; |
||
100 | SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y); |
||
101 | SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
||
102 | 06b40010 | gaqhf | |
103 | 1ba9c671 | gaqhf | item.SPPID.ORIGINAL_X = x; |
104 | item.SPPID.ORIGINAL_Y = y; |
||
105 | } |
||
106 | |||
107 | foreach (var item in LINES) |
||
108 | { |
||
109 | a0e3dca4 | gaqhf | double startX = double.NaN; |
110 | double startY = double.NaN; |
||
111 | 39a2a688 | gaqhf | |
112 | a0e3dca4 | gaqhf | SPPIDUtil.ConvertPointBystring(item.STARTPOINT, ref startX, ref startY); |
113 | SPPIDUtil.ConvertSPPIDPoint(ref startX, ref startY, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
||
114 | item.SPPID.START_X = startX; |
||
115 | item.SPPID.START_Y = startY; |
||
116 | 39a2a688 | gaqhf | |
117 | a0e3dca4 | gaqhf | double endX = double.NaN; |
118 | double endY = double.NaN; |
||
119 | |||
120 | SPPIDUtil.ConvertPointBystring(item.ENDPOINT, ref endX, ref endY); |
||
121 | SPPIDUtil.ConvertSPPIDPoint(ref endX, ref endY, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
||
122 | item.SPPID.END_X = endX; |
||
123 | item.SPPID.END_Y = endY; |
||
124 | |||
125 | item.SlopeType = SPPIDUtil.CalcSlope(startX, startY, endX, endY); |
||
126 | 39a2a688 | gaqhf | } |
127 | 809a7640 | gaqhf | |
128 | foreach (var item in Equipments) |
||
129 | { |
||
130 | double x = double.NaN; |
||
131 | double y = double.NaN; |
||
132 | SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y); |
||
133 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
134 | 06b40010 | gaqhf | |
135 | 809a7640 | gaqhf | item.SPPID.ORIGINAL_X = x; |
136 | item.SPPID.ORIGINAL_Y = y; |
||
137 | } |
||
138 | 3165c259 | gaqhf | |
139 | foreach (var item in EndBreaks) |
||
140 | { |
||
141 | double x = double.NaN; |
||
142 | double y = double.NaN; |
||
143 | SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y); |
||
144 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
145 | 3165c259 | gaqhf | item.SPPID.ORIGINAL_X = x; |
146 | item.SPPID.ORIGINAL_Y = y; |
||
147 | } |
||
148 | 10872260 | gaqhf | |
149 | 53c81765 | gaqhf | foreach (var item in SpecBreaks) |
150 | { |
||
151 | double x = double.NaN; |
||
152 | double y = double.NaN; |
||
153 | SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y); |
||
154 | SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
||
155 | |||
156 | item.SPPID.ORIGINAL_X = x; |
||
157 | item.SPPID.ORIGINAL_Y = y; |
||
158 | } |
||
159 | |||
160 | 10872260 | gaqhf | foreach (var item in LINENUMBERS) |
161 | { |
||
162 | double x = double.NaN; |
||
163 | double y = double.NaN; |
||
164 | SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y); |
||
165 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
166 | 10872260 | gaqhf | item.SPPID.ORIGINAL_X = x; |
167 | item.SPPID.ORIGINAL_Y = y; |
||
168 | 1a3a74a8 | gaqhf | |
169 | item.SPPIDLabelLocation = new SPPIDLabelLocationInfo(); |
||
170 | double x1 = item.X1; |
||
171 | double y1 = item.Y1; |
||
172 | double x2 = item.X2; |
||
173 | double y2 = item.Y2; |
||
174 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
175 | SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
||
176 | 1a3a74a8 | gaqhf | item.SPPIDLabelLocation.X1 = Math.Min(x1, x2); |
177 | item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2); |
||
178 | item.SPPIDLabelLocation.X2 = Math.Max(x1, x2); |
||
179 | item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2); |
||
180 | 10872260 | gaqhf | } |
181 | 6b298450 | gaqhf | |
182 | foreach (var item in TEXTINFOS) |
||
183 | { |
||
184 | double x = double.NaN; |
||
185 | double y = double.NaN; |
||
186 | SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y); |
||
187 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
188 | 6b298450 | gaqhf | item.SPPID.ORIGINAL_X = x; |
189 | item.SPPID.ORIGINAL_Y = y; |
||
190 | 1a3a74a8 | gaqhf | |
191 | item.SPPIDLabelLocation = new SPPIDLabelLocationInfo(); |
||
192 | double x1 = item.X1; |
||
193 | double y1 = item.Y1; |
||
194 | double x2 = item.X2; |
||
195 | double y2 = item.Y2; |
||
196 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
197 | SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
||
198 | 1a3a74a8 | gaqhf | item.SPPIDLabelLocation.X1 = Math.Min(x1, x2); |
199 | item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2); |
||
200 | item.SPPIDLabelLocation.X2 = Math.Max(x1, x2); |
||
201 | item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2); |
||
202 | 6b298450 | gaqhf | } |
203 | |||
204 | foreach (var item in NOTES) |
||
205 | { |
||
206 | double x = double.NaN; |
||
207 | double y = double.NaN; |
||
208 | SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y); |
||
209 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
210 | 6b298450 | gaqhf | item.SPPID.ORIGINAL_X = x; |
211 | item.SPPID.ORIGINAL_Y = y; |
||
212 | 1a3a74a8 | gaqhf | |
213 | item.SPPIDLabelLocation = new SPPIDLabelLocationInfo(); |
||
214 | double x1 = item.X1; |
||
215 | double y1 = item.Y1; |
||
216 | double x2 = item.X2; |
||
217 | double y2 = item.Y2; |
||
218 | 1ba9c671 | gaqhf | SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
219 | SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
||
220 | 1a3a74a8 | gaqhf | item.SPPIDLabelLocation.X1 = Math.Min(x1, x2); |
221 | item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2); |
||
222 | item.SPPIDLabelLocation.X2 = Math.Max(x1, x2); |
||
223 | item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2); |
||
224 | 6b298450 | gaqhf | } |
225 | 39a2a688 | gaqhf | } |
226 | 4b4dbca9 | gaqhf | |
227 | c01ce90b | gaqhf | /// <summary> |
228 | /// 좌표 보정 |
||
229 | /// </summary> |
||
230 | public void CoordinateCorrection() |
||
231 | { |
||
232 | foreach (Symbol symbol in SYMBOLS) |
||
233 | { |
||
234 | if (!symbol.SPPID.IsCorrectionX) |
||
235 | { |
||
236 | List<object> group = new List<object>(); |
||
237 | group.Add(symbol); |
||
238 | FindGroupBySymbolAndSlopeType(symbol, group, SlopeType.VERTICAL); |
||
239 | |||
240 | List<Symbol> groupSymbols = (from sym in @group |
||
241 | where sym.GetType() == typeof(Symbol) |
||
242 | select sym as Symbol).ToList(); |
||
243 | |||
244 | // X 좌표만 보정 |
||
245 | Symbol correctionSymbol = groupSymbols.Find(x => x.SPPID.IsCorrectionX); |
||
246 | double value = symbol.SPPID.ORIGINAL_X; |
||
247 | if (correctionSymbol == null) |
||
248 | SPPIDUtil.ConvertGridPointOnlyOnePoint(ref value); |
||
249 | else |
||
250 | value = correctionSymbol.SPPID.ORIGINAL_X; |
||
251 | |||
252 | foreach (var item in groupSymbols) |
||
253 | { |
||
254 | item.SPPID.IsCorrectionX = true; |
||
255 | item.SPPID.ORIGINAL_X = value; |
||
256 | d9794a6c | gaqhf | item.SPPID.CorrectionX_GroupSymbols = groupSymbols; |
257 | c01ce90b | gaqhf | } |
258 | } |
||
259 | |||
260 | if (!symbol.SPPID.IsCorrectionY) |
||
261 | { |
||
262 | List<object> group = new List<object>(); |
||
263 | group.Add(symbol); |
||
264 | FindGroupBySymbolAndSlopeType(symbol, group, SlopeType.HORIZONTAL); |
||
265 | |||
266 | List<Symbol> groupSymbols = (from sym in @group |
||
267 | where sym.GetType() == typeof(Symbol) |
||
268 | select sym as Symbol).ToList(); |
||
269 | |||
270 | // Y 좌표만 보정 |
||
271 | Symbol correctionSymbol = groupSymbols.Find(x => x.SPPID.IsCorrectionY); |
||
272 | double value = symbol.SPPID.ORIGINAL_Y; |
||
273 | if (correctionSymbol == null) |
||
274 | SPPIDUtil.ConvertGridPointOnlyOnePoint(ref value); |
||
275 | else |
||
276 | value = correctionSymbol.SPPID.ORIGINAL_Y; |
||
277 | |||
278 | foreach (var item in groupSymbols) |
||
279 | { |
||
280 | item.SPPID.IsCorrectionY = true; |
||
281 | item.SPPID.ORIGINAL_Y = value; |
||
282 | d9794a6c | gaqhf | item.SPPID.CorrectionY_GroupSymbols = groupSymbols; |
283 | c01ce90b | gaqhf | } |
284 | } |
||
285 | } |
||
286 | a0e3dca4 | gaqhf | |
287 | foreach (Line line in LINES) |
||
288 | { |
||
289 | double tempX = line.SPPID.START_X; |
||
290 | double tempY = line.SPPID.START_Y; |
||
291 | SPPIDUtil.ConvertGridPoint(ref tempX, ref tempY); |
||
292 | line.SPPID.START_X = tempX; |
||
293 | line.SPPID.START_Y = tempY; |
||
294 | |||
295 | tempX = line.SPPID.END_X; |
||
296 | tempY = line.SPPID.END_Y; |
||
297 | SPPIDUtil.ConvertGridPoint(ref tempX, ref tempY); |
||
298 | line.SPPID.END_X = tempX; |
||
299 | line.SPPID.END_Y = tempY; |
||
300 | |||
301 | if (line.SlopeType == SlopeType.HORIZONTAL) |
||
302 | line.SPPID.END_Y = line.SPPID.START_Y; |
||
303 | else if (line.SlopeType == SlopeType.VERTICAL) |
||
304 | line.SPPID.END_X = line.SPPID.START_X; |
||
305 | } |
||
306 | c01ce90b | gaqhf | } |
307 | |||
308 | private void FindGroupBySymbolAndSlopeType(Symbol symbol, List<object> group, SlopeType searchType) |
||
309 | { |
||
310 | foreach (var connector in symbol.CONNECTORS) |
||
311 | { |
||
312 | object connectedItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
||
313 | if (connectedItem != null && connectedItem.GetType() == typeof(Symbol)) |
||
314 | { |
||
315 | Symbol connSymbol = connectedItem as Symbol; |
||
316 | SlopeType slopeType = SPPIDUtil.CalcSlope(symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y, connSymbol.SPPID.ORIGINAL_X, connSymbol.SPPID.ORIGINAL_Y); |
||
317 | if (slopeType == searchType) |
||
318 | { |
||
319 | if (!group.Contains(connSymbol)) |
||
320 | { |
||
321 | group.Add(connSymbol); |
||
322 | FindGroupBySymbolAndSlopeType(connSymbol, group, searchType); |
||
323 | } |
||
324 | } |
||
325 | } |
||
326 | else if (connectedItem != null && connectedItem.GetType() == typeof(Line)) |
||
327 | { |
||
328 | Line connLine = connectedItem as Line; |
||
329 | 02480ac1 | gaqhf | |
330 | 1ed39474 | gaqhf | Connector otherConnector = connLine.CONNECTORS.Find(x => x.CONNECTEDITEM != symbol.UID); |
331 | f1a7faf9 | gaqhf | int connectorIndex = connLine.CONNECTORS.IndexOf(otherConnector); |
332 | 02480ac1 | gaqhf | double lineX = double.NaN; |
333 | double lineY = double.NaN; |
||
334 | // Symbol의 Connector ScenePoint |
||
335 | f1a7faf9 | gaqhf | SPPIDUtil.ConvertPointBystring(connectorIndex == 0 ? connLine.STARTPOINT : connLine.ENDPOINT, ref lineX, ref lineY); |
336 | 02480ac1 | gaqhf | double symbolX = double.NaN; |
337 | double symbolY = double.NaN; |
||
338 | SPPIDUtil.ConvertPointBystring(symbol.ORIGINALPOINT, ref symbolX, ref symbolY); |
||
339 | |||
340 | SlopeType slopeType = SPPIDUtil.CalcSlope(lineX, lineY, symbolX, symbolY); |
||
341 | c01ce90b | gaqhf | if (slopeType == searchType) |
342 | { |
||
343 | if (!group.Contains(connLine)) |
||
344 | { |
||
345 | group.Add(connLine); |
||
346 | FindGroupByLineAndSlopeType(connLine, group, searchType); |
||
347 | } |
||
348 | } |
||
349 | } |
||
350 | } |
||
351 | } |
||
352 | |||
353 | f1a7faf9 | gaqhf | private void FindGroupByLineAndSlopeType(Line line, List<object> group, SlopeType searchType) |
354 | c01ce90b | gaqhf | { |
355 | f1a7faf9 | gaqhf | foreach (var connector in line.CONNECTORS) |
356 | c01ce90b | gaqhf | { |
357 | object connectedItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
||
358 | if (connectedItem != null && connectedItem.GetType() == typeof(Symbol)) |
||
359 | { |
||
360 | Symbol connSymbol = connectedItem as Symbol; |
||
361 | 02480ac1 | gaqhf | |
362 | f1a7faf9 | gaqhf | Connector otherConnector = line.CONNECTORS.Find(x => x.CONNECTEDITEM != connSymbol.UID); |
363 | int connectorIndex = line.CONNECTORS.IndexOf(otherConnector); |
||
364 | c01ce90b | gaqhf | double lineX = double.NaN; |
365 | double lineY = double.NaN; |
||
366 | 02480ac1 | gaqhf | // Line의 Connector ScenePoint |
367 | f1a7faf9 | gaqhf | SPPIDUtil.ConvertPointBystring(connectorIndex == 0 ? line.STARTPOINT : line.ENDPOINT, ref lineX, ref lineY); |
368 | c01ce90b | gaqhf | double symbolX = double.NaN; |
369 | double symbolY = double.NaN; |
||
370 | SPPIDUtil.ConvertPointBystring(connSymbol.ORIGINALPOINT, ref symbolX, ref symbolY); |
||
371 | |||
372 | SlopeType slopeType = SPPIDUtil.CalcSlope(lineX, lineY, symbolX, symbolY); |
||
373 | if (slopeType == searchType) |
||
374 | { |
||
375 | if (!group.Contains(connSymbol)) |
||
376 | { |
||
377 | group.Add(connSymbol); |
||
378 | FindGroupBySymbolAndSlopeType(connSymbol, group, searchType); |
||
379 | } |
||
380 | } |
||
381 | } |
||
382 | else if (connectedItem != null && connectedItem.GetType() == typeof(Line)) |
||
383 | { |
||
384 | Line connLine = connectedItem as Line; |
||
385 | SlopeType slopeType = SPPIDUtil.CalcSlope(connLine.SPPID.START_X, connLine.SPPID.START_Y, connLine.SPPID.END_X, connLine.SPPID.END_Y); |
||
386 | if (slopeType == searchType) |
||
387 | { |
||
388 | if (!group.Contains(connLine)) |
||
389 | { |
||
390 | group.Add(connLine); |
||
391 | FindGroupByLineAndSlopeType(connLine, group, searchType); |
||
392 | } |
||
393 | } |
||
394 | } |
||
395 | } |
||
396 | } |
||
397 | |||
398 | 4b4dbca9 | gaqhf | private void SetChildSymbolSPPIDInfo(ChildSymbol item) |
399 | { |
||
400 | foreach (var childSymbol in item.ChildSymbols) |
||
401 | { |
||
402 | if (childSymbol.SPPID == null) |
||
403 | childSymbol.SPPID = new SPPIDSymbolInfo(); |
||
404 | SetChildSymbolSPPIDInfo(childSymbol); |
||
405 | } |
||
406 | } |
||
407 | |||
408 | 39a2a688 | gaqhf | public bool SetSPPIDMapping() |
409 | { |
||
410 | foreach (var item in SYMBOLS) |
||
411 | { |
||
412 | SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID); |
||
413 | item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
||
414 | if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
||
415 | return false; |
||
416 | 4b4dbca9 | gaqhf | |
417 | foreach (var childSymbol in item.ChildSymbols) |
||
418 | { |
||
419 | ChildSymbolMapping childMapping = ChildSymbolMappings.Find(x => x.UID == childSymbol.NAME); |
||
420 | childSymbol.SPPID.MAPPINGNAME = childMapping != null ? childMapping.SPPIDSYMBOLNAME : null; |
||
421 | if (string.IsNullOrEmpty(childSymbol.SPPID.MAPPINGNAME) || !SetChildSymbolMapping(childSymbol)) |
||
422 | return false; |
||
423 | } |
||
424 | 39a2a688 | gaqhf | } |
425 | |||
426 | foreach (var item in LINES) |
||
427 | { |
||
428 | LineMapping mapping = LineMappings.Find(x => x.UID == item.TYPEUID); |
||
429 | item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
||
430 | if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
||
431 | return false; |
||
432 | f947c634 | gaqhf | } |
433 | |||
434 | 809a7640 | gaqhf | foreach (var item in Equipments) |
435 | { |
||
436 | SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID); |
||
437 | item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
||
438 | if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
||
439 | return false; |
||
440 | } |
||
441 | |||
442 | 3165c259 | gaqhf | foreach (var item in EndBreaks) |
443 | { |
||
444 | SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID); |
||
445 | item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
||
446 | if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
||
447 | return false; |
||
448 | } |
||
449 | |||
450 | 10872260 | gaqhf | foreach (var item in LINENUMBERS) |
451 | { |
||
452 | if (LineNumberMappings.Count > 0) |
||
453 | item.SPPID.MAPPINGNAME = LineNumberMappings[0].SPPIDSYMBOLNAME; |
||
454 | if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
||
455 | return false; |
||
456 | } |
||
457 | |||
458 | 6b298450 | gaqhf | ETCSetting etc = ETCSetting.GetInstance(); |
459 | foreach (var item in NOTES) |
||
460 | { |
||
461 | item.SPPID.MAPPINGNAME = etc.NoteSymbolPath; |
||
462 | if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
||
463 | return false; |
||
464 | } |
||
465 | |||
466 | foreach (var item in TEXTINFOS) |
||
467 | { |
||
468 | item.SPPID.MAPPINGNAME = etc.TextSymbolPath; |
||
469 | if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
||
470 | return false; |
||
471 | } |
||
472 | 4b4dbca9 | gaqhf | |
473 | 39a2a688 | gaqhf | return true; |
474 | f947c634 | gaqhf | } |
475 | 5dfb8a24 | gaqhf | |
476 | 4b4dbca9 | gaqhf | private bool SetChildSymbolMapping(ChildSymbol item) |
477 | { |
||
478 | foreach (var childSymbol in item.ChildSymbols) |
||
479 | { |
||
480 | ChildSymbolMapping childMapping = ChildSymbolMappings.Find(x => x.UID == childSymbol.NAME); |
||
481 | childSymbol.SPPID.MAPPINGNAME = childMapping != null ? childMapping.SPPIDSYMBOLNAME : null; |
||
482 | if (string.IsNullOrEmpty(childSymbol.SPPID.MAPPINGNAME)) |
||
483 | return false; |
||
484 | else |
||
485 | return SetChildSymbolMapping(childSymbol); |
||
486 | } |
||
487 | |||
488 | return true; |
||
489 | } |
||
490 | bca86986 | gaqhf | } |
491 | } |