hytos / DTI_PID / SPPIDConverter / SPPIDModel / SPPID_Document.cs @ 30ba9ae0
이력 | 보기 | 이력해설 | 다운로드 (23.1 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.Data; |
7 |
using Converter.BaseModel; |
8 |
using Converter.SPPID.Util; |
9 |
|
10 |
namespace Converter.SPPID.Model |
11 |
{ |
12 |
public class SPPID_Document : Document |
13 |
{ |
14 |
public SPPID_Document(string xmlPath) : base(xmlPath) |
15 |
{ |
16 |
|
17 |
} |
18 |
|
19 |
public List<SymbolMapping> SymbolMappings; |
20 |
public List<ChildSymbolMapping> ChildSymbolMappings; |
21 |
public List<LineMapping> LineMappings; |
22 |
public List<LineNumberMapping> LineNumberMappings; |
23 |
public List<AttributeMapping> AttributeMappings; |
24 |
public ETCSetting ETCSetting; |
25 |
public DataTable SymbolTable { get; set; } |
26 |
|
27 |
public List<Group> GROUPS = new List<Group>(); |
28 |
|
29 |
public string DrawingName { get; set; } |
30 |
public string DrawingNumber { get; set; } |
31 |
public string Unit { get; set; } |
32 |
public string Template { get; set; } |
33 |
public string SPPID_DrawingNumber { get; set; } |
34 |
public string SPPID_DrawingName { get; set; } |
35 |
|
36 |
public void SetSPPIDInfo() |
37 |
{ |
38 |
foreach (var item in SYMBOLS) |
39 |
{ |
40 |
if (item.SPPID == null) |
41 |
item.SPPID = new SPPIDSymbolInfo(); |
42 |
|
43 |
foreach (var childSymbol in item.ChildSymbols) |
44 |
{ |
45 |
if (childSymbol.SPPID == null) |
46 |
childSymbol.SPPID = new SPPIDSymbolInfo(); |
47 |
SetChildSymbolSPPIDInfo(childSymbol); |
48 |
} |
49 |
} |
50 |
|
51 |
foreach (var item in LINES) |
52 |
{ |
53 |
if (item.SPPID == null) |
54 |
item.SPPID = new SPPIDLineInfo(); |
55 |
} |
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 |
foreach (var item in SpecBreaks) |
70 |
{ |
71 |
if (item.SPPID == null) |
72 |
item.SPPID = new SPPIDSymbolInfo(); |
73 |
} |
74 |
|
75 |
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 |
|
103 |
item.SPPID.ORIGINAL_X = x; |
104 |
item.SPPID.ORIGINAL_Y = y; |
105 |
} |
106 |
|
107 |
foreach (var item in LINES) |
108 |
{ |
109 |
double startX = double.NaN; |
110 |
double startY = double.NaN; |
111 |
|
112 |
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 |
|
117 |
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 |
} |
127 |
|
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 |
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
134 |
|
135 |
item.SPPID.ORIGINAL_X = x; |
136 |
item.SPPID.ORIGINAL_Y = y; |
137 |
} |
138 |
|
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 |
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
145 |
item.SPPID.ORIGINAL_X = x; |
146 |
item.SPPID.ORIGINAL_Y = y; |
147 |
} |
148 |
|
149 |
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 |
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 |
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
166 |
item.SPPID.ORIGINAL_X = x; |
167 |
item.SPPID.ORIGINAL_Y = y; |
168 |
|
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 |
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 |
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 |
} |
181 |
|
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 |
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
188 |
item.SPPID.ORIGINAL_X = x; |
189 |
item.SPPID.ORIGINAL_Y = y; |
190 |
|
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 |
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 |
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 |
} |
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 |
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
210 |
item.SPPID.ORIGINAL_X = x; |
211 |
item.SPPID.ORIGINAL_Y = y; |
212 |
|
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 |
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 |
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 |
} |
225 |
} |
226 |
|
227 |
/// <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 |
item.SPPID.CorrectionX_GroupSymbols = groupSymbols; |
257 |
} |
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 |
item.SPPID.CorrectionY_GroupSymbols = groupSymbols; |
283 |
} |
284 |
} |
285 |
} |
286 |
|
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 |
} |
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 |
|
330 |
Connector otherConnector = connLine.CONNECTORS.Find(x => x.CONNECTEDITEM != symbol.UID); |
331 |
int connectorIndex = connLine.CONNECTORS.IndexOf(otherConnector); |
332 |
double lineX = double.NaN; |
333 |
double lineY = double.NaN; |
334 |
// Symbol의 Connector ScenePoint |
335 |
SPPIDUtil.ConvertPointBystring(connectorIndex == 0 ? connLine.STARTPOINT : connLine.ENDPOINT, ref lineX, ref lineY); |
336 |
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 |
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 |
private void FindGroupByLineAndSlopeType(Line line, List<object> group, SlopeType searchType) |
354 |
{ |
355 |
foreach (var connector in line.CONNECTORS) |
356 |
{ |
357 |
object connectedItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
358 |
if (connectedItem != null && connectedItem.GetType() == typeof(Symbol)) |
359 |
{ |
360 |
Symbol connSymbol = connectedItem as Symbol; |
361 |
|
362 |
Connector otherConnector = line.CONNECTORS.Find(x => x.CONNECTEDITEM != connSymbol.UID); |
363 |
int connectorIndex = line.CONNECTORS.IndexOf(otherConnector); |
364 |
double lineX = double.NaN; |
365 |
double lineY = double.NaN; |
366 |
// Line의 Connector ScenePoint |
367 |
SPPIDUtil.ConvertPointBystring(connectorIndex == 0 ? line.STARTPOINT : line.ENDPOINT, ref lineX, ref lineY); |
368 |
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 |
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 |
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 |
|
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 |
} |
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 |
} |
433 |
|
434 |
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 |
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 |
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 |
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 |
|
473 |
return true; |
474 |
} |
475 |
|
476 |
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 |
|
491 |
public void CheckModelingResult() |
492 |
{ |
493 |
StringBuilder sb = new StringBuilder(); |
494 |
sb.AppendLine("Modeling Result"); |
495 |
foreach (var item in Equipments) |
496 |
{ |
497 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
498 |
sb.AppendLine("Fail Equipment Modeling UID : " + item.UID); |
499 |
} |
500 |
foreach (var item in SYMBOLS) |
501 |
{ |
502 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
503 |
sb.AppendLine("Fail Symbol Modeling UID : " + item.UID); |
504 |
foreach (var child in item.ChildSymbols) |
505 |
{ |
506 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
507 |
{ |
508 |
sb.AppendLine("Fail Child Symbol Modeling UID : " + item.UID); |
509 |
sb.AppendLine("Fail Child Symbol Name : " + child.NAME); |
510 |
} |
511 |
loop(child, item, sb); |
512 |
} |
513 |
} |
514 |
foreach (var item in LINES) |
515 |
{ |
516 |
if (string.IsNullOrEmpty(item.SPPID.ModelItemId)) |
517 |
sb.AppendLine("Fail Line Modeling UID : " + item.UID); |
518 |
} |
519 |
foreach (var item in LINENUMBERS) |
520 |
{ |
521 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
522 |
sb.AppendLine("Fail Line Number Modeling UID : " + item.UID); |
523 |
} |
524 |
foreach (var item in NOTES) |
525 |
{ |
526 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
527 |
sb.AppendLine("Fail Note Text Modeling UID : " + item.UID); |
528 |
} |
529 |
foreach (var item in TEXTINFOS) |
530 |
{ |
531 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
532 |
sb.AppendLine("Fail Text Modeling UID : " + item.UID); |
533 |
} |
534 |
foreach (var item in EndBreaks) |
535 |
{ |
536 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
537 |
sb.AppendLine("Fail End Break Modeling UID : " + item.UID); |
538 |
} |
539 |
foreach (var item in SpecBreaks) |
540 |
{ |
541 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
542 |
sb.AppendLine("Fail SpecBreak Modeling UID : " + item.UID); |
543 |
} |
544 |
sb.AppendLine("End Modeling Result"); |
545 |
Log.Write(sb.ToString()); |
546 |
} |
547 |
|
548 |
private void loop(ChildSymbol childLoop, Symbol item, StringBuilder sb) |
549 |
{ |
550 |
foreach (var childLoopLoop in childLoop.ChildSymbols) |
551 |
{ |
552 |
if (string.IsNullOrEmpty(item.SPPID.RepresentationId)) |
553 |
{ |
554 |
sb.AppendLine("Fail Child Symbol Modeling UID : " + item.UID); |
555 |
sb.AppendLine("Fail Child Symbol Name : " + childLoopLoop.NAME); |
556 |
} |
557 |
loop(childLoop, item, sb); |
558 |
} |
559 |
} |
560 |
} |
561 |
} |