|
@@ -57,6 +57,10 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
OTSImageDisHelp m_ReportFun = null;
|
|
|
private OTSImageDisHelp ReportFun { get => m_ReportFun; set => m_ReportFun = value; }
|
|
|
+ /// <summary>
|
|
|
+ /// 选择颗粒缓存表
|
|
|
+ /// </summary>
|
|
|
+ List<Particle> Particleslist_selecttodisplay = new List<Particle>();
|
|
|
|
|
|
//多个数据源,每个数据源拥有的列数,这里保存下来,供分组使用
|
|
|
public List<int> m_list_oneresult_columncount;
|
|
@@ -77,7 +81,6 @@ namespace OTSIncAReportGrids
|
|
|
enum SelItem
|
|
|
{
|
|
|
analyticalParticle = 0,
|
|
|
- selectParticles = 1,
|
|
|
otherParticles = 2,
|
|
|
MergeParticles = 3,
|
|
|
allParticles=4
|
|
@@ -261,150 +264,70 @@ namespace OTSIncAReportGrids
|
|
|
bool UpdateTable()
|
|
|
{
|
|
|
int sel = m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.PARTICE_LIST);
|
|
|
- if (sel == (int)SelItem.selectParticles)
|
|
|
- {
|
|
|
- List<Particle> selectParticles = m_ReportApp.GetSelectedParticles();
|
|
|
- DataTable dtUelect = new DataTable();
|
|
|
- dtUelect.Columns.Add("fieldid");
|
|
|
- dtUelect.Columns.Add("particleid");
|
|
|
- dtUelect.Columns.Add("AveGray");
|
|
|
- dtUelect.Columns.Add("RectLeft");
|
|
|
- dtUelect.Columns.Add("RectTop");
|
|
|
- dtUelect.Columns.Add("RectWidth");
|
|
|
- dtUelect.Columns.Add("RectHeight");
|
|
|
- dtUelect.Columns.Add("Area");
|
|
|
- dtUelect.Columns.Add("PosX");
|
|
|
- dtUelect.Columns.Add("PosY");
|
|
|
- dtUelect.Columns.Add("TypeId");
|
|
|
- //dtUelect.Columns.Add("ElementNum");
|
|
|
- dtUelect.Columns.Add("SegmentNum");
|
|
|
- dtUelect.Columns.Add("SEMPosX");
|
|
|
- dtUelect.Columns.Add("SEMPosY");
|
|
|
- dtUelect.Columns.Add("XrayId");
|
|
|
- dtUelect.Columns.Add("DMAX");
|
|
|
- dtUelect.Columns.Add("DMIN");
|
|
|
- dtUelect.Columns.Add("DPERP");
|
|
|
- dtUelect.Columns.Add("PERIMETER");
|
|
|
- dtUelect.Columns.Add("ORIENTATION");
|
|
|
- dtUelect.Columns.Add("DINSCR");
|
|
|
- dtUelect.Columns.Add("DMEAN");
|
|
|
- dtUelect.Columns.Add("DELONG");
|
|
|
- dtUelect.Columns.Add("DFERET");
|
|
|
- dtUelect.Columns.Add("TypeName");
|
|
|
- dtUelect.Columns.Add("TypeColor");
|
|
|
- //dtUelect.Columns.Add("SubParticles");
|
|
|
- dtUelect.Columns.Add("Element");
|
|
|
- dtUelect.Columns.Add("Hardness");
|
|
|
- dtUelect.Columns.Add("Density");
|
|
|
- dtUelect.Columns.Add("Electrical_conductivity");
|
|
|
- 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,/* "", */"", "", "", "");
|
|
|
- }
|
|
|
- if (userLibraryData != null)
|
|
|
- {
|
|
|
- for (int i = 0; i < dtUelect.Rows.Count; i++)
|
|
|
- {
|
|
|
- DataRow[] dr = userLibraryData.Select("STDId=" + dtUelect.Rows[i]["TypeId"].ToString());
|
|
|
- if (dr.Length > 0)
|
|
|
- {
|
|
|
- dtUelect.Rows[i]["Hardness"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Hardness"].ToString(), @"[^\d.\d]", "");
|
|
|
- dtUelect.Rows[i]["Density"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Density"].ToString(), @"[^\d.\d]", "");
|
|
|
- dtUelect.Rows[i]["Electrical_conductivity"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Electrical_conductivity"].ToString(), @"[^\d.\d]", "");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dtUelect.Rows[i]["Hardness"] = "";
|
|
|
- dtUelect.Rows[i]["Density"] = "";
|
|
|
- dtUelect.Rows[i]["Electrical_conductivity"] = "";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+
|
|
|
+ //多次测试发现 读取数据库时间耗时长,但读取条数目对读取数据库时长影响不大,故此处直接读取所有数据库信息,以取代多次连接数据库方式,优化分页速度
|
|
|
+ particlesAll = new DataTable();
|
|
|
+ if (sel == (int)SelItem.analyticalParticle)
|
|
|
+ {
|
|
|
+ //particlesAll = Particledata.GetInfoForPartucleDevidePage2(condition);
|
|
|
+ particlesAll = Particledata.GetInfoForPartucleDevidePage_analyticalParticle(condition);
|
|
|
+ DataTable mergeParticles = Particledata.GetInfoForPartucleDevidePage_mergeParticles(condition);
|
|
|
+ if (mergeParticles != null && mergeParticles.Rows.Count > 0)
|
|
|
{
|
|
|
- for (int i = 0; i < dtUelect.Rows.Count; i++)
|
|
|
- {
|
|
|
- dtUelect.Rows[i]["Hardness"] = "";
|
|
|
- dtUelect.Rows[i]["Density"] = "";
|
|
|
- dtUelect.Rows[i]["Electrical_conductivity"] = "";
|
|
|
- }
|
|
|
+ RemoveMergeParticles(ref particlesAll, mergeParticles);
|
|
|
}
|
|
|
- particlesAll = new DataTable();
|
|
|
- particlesAll = dtUelect.Copy();
|
|
|
- btn_Sel.Enabled = false;
|
|
|
- ToolStripMenuItem_Removeparticlesfromtheselectparticleslist.Visible = false;
|
|
|
- ToolStripMenuItem_Addparticlestotheselectparticleslist.Visible = false;
|
|
|
}
|
|
|
- else
|
|
|
+ if (sel == (int)SelItem.otherParticles)
|
|
|
{
|
|
|
- //多次测试发现 读取数据库时间耗时长,但读取条数目对读取数据库时长影响不大,故此处直接读取所有数据库信息,以取代多次连接数据库方式,优化分页速度
|
|
|
- particlesAll = new DataTable();
|
|
|
- if (sel == (int)SelItem.analyticalParticle)
|
|
|
- {
|
|
|
- //particlesAll = Particledata.GetInfoForPartucleDevidePage2(condition);
|
|
|
- particlesAll = Particledata.GetInfoForPartucleDevidePage_analyticalParticle(condition);
|
|
|
- DataTable mergeParticles = Particledata.GetInfoForPartucleDevidePage_mergeParticles(condition);
|
|
|
- if(mergeParticles!=null&& mergeParticles.Rows.Count>0)
|
|
|
- {
|
|
|
- RemoveMergeParticles(ref particlesAll, mergeParticles);
|
|
|
- }
|
|
|
- ToolStripMenuItem_Addparticlestotheselectparticleslist.Visible = true;
|
|
|
- }
|
|
|
- if (sel == (int)SelItem.otherParticles)
|
|
|
- {
|
|
|
- particlesAll = Particledata.GetInfoForPartucleDevidePage_otherParticle(condition);
|
|
|
- DataTable mergeParticles = Particledata.GetInfoForPartucleDevidePage_mergeParticles(condition);
|
|
|
- if (mergeParticles != null && mergeParticles.Rows.Count > 0)
|
|
|
- {
|
|
|
- RemoveMergeParticles(ref particlesAll, mergeParticles);
|
|
|
- }
|
|
|
- ToolStripMenuItem_Addparticlestotheselectparticleslist.Visible = false;
|
|
|
- }
|
|
|
- if (sel == (int)SelItem.MergeParticles)
|
|
|
- {
|
|
|
- particlesAll = Particledata.GetInfoForPartucleDevidePage_mergeParticles(condition);
|
|
|
- ToolStripMenuItem_Addparticlestotheselectparticleslist.Visible = false;
|
|
|
- }
|
|
|
- if (sel == (int)SelItem.allParticles)
|
|
|
+ particlesAll = Particledata.GetInfoForPartucleDevidePage_otherParticle(condition);
|
|
|
+ DataTable mergeParticles = Particledata.GetInfoForPartucleDevidePage_mergeParticles(condition);
|
|
|
+ if (mergeParticles != null && mergeParticles.Rows.Count > 0)
|
|
|
{
|
|
|
- particlesAll = Particledata.GetInfoForPartucleDevidePage_allParticles(condition);
|
|
|
- ToolStripMenuItem_Addparticlestotheselectparticleslist.Visible = false;
|
|
|
+ RemoveMergeParticles(ref particlesAll, mergeParticles);
|
|
|
}
|
|
|
- particlesAll.Columns.Add("Hardness");
|
|
|
- particlesAll.Columns.Add("Density");
|
|
|
- particlesAll.Columns.Add("Electrical_conductivity");
|
|
|
- if (userLibraryData != null)
|
|
|
+ }
|
|
|
+ if (sel == (int)SelItem.MergeParticles)
|
|
|
+ {
|
|
|
+ particlesAll = Particledata.GetInfoForPartucleDevidePage_mergeParticles(condition);
|
|
|
+ }
|
|
|
+ if (sel == (int)SelItem.allParticles)
|
|
|
+ {
|
|
|
+ particlesAll = Particledata.GetInfoForPartucleDevidePage_allParticles(condition);
|
|
|
+ }
|
|
|
+ particlesAll.Columns.Add("Hardness");
|
|
|
+ particlesAll.Columns.Add("Density");
|
|
|
+ particlesAll.Columns.Add("Electrical_conductivity");
|
|
|
+ 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)
|
|
|
{
|
|
|
- DataRow[] dr = userLibraryData.Select("STDId=" + particlesAll.Rows[i]["TypeId"].ToString());
|
|
|
- if (dr.Length > 0)
|
|
|
- {
|
|
|
- particlesAll.Rows[i]["Hardness"] = dr[0]["Hardness"].ToString();
|
|
|
- particlesAll.Rows[i]["Density"] = dr[0]["Density"].ToString();
|
|
|
- particlesAll.Rows[i]["Electrical_conductivity"] = dr[0]["Electrical_conductivity"].ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- particlesAll.Rows[i]["Hardness"] = "";
|
|
|
- particlesAll.Rows[i]["Density"] = "";
|
|
|
- particlesAll.Rows[i]["Electrical_conductivity"] = "";
|
|
|
- }
|
|
|
+ particlesAll.Rows[i]["Hardness"] = dr[0]["Hardness"].ToString();
|
|
|
+ particlesAll.Rows[i]["Density"] = dr[0]["Density"].ToString();
|
|
|
+ particlesAll.Rows[i]["Electrical_conductivity"] = dr[0]["Electrical_conductivity"].ToString();
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- for (int i = 0; i < particlesAll.Rows.Count; i++)
|
|
|
+ else
|
|
|
{
|
|
|
particlesAll.Rows[i]["Hardness"] = "";
|
|
|
particlesAll.Rows[i]["Density"] = "";
|
|
|
particlesAll.Rows[i]["Electrical_conductivity"] = "";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- btn_Sel.Enabled = true;
|
|
|
- ToolStripMenuItem_Removeparticlesfromtheselectparticleslist.Visible = false;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 0; i < particlesAll.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ particlesAll.Rows[i]["Hardness"] = "";
|
|
|
+ particlesAll.Rows[i]["Density"] = "";
|
|
|
+ particlesAll.Rows[i]["Electrical_conductivity"] = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ btn_Sel.Enabled = true;
|
|
|
+
|
|
|
if (particlesAll == null)
|
|
|
{
|
|
|
log.Error("There is an exception in the data of the database!");
|
|
@@ -2571,17 +2494,9 @@ namespace OTSIncAReportGrids
|
|
|
ToolStripMenuItemDelete_Particle.Visible = false;
|
|
|
}
|
|
|
}
|
|
|
- if(m_ReportApp.im_Control_DrawDistrbutionImageAndBSE==null)
|
|
|
- {
|
|
|
- //ToolStripMenuItemDelete_Particle.Enabled = false;
|
|
|
- ToolStripMenuItem_Addparticlestotheselectparticleslist.Visible = false;
|
|
|
- ToolStripMenuItem_Removeparticlesfromtheselectparticleslist.Visible = false;
|
|
|
- }
|
|
|
- else
|
|
|
+ if(SelectRows!=null)
|
|
|
{
|
|
|
- //ToolStripMenuItemDelete_Particle.Enabled = true;
|
|
|
- ToolStripMenuItem_Addparticlestotheselectparticleslist.Visible = false;
|
|
|
- ToolStripMenuItem_Removeparticlesfromtheselectparticleslist.Visible = false;
|
|
|
+ SaveParticleslist_select();
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -2636,45 +2551,14 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ToolStripMenuItem_Addparticlestotheselectparticleslist_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- string path = result.FilePath;
|
|
|
- ParticleData fielddata = new ParticleData(result.FilePath);
|
|
|
- List<Particle> particles = fielddata.GetParticleAllList();
|
|
|
|
|
|
- List<Particle> ls_list_cotsparticleclr = new List<Particle>();
|
|
|
- for (int l = 0; l < dgV_ParticlesDevidePage.SelectedRows.Count; l++)
|
|
|
- {
|
|
|
- //从事先加载的Bitmap对象的Tag中取出List<string>
|
|
|
- DataGridViewRow dgvr = dgV_ParticlesDevidePage.SelectedRows[l];
|
|
|
- Bitmap ls_bp = (Bitmap)dgvr.Cells[2].Value;
|
|
|
- List<string> list_str = (List<string>)ls_bp.Tag;
|
|
|
- if (list_str != null)
|
|
|
- {
|
|
|
- int i_ls_fieldid = Convert.ToInt32(list_str[0]);
|
|
|
- int i_ls_particleid = Convert.ToInt32(list_str[1]);
|
|
|
- foreach (Particle item in particles)
|
|
|
- {
|
|
|
- if (i_ls_fieldid == item.FieldId && i_ls_particleid == item.ParticleId)
|
|
|
- {
|
|
|
- ls_list_cotsparticleclr.Add(item);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- m_ReportApp.AddParticlesToSelectedParticles(ls_list_cotsparticleclr);
|
|
|
- }
|
|
|
-
|
|
|
- private void ToolStripMenuItem_Removeparticlesfromtheselectparticleslist_Click(object sender, EventArgs e)
|
|
|
+ private void SaveParticleslist_select()
|
|
|
{
|
|
|
- string path = result.FilePath;
|
|
|
ParticleData fielddata = new ParticleData(result.FilePath);
|
|
|
List<Particle> particles = fielddata.GetParticleAllList();
|
|
|
|
|
|
- List<Particle> ls_list_cotsparticleclr = new List<Particle>();
|
|
|
- for (int l = 0; l < dgV_ParticlesDevidePage.SelectedRows.Count; l++)
|
|
|
+ List<Particle> Particleslist_selecttodisplay = new List<Particle>();
|
|
|
+ for (int l = 0; l < 1; l++)
|
|
|
{
|
|
|
//从事先加载的Bitmap对象的Tag中取出List<string>
|
|
|
DataGridViewRow dgvr = dgV_ParticlesDevidePage.SelectedRows[l];
|
|
@@ -2688,18 +2572,13 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
if (i_ls_fieldid == item.FieldId && i_ls_particleid == item.ParticleId)
|
|
|
{
|
|
|
- ls_list_cotsparticleclr.Add(item);
|
|
|
+ Particleslist_selecttodisplay.Add(item);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- m_ReportApp.DeleteParticlesFromSelectedParticles(ls_list_cotsparticleclr);
|
|
|
- foreach (DataGridViewRow Row in dgV_ParticlesDevidePage.SelectedRows)
|
|
|
- {
|
|
|
- dgV_ParticlesDevidePage.Rows.Remove(Row);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|