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