|
@@ -20,6 +20,9 @@ using System.Linq;
|
|
|
using System.Reflection;
|
|
|
using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
|
+using NPOI.XSSF.UserModel;
|
|
|
+using NPOI.SS.UserModel.Charts;
|
|
|
+using NPOI.SS.Util;
|
|
|
|
|
|
namespace OTSIncAReportGrids
|
|
|
{
|
|
@@ -85,14 +88,14 @@ namespace OTSIncAReportGrids
|
|
|
ParticleData Particledata;
|
|
|
UserLibraryData userLibrary;
|
|
|
DataTable userLibraryData;
|
|
|
- NLog.Logger log= NLog.LogManager.GetCurrentClassLogger();
|
|
|
+ NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
enum SelItem
|
|
|
{
|
|
|
- analyticalParticle=0,
|
|
|
- selectParticles=1,
|
|
|
- otherParticles=2,
|
|
|
- MergeParticles=3
|
|
|
+ analyticalParticle = 0,
|
|
|
+ selectParticles = 1,
|
|
|
+ otherParticles = 2,
|
|
|
+ MergeParticles = 3
|
|
|
}
|
|
|
|
|
|
#region 分页器相关
|
|
@@ -180,15 +183,16 @@ namespace OTSIncAReportGrids
|
|
|
resultFile = ReportApp.m_rstDataMgr.CurResultFile;
|
|
|
ReportFun = new OTSImageDisHelp(resultFile);
|
|
|
|
|
|
- string sou=m_condition.m_CurrentConditions[OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
|
|
|
+ string sou = m_condition.m_CurrentConditions[OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
|
|
|
if (sou.Contains("+"))
|
|
|
{
|
|
|
- result=m_ReportApp.m_rstDataMgr.ResultFilesList[0];
|
|
|
- }else
|
|
|
+ result = m_ReportApp.m_rstDataMgr.ResultFilesList[0];
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- for(int i=0;i < m_ReportApp.m_rstDataMgr.ResultFilesList.Count;i++)
|
|
|
+ for (int i = 0; i < m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
|
|
|
{
|
|
|
- if (sou== m_ReportApp.m_rstDataMgr.ResultFilesList[i].FileName_real.ToString())
|
|
|
+ if (sou == m_ReportApp.m_rstDataMgr.ResultFilesList[i].FileName_real.ToString())
|
|
|
{
|
|
|
result = m_ReportApp.m_rstDataMgr.ResultFilesList[i];
|
|
|
}
|
|
@@ -215,32 +219,32 @@ namespace OTSIncAReportGrids
|
|
|
lan = new Language(this);
|
|
|
table = lan.GetNameTable(this.Name);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
m_mythread_state = false;
|
|
|
m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
|
|
|
//m_frm_userprogress = new Frm_UserProgress();
|
|
|
fieldData = new FieldData(result.FilePath);
|
|
|
Particledata = new ParticleData(result.FilePath);
|
|
|
- string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
|
|
|
- userLibrary = new UserLibraryData(str_libraryName);
|
|
|
- if(userLibrary!=null)
|
|
|
- {
|
|
|
- userLibraryData = userLibrary.GetSubAttributeFromDatabase();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- userLibraryData = null;
|
|
|
- }
|
|
|
+ string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
|
|
|
+ userLibrary = new UserLibraryData(str_libraryName);
|
|
|
+ if (userLibrary != null)
|
|
|
+ {
|
|
|
+ userLibraryData = userLibrary.GetSubAttributeFromDatabase();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ userLibraryData = null;
|
|
|
+ }
|
|
|
//初始化底层操作类
|
|
|
m_OTSIncAReportGridsFun = new OTSReportGridsFun(m_ReportApp, this);
|
|
|
return true;
|
|
|
}
|
|
|
- catch(Exception ex)
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
log.Error(ex.ToString());
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
private void ParticlesGridDevidePage_Load(object sender, EventArgs e)
|
|
|
{
|
|
@@ -306,7 +310,7 @@ namespace OTSIncAReportGrids
|
|
|
dtUelect.Columns.Add("Hardness");
|
|
|
dtUelect.Columns.Add("Density");
|
|
|
dtUelect.Columns.Add("Electrical_conductivity");
|
|
|
- for (int i=0;i< selectParticles.Count;i++)
|
|
|
+ for (int i = 0; i < selectParticles.Count; i++)
|
|
|
{
|
|
|
dtUelect.Rows.Add(selectParticles[i].FieldId, selectParticles[i].ParticleId, selectParticles[i].AveGray, selectParticles[i].RectLeft, selectParticles[i].RectTop, selectParticles[i].RectWidth, selectParticles[i].RectHeight, selectParticles[i].Area, selectParticles[i].PosX, selectParticles[i].PosX, selectParticles[i].TypeId, /*selectParticles[i].ElementNum,*/ selectParticles[i].SegmentNum, selectParticles[i].SEMPosX, selectParticles[i].SEMPosY, selectParticles[i].ParticleId, selectParticles[i].DMAX, selectParticles[i].DMIN, selectParticles[i].DPERP, selectParticles[i].PERIMETER, selectParticles[i].ORIENTATION, selectParticles[i].DINSCR, selectParticles[i].DMEAN, selectParticles[i].DELONG, selectParticles[i].DFERET, selectParticles[i].TypeName, selectParticles[i].TypeColor,/* "", */"", "", "", "");
|
|
|
}
|
|
@@ -363,12 +367,12 @@ namespace OTSIncAReportGrids
|
|
|
particlesAll.Columns.Add("Hardness");
|
|
|
particlesAll.Columns.Add("Density");
|
|
|
particlesAll.Columns.Add("Electrical_conductivity");
|
|
|
- if(userLibraryData != null)
|
|
|
+ if (userLibraryData != null)
|
|
|
{
|
|
|
- for(int i=0;i< particlesAll.Rows.Count;i++)
|
|
|
+ for (int i = 0; i < particlesAll.Rows.Count; i++)
|
|
|
{
|
|
|
DataRow[] dr = userLibraryData.Select("STDId=" + particlesAll.Rows[i]["TypeId"].ToString());
|
|
|
- if (dr.Length>0)
|
|
|
+ if (dr.Length > 0)
|
|
|
{
|
|
|
particlesAll.Rows[i]["Hardness"] = dr[0]["Hardness"].ToString();
|
|
|
particlesAll.Rows[i]["Density"] = dr[0]["Density"].ToString();
|
|
@@ -391,10 +395,10 @@ namespace OTSIncAReportGrids
|
|
|
particlesAll.Rows[i]["Electrical_conductivity"] = "";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
btn_Sel.Enabled = true;
|
|
|
}
|
|
|
- if(particlesAll==null)
|
|
|
+ if (particlesAll == null)
|
|
|
{
|
|
|
log.Error("There is an exception in the data of the database!");
|
|
|
#region 加载进度条进度部份结束
|
|
@@ -711,12 +715,13 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- /*int columndid = */dgV_ParticlesDevidePage.Columns.Add(en.Current.Key, en.Current.Value);
|
|
|
+ /*int columndid = */
|
|
|
+ dgV_ParticlesDevidePage.Columns.Add(en.Current.Key, en.Current.Value);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if(PageSize==-1)
|
|
|
+ if (PageSize == -1)
|
|
|
{
|
|
|
PageSize = particlesAll.Rows.Count;
|
|
|
}
|
|
@@ -1151,7 +1156,7 @@ namespace OTSIncAReportGrids
|
|
|
if (m_OTSIncAReportGridsFun.m_SEMConnectionState == true)
|
|
|
{
|
|
|
m_OTSIncAReportGridsFun.MoveSemToPointXY_ForParticlesGrid(sem_point.X, sem_point.Y);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
Thread.Sleep(1500);
|
|
@@ -1359,7 +1364,7 @@ namespace OTSIncAReportGrids
|
|
|
/// <param name="min"></param>
|
|
|
/// <param name="max"></param>
|
|
|
/// <returns></returns>
|
|
|
- bool CompareInput(string min,string max)
|
|
|
+ bool CompareInput(string min, string max)
|
|
|
{
|
|
|
int imax = 0;
|
|
|
int imin = 0;
|
|
@@ -1381,7 +1386,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
dmin = Convert.ToDouble(min);
|
|
|
}
|
|
|
- if(dmin<=dmax)
|
|
|
+ if (dmin <= dmax)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
@@ -1402,7 +1407,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
condition += " and Area" + " > " + tBx_AreaMin.Text;
|
|
|
}
|
|
|
- else if(int.TryParse(tBx_AreaMin.Text, out inum) && inum >= 0)
|
|
|
+ else if (int.TryParse(tBx_AreaMin.Text, out inum) && inum >= 0)
|
|
|
{
|
|
|
condition += " and Area" + " > " + tBx_AreaMin.Text;
|
|
|
}
|
|
@@ -1440,7 +1445,7 @@ namespace OTSIncAReportGrids
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(tbx_DmaxMin.Text))
|
|
|
{
|
|
@@ -1450,7 +1455,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
condition += " and DMAX" + " > " + tbx_DmaxMin.Text;
|
|
|
}
|
|
|
- else if(int.TryParse(tbx_DmaxMin.Text, out inum)&& inum >= 0)
|
|
|
+ else if (int.TryParse(tbx_DmaxMin.Text, out inum) && inum >= 0)
|
|
|
{
|
|
|
condition += " and DMAX" + " > " + tbx_DmaxMin.Text;
|
|
|
}
|
|
@@ -1469,7 +1474,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
condition += " and DMAX" + "<" + tbx_DmaxMax.Text;
|
|
|
}
|
|
|
- else if(int.TryParse(tbx_DmaxMax.Text, out inum)&& inum >= 0)
|
|
|
+ else if (int.TryParse(tbx_DmaxMax.Text, out inum) && inum >= 0)
|
|
|
{
|
|
|
condition += " and DMAX" + "<" + tbx_DmaxMax.Text;
|
|
|
}
|
|
@@ -1616,7 +1621,7 @@ namespace OTSIncAReportGrids
|
|
|
lnkNext.Enabled = false;
|
|
|
lnkLast.Enabled = false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
private void SetFormCtrEnabled()
|
|
|
{
|
|
@@ -1692,16 +1697,16 @@ namespace OTSIncAReportGrids
|
|
|
/// <summary>
|
|
|
/// 在帧图上标记颗粒的位置矩形,并保存到FIELD_FILES_MARK文件夹中
|
|
|
/// </summary>
|
|
|
- public void SaveMarkParticleRectangleOnFieldFile(string str_resultPath, DataTable dataTable ,out List<string> vs , out DataTable dt_FIeld)
|
|
|
+ public void SaveMarkParticleRectangleOnFieldFile(string str_resultPath, DataTable dataTable, out List<string> vs, out DataTable dt_FIeld)
|
|
|
{
|
|
|
Init();
|
|
|
|
|
|
List<string> maxlength = new List<string>();
|
|
|
- for (int i=0;i< dataTable.Rows.Count;i++)
|
|
|
+ for (int i = 0; i < dataTable.Rows.Count; i++)
|
|
|
{
|
|
|
- if (dataTable.Rows[i]["TypeName"].ToString()!= "Not Identified")
|
|
|
+ if (dataTable.Rows[i]["TypeName"].ToString() != "Not Identified")
|
|
|
{
|
|
|
- if (maxlength.Count<10)
|
|
|
+ if (maxlength.Count < 10)
|
|
|
{
|
|
|
maxlength.Add(dataTable.Rows[i]["Fieldid"].ToString());
|
|
|
}
|
|
@@ -1746,7 +1751,7 @@ namespace OTSIncAReportGrids
|
|
|
dt.Columns.Add("fieldid");
|
|
|
dt.Columns.Add("id");
|
|
|
dt.Columns.Add("fieldName");
|
|
|
- dt.Columns.Add("cunt",typeof(int));
|
|
|
+ dt.Columns.Add("cunt", typeof(int));
|
|
|
dt.Columns.Add("fieldFullName");
|
|
|
for (int i = 0; i < max_list.Count; i++)
|
|
|
{
|
|
@@ -1782,7 +1787,7 @@ namespace OTSIncAReportGrids
|
|
|
//dv.Sort = "cunt DESC";
|
|
|
dt_FIeld = dt.Copy();
|
|
|
|
|
|
- for (int i=0;i< dt_FIeld.Rows.Count; i++)
|
|
|
+ for (int i = 0; i < dt_FIeld.Rows.Count; i++)
|
|
|
{
|
|
|
if (dataTable.Select(dt_FIeld.Rows[i]["fieldid"].ToString()).Count() > 0)
|
|
|
{
|
|
@@ -1802,7 +1807,7 @@ namespace OTSIncAReportGrids
|
|
|
img.Dispose();
|
|
|
img = null;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//循环将颗粒,进行标记到bitmap图上
|
|
|
DataRow[] drlist = dt_AllParticle.Select(dt_FIeld.Rows[i]["fieldid"].ToString());
|
|
|
if (drlist.Count() > 0)
|
|
@@ -1831,7 +1836,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
ls_offsetx = offset_rect.X - 10;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
g.DrawString(dt_FIeld.Rows[i]["id"].ToString() + "" + str_particleid.ToString(),
|
|
|
new Font("黑体", 8), new SolidBrush(Color.Aqua), new PointF(ls_offsetx, offset_rect.Y));
|
|
|
|
|
@@ -1952,7 +1957,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
//非图像列
|
|
|
double dbl = 0;
|
|
|
- if(double.TryParse(dgV_ParticlesDevidePage[i_cell, i_row].Value.ToString(),out dbl))
|
|
|
+ if (double.TryParse(dgV_ParticlesDevidePage[i_cell, i_row].Value.ToString(), out dbl))
|
|
|
{
|
|
|
cell.SetCellValue(dbl);
|
|
|
}
|
|
@@ -2046,7 +2051,7 @@ namespace OTSIncAReportGrids
|
|
|
//打开刚才导出的文件
|
|
|
System.Diagnostics.Process.Start(sfd.FileName);
|
|
|
}
|
|
|
- Cursor = Cursors.Default ;
|
|
|
+ Cursor = Cursors.Default;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2101,7 +2106,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
private void ToolStripMenuItem_Delete_Particle_Click(object sender, EventArgs e)
|
|
|
{
|
|
@@ -2109,7 +2114,7 @@ namespace OTSIncAReportGrids
|
|
|
ParticleData fielddata = new ParticleData(result.FilePath);
|
|
|
List<Particle> particles = fielddata.GetParticleAllList();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
DialogResult dr = MessageBox.Show("Remove all these particles permanently?", "Tips", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
|
|
if (dr == DialogResult.OK)
|
|
@@ -2131,7 +2136,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
if (DeleteParticlesFromLibrary(item.ParticleId, item.FieldId))
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
|
|
|
for (int i = 0; i < particlesAll.Rows.Count; i++)
|
|
|
{
|
|
@@ -2141,7 +2146,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2238,7 +2243,7 @@ namespace OTSIncAReportGrids
|
|
|
lnkFirst_Click(null, null);
|
|
|
SetDataGridViewStyle();
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
string ChangeHardnessColor(string Hardness)
|
|
|
{
|
|
@@ -2422,7 +2427,7 @@ namespace OTSIncAReportGrids
|
|
|
try
|
|
|
{
|
|
|
string arguments = openFileDialog.FileName;
|
|
|
- var SelectRows= dgV_ParticlesDevidePage.SelectedRows;
|
|
|
+ var SelectRows = dgV_ParticlesDevidePage.SelectedRows;
|
|
|
DataGridViewRow dgvr = SelectRows[0];
|
|
|
Bitmap ls_bp = (Bitmap)dgvr.Cells[2].Value;
|
|
|
List<string> list_str = (List<string>)ls_bp.Tag;
|
|
@@ -2475,6 +2480,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
|
|
|
|