개정판 70268347
dev issue #829 : edit source
DTI_PID/SPPIDConverter_AutoModeling/Modeling/AutoModeling.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Windows.Forms; |
|
3 | 2 |
using System.Collections.Generic; |
4 | 3 |
using System.Drawing; |
5 | 4 |
using System.Linq; |
... | ... | |
18 | 17 |
public class AutoModeling |
19 | 18 |
{ |
20 | 19 |
private Document document; |
21 |
private ListBox logListBox; |
|
22 |
private ToolStripProgressBar progressBar; |
|
23 | 20 |
|
24 | 21 |
public AutoModeling(Document doc) |
25 | 22 |
{ |
... | ... | |
28 | 25 |
|
29 | 26 |
public void Run() |
30 | 27 |
{ |
31 |
if (progressBar != null) |
|
32 |
{ |
|
33 |
Log.SetProgressBarValue(0, progressBar); |
|
34 |
Log.SetProgressMaximumValue(document.SYMBOLS.Count + document.LINES.Count + document.LINENUMBERS.Count + document.TEXTS.Count + document.SPECBREAK.Count, progressBar); |
|
35 |
} |
|
36 |
|
|
37 |
Log.WriteLine(new ListBoxItem(string.Format("----- START [{0}] -----", document.DWGNAME), Color.Black), logListBox); |
|
38 | 28 |
Stopwatch sw = new Stopwatch(); |
39 | 29 |
sw.Start(); |
40 | 30 |
CloseOPCForm.Run(); |
... | ... | |
76 | 66 |
Line line = item as Line; |
77 | 67 |
if (line != null && line.SPPID_ITEM_OBJECT == null) |
78 | 68 |
{ |
79 |
Log.WriteLine(new ListBoxItem(string.Format("Fail Line UID : {0}", line.UID), Color.Red), logListBox); |
|
80 |
Log.ProgressBarIncrement(progressBar); |
|
69 |
|
|
81 | 70 |
} |
82 | 71 |
} |
83 | 72 |
} |
... | ... | |
91 | 80 |
LMLabelPersist label = result.Value; |
92 | 81 |
if (label != null) |
93 | 82 |
{ |
94 |
Log.WriteLine(new ListBoxItem(string.Format("Create SpecBreak UID : {0}, Type : {1}", item.UID, result.Key), Color.Black), logListBox); |
|
83 |
|
|
95 | 84 |
} |
96 | 85 |
else |
97 | 86 |
{ |
98 |
Log.WriteLine(new ListBoxItem(string.Format("Fail SpecBreak UID : {0}, Type : {1}", item.UID, result.Key), Color.Red), logListBox); |
|
87 |
|
|
99 | 88 |
} |
100 | 89 |
} |
101 |
|
|
102 |
Log.ProgressBarIncrement(progressBar); |
|
103 | 90 |
} |
104 | 91 |
|
105 | 92 |
foreach (LineNumber lineNumber in document.LINENUMBERS) |
... | ... | |
112 | 99 |
{ |
113 | 100 |
text.Modeling(document); |
114 | 101 |
if (text.SPPID_ITEM_OBJECT != null || text.IsAssociation) |
115 |
Log.WriteLine(new ListBoxItem(string.Format("Create Text UID : {0}", text.UID), Color.Black), logListBox); |
|
102 |
{ |
|
103 |
|
|
104 |
} |
|
116 | 105 |
else |
117 | 106 |
{ |
118 |
Log.WriteLine(new ListBoxItem(string.Format("Fail Text UID : {0}", text.UID), Color.Red), logListBox); |
|
119 |
Log.WriteLine(text.VALUE + "/" + text.SPPIDMAPPINGNAME); |
|
107 |
|
|
120 | 108 |
} |
121 |
|
|
122 |
Log.ProgressBarIncrement(progressBar); |
|
123 | 109 |
} |
124 | 110 |
|
125 |
if (progressBar != null) |
|
126 |
{ |
|
127 |
Log.SetProgressBarValue(0, progressBar); |
|
128 |
Log.SetProgressMaximumValue(document.SYMBOLS.Count, progressBar); |
|
129 |
} |
|
130 | 111 |
// attribute |
131 | 112 |
foreach (Symbol item in document.SYMBOLS) |
132 | 113 |
{ |
... | ... | |
134 | 115 |
{ |
135 | 116 |
item.SetAttribute(document); |
136 | 117 |
} |
137 |
Log.ProgressBarIncrement(progressBar); |
|
138 | 118 |
} |
139 | 119 |
|
140 | 120 |
|
141 | 121 |
CloseOPCForm.Stop(); |
142 | 122 |
// |
143 |
Log.SetProgressBarValue(progressBar.Maximum, progressBar); |
|
144 |
|
|
145 |
Log.WriteLine(new ListBoxItem(string.Format("----- END [{0}] -----", document.DWGNAME), Color.Black), logListBox); |
|
146 | 123 |
sw.Stop(); |
147 | 124 |
TimeSpan ts = sw.Elapsed; |
148 | 125 |
string elapsedTime = String.Format("{0:00}:{1:00}.{2:00}", |
149 | 126 |
ts.Minutes, ts.Seconds, |
150 | 127 |
ts.Milliseconds / 10); |
151 |
Log.WriteLine(new ListBoxItem(string.Format("Time : {0}", ts), Color.Black), logListBox); |
|
152 |
Log.WriteLine(new ListBoxItem("", Color.Black), logListBox); |
|
153 | 128 |
} |
154 | 129 |
|
155 | 130 |
private bool IsPossibleDrawGroupLine(Group group) |
... | ... | |
181 | 156 |
return true; |
182 | 157 |
} |
183 | 158 |
|
184 |
public void SetListBoxLog(ListBox logListBox) |
|
185 |
{ |
|
186 |
this.logListBox = logListBox; |
|
187 |
} |
|
188 |
|
|
189 |
public void SetProgressBar(ToolStripProgressBar progressBar) |
|
190 |
{ |
|
191 |
this.progressBar = progressBar; |
|
192 |
} |
|
193 |
|
|
194 | 159 |
#region Modeling |
195 | 160 |
|
196 | 161 |
private bool GroupSymbolModeling(Group group) |
... | ... | |
240 | 205 |
{ |
241 | 206 |
prevSymbol = symbol; |
242 | 207 |
prevIndex = itemIndex; |
243 |
Log.WriteLine(new ListBoxItem(string.Format("Create Symbol UID : {0}", symbol.UID), Color.Black), logListBox); |
|
244 |
Log.ProgressBarIncrement(progressBar); |
|
245 | 208 |
} |
246 | 209 |
else |
247 | 210 |
{ |
248 |
Log.WriteLine(new ListBoxItem(string.Format("Fail Symbol UID : {0}", symbol.UID), Color.Red), logListBox); |
|
249 |
Log.ProgressBarIncrement(progressBar); |
|
250 | 211 |
result = false; |
251 | 212 |
} |
252 | 213 |
} |
253 | 214 |
} |
254 | 215 |
catch (Exception ex) |
255 | 216 |
{ |
256 |
Log.WriteLine(new ListBoxItem(string.Format("Fail Symbol UID : {0}", symbol.UID), Color.Red), logListBox); |
|
257 |
Log.ProgressBarIncrement(progressBar); |
|
258 |
Log.WriteLine(ex); |
|
259 | 217 |
result = false; |
260 | 218 |
return result; |
261 | 219 |
} |
... | ... | |
308 | 266 |
{ |
309 | 267 |
line.SPPID_ITEM_OBJECT = modelId; |
310 | 268 |
IfContainLineNumber(line.UID); |
311 |
|
|
312 |
Log.WriteLine(new ListBoxItem(string.Format("Create Line UID : {0}", line.UID), Color.Black), logListBox); |
|
313 |
Log.ProgressBarIncrement(progressBar); |
|
314 | 269 |
} |
315 | 270 |
} |
316 | 271 |
else |
317 | 272 |
{ |
318 | 273 |
foreach (Line line in lines) |
319 | 274 |
{ |
320 |
Log.WriteLine(new ListBoxItem(string.Format("Fail Line UID : {0}", line.UID), Color.Red), logListBox); |
|
321 |
Log.ProgressBarIncrement(progressBar); |
|
275 |
|
|
322 | 276 |
} |
323 | 277 |
} |
324 | 278 |
|
... | ... | |
334 | 288 |
lineNumber.Modeling(document); |
335 | 289 |
|
336 | 290 |
if (lineNumber.SPPID_ITEM_OBJECT != null) |
337 |
Log.WriteLine(new ListBoxItem(string.Format("Create Line Number UID : {0}", lineNumber.UID), Color.Black), logListBox); |
|
291 |
{ |
|
292 |
|
|
293 |
} |
|
338 | 294 |
else |
339 |
Log.WriteLine(new ListBoxItem(string.Format("Fail Line Number UID : {0}", lineNumber.UID), Color.Red), logListBox);
|
|
295 |
{
|
|
340 | 296 |
|
341 |
Log.ProgressBarIncrement(progressBar);
|
|
297 |
}
|
|
342 | 298 |
break; |
343 | 299 |
} |
344 | 300 |
} |
내보내기 Unified diff