|
@@ -162,26 +162,36 @@ namespace OTSIncAReportGrids
|
|
|
#endregion
|
|
|
|
|
|
frmReportApp m_ReportApp;
|
|
|
- ResultFile resultFile = null;
|
|
|
+ //ResultFile resultFile = null;
|
|
|
#endregion
|
|
|
|
|
|
public ParticlesGridDevidePage(frmReportApp ReportApp)
|
|
|
{
|
|
|
m_ReportApp = ReportApp;
|
|
|
m_condition = ReportApp.m_conditionChoose;
|
|
|
- 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();
|
|
|
if (sou.Contains("+"))
|
|
|
{
|
|
|
MessageBox.Show("This function does not support multiple samples!");
|
|
|
+
|
|
|
+ //m_ReportApp.m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.IMAGE_DISPLAY_TYPE].itemVal = (int)IMAGE_DISPLAY_TYPE.DISTRIBUTION;
|
|
|
+ //var rstlist = m_conditionData.GetComboDownListByItemName(OTS_REPORT_PROP_GRID_ITEMS.IMAGE_DISPLAY_TYPE);
|
|
|
+ //prop.SetPropByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.IMAGE_DISPLAY_TYPE, rstlist[(int)IMAGE_DISPLAY_TYPE.DISTRIBUTION]);
|
|
|
+ //m_ReportApp.MoreSource = "";
|
|
|
+ //m_condition.SetDefaultConditionValue();
|
|
|
+ //m_condition.DisCurrentPicProperty();
|
|
|
+
|
|
|
result = m_ReportApp.m_rstDataMgr.ResultFilesList[0];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE)];
|
|
|
}
|
|
|
+ ReportFun = new OTSImageDisHelp(result);
|
|
|
|
|
|
|
|
|
//设置窗体的双缓冲,以保证大数据时拖动不卡
|
|
@@ -229,6 +239,8 @@ namespace OTSIncAReportGrids
|
|
|
//m_frm_userprogress = new Frm_UserProgress();
|
|
|
fieldData = new FieldData(result.FilePath);
|
|
|
Particledata = new ParticleData(result.FilePath);
|
|
|
+ //List<Field> fieldlist = fieldData.GetFieldList();
|
|
|
+ //m_ReportApp.m_rstDataMgr.CurResultFile.List_OTSField = fieldlist;
|
|
|
var systype = m_ReportApp.m_RptConfigFile.Systype;
|
|
|
if (systype == OTSCommon.Model.OTS_SysType_ID.CleannessA)
|
|
|
{
|
|
@@ -380,21 +392,27 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
if (int.Parse(particlesAll.Rows[i]["particleId"].ToString()) > -1)
|
|
|
{
|
|
|
+
|
|
|
+ particlesAll.Rows[i]["XRayDataCount"] = 0;
|
|
|
+
|
|
|
string str = " XrayIndex= " + particlesAll.Rows[i]["particleId"].ToString() + " and fieldid = " + particlesAll.Rows[i]["fieldid"].ToString();
|
|
|
DataRow[] drs = XRayData.Select(str);
|
|
|
uint xraycount = 0;
|
|
|
if (drs != null)
|
|
|
{
|
|
|
- uint[] Analysis_xray = new uint[2000];
|
|
|
- for (int j = 0; j < 2000; j++)
|
|
|
- {
|
|
|
- Analysis_xray[j] = BitConverter.ToUInt32((byte[])drs[0][2], j * 4);
|
|
|
- }
|
|
|
- for (int j = 0; j < 2000; j++)
|
|
|
+ if (drs.Length > 0)
|
|
|
{
|
|
|
- xraycount += Analysis_xray[j];
|
|
|
+ uint[] Analysis_xray = new uint[2000];
|
|
|
+ for (int j = 0; j < 2000; j++)
|
|
|
+ {
|
|
|
+ Analysis_xray[j] = BitConverter.ToUInt32((byte[])drs[0][2], j * 4);
|
|
|
+ }
|
|
|
+ for (int j = 0; j < 2000; j++)
|
|
|
+ {
|
|
|
+ xraycount += Analysis_xray[j];
|
|
|
+ }
|
|
|
+ particlesAll.Rows[i]["XRayDataCount"] = xraycount;
|
|
|
}
|
|
|
- particlesAll.Rows[i]["XRayDataCount"] = xraycount;
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -892,7 +910,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
if (enl.Current.Key == "AbPosX")
|
|
|
{
|
|
|
- Point point = CalculateParticleCenterPosition(resultFile, new Point(Convert.ToInt32(particles.Rows[i]["SEMPosX"]), Convert.ToInt32(particles.Rows[i]["SEMPosY"])), new Point(Convert.ToInt32(particles.Rows[i]["PosX"]), Convert.ToInt32(particles.Rows[i]["PosY"])));
|
|
|
+ Point point = CalculateParticleCenterPosition(result, new Point(Convert.ToInt32(particles.Rows[i]["SEMPosX"]), Convert.ToInt32(particles.Rows[i]["SEMPosY"])), new Point(Convert.ToInt32(particles.Rows[i]["PosX"]), Convert.ToInt32(particles.Rows[i]["PosY"])));
|
|
|
dgV_ParticlesDevidePage.Rows[add_rowindex].Cells["AbPosX"].Value = point.X;
|
|
|
dgV_ParticlesDevidePage.Rows[add_rowindex].Cells["AbPosY"].Value = point.Y;
|
|
|
}
|
|
@@ -1261,7 +1279,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
|
|
|
}
|
|
|
- Point point = CalculateParticleCenterPosition(resultFile, new Point(particle.SEMPosX, particle.SEMPosY), new Point(particle.PosX, particle.PosY));
|
|
|
+ Point point = CalculateParticleCenterPosition(result, new Point(particle.SEMPosX, particle.SEMPosY), new Point(particle.PosX, particle.PosY));
|
|
|
//改为线程调用,先判断线程状态
|
|
|
m_mythread.Start(point);
|
|
|
|
|
@@ -2169,7 +2187,7 @@ namespace OTSIncAReportGrids
|
|
|
bool DoesItExist = false;
|
|
|
for (int i = 1; i < 201; i++)
|
|
|
{
|
|
|
- if (System.IO.Directory.Exists(resultFile.FilePath + "\\FIELD_FILES\\Backups" + i.ToString()))
|
|
|
+ if (System.IO.Directory.Exists(result.FilePath + "\\FIELD_FILES\\Backups" + i.ToString()))
|
|
|
{
|
|
|
DoesItExist = true;
|
|
|
break;
|
|
@@ -2183,10 +2201,10 @@ namespace OTSIncAReportGrids
|
|
|
DoesItExist = false;
|
|
|
|
|
|
//防止为空校验判断
|
|
|
- if (resultFile.List_OTSField == null)
|
|
|
+ if (result.List_OTSField == null)
|
|
|
return false;
|
|
|
- Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == in_clr_fieldid).ParticleList.Find(x => x.ParticleId == in_clr_tagid);
|
|
|
- if (new ParticleData(resultFile.FilePath).DeleteFromData(Convert.ToString(particle.FieldId), Convert.ToString(particle.XrayId)))
|
|
|
+ Particle particle = result.List_OTSField.Find(x => x.FieldID == in_clr_fieldid).ParticleList.Find(x => x.ParticleId == in_clr_tagid);
|
|
|
+ if (new ParticleData(result.FilePath).DeleteFromData(Convert.ToString(particle.FieldId), Convert.ToString(particle.XrayId)))
|
|
|
{
|
|
|
|
|
|
return true;
|
|
@@ -2200,9 +2218,9 @@ namespace OTSIncAReportGrids
|
|
|
private bool BackupDatabase()
|
|
|
{
|
|
|
//创建备份数据库文件夹
|
|
|
- string sourcePath = resultFile.FilePath + "\\FIELD_FILES\\Inclusion.db";//源文件路径
|
|
|
+ string sourcePath = result.FilePath + "\\FIELD_FILES\\Inclusion.db";//源文件路径
|
|
|
string sourceName = "Inclusion.db";//源文件名称
|
|
|
- string folderPath = resultFile.FilePath + "\\FIELD_FILES\\Backups";//目标文件夹
|
|
|
+ string folderPath = result.FilePath + "\\FIELD_FILES\\Backups";//目标文件夹
|
|
|
string Fields = "";
|
|
|
for (int i = 1; i < 201; i++)
|
|
|
{
|
|
@@ -2698,7 +2716,7 @@ namespace OTSIncAReportGrids
|
|
|
list_showelementinfo.Sort((p1, p2) => p2.Percentage.CompareTo(p1.Percentage));
|
|
|
string str_IncAName = "";
|
|
|
str_IncAName = Convert.ToString(dgvr.Cells[1].Value);
|
|
|
- Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == Convert.ToInt32(dgvr.Cells["fieldid"].Value)).ParticleList.Find(x => x.ParticleId == Convert.ToInt32(dgvr.Cells["particleId"].Value));
|
|
|
+ Particle particle = result.List_OTSField.Find(x => x.FieldID == Convert.ToInt32(dgvr.Cells["fieldid"].Value)).ParticleList.Find(x => x.ParticleId == Convert.ToInt32(dgvr.Cells["particleId"].Value));
|
|
|
if (particle == null)
|
|
|
{
|
|
|
return;
|
|
@@ -2714,16 +2732,16 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
|
|
|
|
|
|
-
|
|
|
- string filePath = result.FilePath + "\\FIELD_FILES\\";
|
|
|
- string imagePath = filePath + "Field" + dgvr.Cells["fieldid"].Value.ToString() + ".bmp";
|
|
|
- Bitmap originalFieldImage=Particledata.ReadImageFile(imagePath);
|
|
|
string str = " particleId= " + dgvr.Cells["particleId"].Value.ToString() + " and fieldid = " + dgvr.Cells["fieldid"].Value.ToString();
|
|
|
DataRow[] drs = particles.Select(str);
|
|
|
if (drs.Length > 0)
|
|
|
{
|
|
|
- Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(drs[0]["RectLeft"]), Y = Convert.ToInt32(drs[0]["RectTop"]), Width = Convert.ToInt32(drs[0]["RectWidth"]), Height = Convert.ToInt32(drs[0]["RectHeight"]) };
|
|
|
- Bitmap dpImage = new Bitmap(originalFieldImage.Width, originalFieldImage.Height);
|
|
|
+ Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(particle.RectLeft), Y = Convert.ToInt32(particle.RectTop), Width = Convert.ToInt32(particle.RectWidth), Height = Convert.ToInt32(particle.RectHeight) };
|
|
|
+ Bitmap dpImage = new Bitmap(result.GetImageWidth(), result.GetImageHeight());
|
|
|
+ using (Graphics graphics = Graphics.FromImage(dpImage))
|
|
|
+ {
|
|
|
+ graphics.Clear(Color.White); // 清除位图背景为白色
|
|
|
+ }
|
|
|
foreach (Segment seg in particle.SegmentList)
|
|
|
{
|
|
|
int f_length = seg.Length;
|
|
@@ -2731,38 +2749,11 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
int lsjs_x = seg.Start + m;
|
|
|
int lsjs_y = seg.Height;
|
|
|
- var pixelColor = originalFieldImage.GetPixel(lsjs_x, lsjs_y);
|
|
|
- dpImage.SetPixel(lsjs_x, lsjs_y, pixelColor);
|
|
|
+ dpImage.SetPixel(lsjs_x, lsjs_y, Color.Black);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
Bitmap bmap = Particledata.GetBitmapByParticle(dpImage, rectangle);
|
|
|
- Bitmap binarizedBmp = new Bitmap(bmap.Width, bmap.Height);
|
|
|
- for (int x = 0; x < bmap.Width; x++)
|
|
|
- {
|
|
|
- for (int y = 0; y < bmap.Height; y++)
|
|
|
- {
|
|
|
- Color color = bmap.GetPixel(x, y);
|
|
|
- if (color.A == 255&&color.B==0 && color.G == 0 && color.R == 0)
|
|
|
- {
|
|
|
- binarizedBmp.SetPixel(x, y, Color.White);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- int grayValue = (color.R + color.G + color.B) / 3;
|
|
|
- if(grayValue>0)
|
|
|
- {
|
|
|
- binarizedBmp.SetPixel(x, y, Color.Black);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- binarizedBmp.SetPixel(x, y, Color.White);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- control_XRayTable1.SetBitmapOfPictureBox(ls_bp, binarizedBmp);
|
|
|
+ control_XRayTable1.SetBitmapOfPictureBox(ls_bp, bmap);
|
|
|
Invalidate();
|
|
|
}
|
|
|
else
|