Browse Source

Merge branch 'Release2.3' of http://36.129.163.148:10080/gaoshipeng/OTS2_0 into Release2.3

CXS 3 years ago
parent
commit
9e51ac7668

+ 4 - 4
Bin/x64/Debug/Config/ProData/ReportTemplateConfig.xml

@@ -1,17 +1,17 @@
 <XmlConfig>
   <M_SY>
-    <str_tb_ZBT>Inclusion Analysis </str_tb_ZBT>
-    <str_tb_FBT>马鞍山钢铁股份有限公司</str_tb_FBT>
+    <str_tb_ZBT>Cleanliness Analysis</str_tb_ZBT>
+    <str_tb_FBT>欧波同中国</str_tb_FBT>
     <str_tb_YPBH>0001</str_tb_YPBH>
     <str_tb_CKBZ>GB/T30834-2014</str_tb_CKBZ>
     <b_ck_ypsm>True</b_ck_ypsm>
     <b_ck_jggk>True</b_ck_jggk>
   </M_SY>
   <M_YMYJ>
-    <str_tb_ymwb>夹杂物分析报告</str_tb_ymwb>
+    <str_tb_ymwb>颗粒分析报告</str_tb_ymwb>
     <str_tb_KHH>Copi0000123012</str_tb_KHH>
     <b_ck_ym>True</b_ck_ym>
-    <str_tb_yjwb>夹杂物分析报告</str_tb_yjwb>
+    <str_tb_yjwb>颗粒分析报告</str_tb_yjwb>
   </M_YMYJ>
   <M_KLFXJG>
     <b_ck_klcc_xsmk>True</b_ck_klcc_xsmk>

+ 2 - 1
Bin/x64/Debug/Resources/XMLData/AppResource_ZH.xml

@@ -836,7 +836,8 @@
           <Control name="ToolStripMenuItem_delete" text="排除这些颗粒" />
 	  <Control name="另存选择颗粒ToolStripMenuItem" text="另存为" />
 	  <Control name="ToolStripMenuItem_movesempoint" text="移动SEM到当前位置" />
-	  <Control name="toolStripMenuItem_copyimage" text="复制图像" />
+	  <Control name="toolStripMenuItem_copyimage" text="导出原图拼接图" />
+	  <control name="ExportoriginalspliceToolStripMenuItem" text="导出原图拼接分类图"/>
 	  <Control name="str1" text="开始加载分布图信息" />
 	  <Control name="str2" text="已完成加载" />
 	  <Control name="str3" text="SEM位置:" />

+ 5 - 10
OTSCPP/OTSClrInterface/ControlClr/OTSControlFunExport.cpp

@@ -488,7 +488,6 @@ namespace OTSCLRINTERFACE
 		m_pEDS->SetQuantification(TRUE);
 
 		bool bRet = m_pEDS->GetXRayByPoints(listXRayPoints, a_nMilliseconds);
-		//bool bRet = m_LpEDSBase->GetXRayByFeaturesFromMultiPoint(listXRayPoints, listFeatures, a_nMilliseconds);
 
 		DWORD* xrd;
 
@@ -533,7 +532,6 @@ namespace OTSCLRINTERFACE
 		m_pEDS->SetQuantification(FALSE);
 
 		bool bRet = m_pEDS->GetXRayByPoints(listXRayPoints, a_nMilliseconds);
-		//bool bRet = m_LpEDSBase->GetXRayByFeaturesFromMultiPoint(listXRayPoints, listFeatures, a_nMilliseconds);
 
 		std::vector<CPosXrayPtr> listXRayPointsTemp;
 		CPosXrayPtr pXRayPointTemp = CPosXrayPtr(new CPosXray());
@@ -587,7 +585,10 @@ namespace OTSCLRINTERFACE
 		CBSEImgPtr pbseImg = nullptr;
 
 		pbseImg = m_pScan->AcquireBSEImage(a_nMatrixIndex, nReads, nDwell);
-
+		if (pbseImg == nullptr)
+		{
+			return bRet;
+		}
 		sz = pbseImg->GetImageSize();
 		height = sz.cx;
 		width = sz.cy;
@@ -606,11 +607,5 @@ namespace OTSCLRINTERFACE
 		//	return 0;
 
 	}
-	//void COTSControlFunExport::InitDevPoint()
-	//{
-	//	
-	//		
-	//	
-	//
-	//}
+
 }

+ 11 - 1
OTSCPP/OTSClrInterface/ControlClr/OTSControlFunExport.h

@@ -365,14 +365,24 @@ namespace OTSCLRINTERFACE
 		bool MoveSEMToPoint(double dPosX, double dPosY, double dRotation)
 		{
 
-			double dRota = dRotation;
+			//double dRota = dRotation;
 			CPoint cPos;
 			cPos.x = (LONG)dPosX;
 			cPos.y = (LONG)dPosY;
 			bool bRev = m_pSem->MoveSEMToPoint(cPos, dRotation);
 			return bRev;
 		}
+		//ÒÆ¶¯µç¾µµ½Ö¸¶¨µÄλÖÃ
+		bool MoveSEMToPoint(double dPosX, double dPosY)
+		{
 
+			double dRotation;
+			CPoint cPos;
+			cPos.x = (LONG)dPosX;
+			cPos.y = (LONG)dPosY;
+			bool bRev = m_pSem->MoveSEMToPoint(cPos, dRotation);
+			return bRev;
+		}
 
 	
 

+ 107 - 47
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -44,8 +44,9 @@ namespace OTSIncAReportGraph.Controls
        Include=0,
       
        MoveSEMToParticle=1,
-       CopyImage=2
-    
+       CopyImage=2,
+            OriginalSplicing=3
+
     }
     public partial class Control_DrawDistrbutionImageAndBSE : UserControl
     {
@@ -353,28 +354,21 @@ namespace OTSIncAReportGraph.Controls
             log.Info(str27);
             Application.DoEvents();
             ProgressBarUpdate(1, str27);
-
-
           
             List<Field> fieldlist = resultFile.List_OTSField;
 
             //防止有时底层返回的Field的List是0,直接返回
             if (fieldlist.Count == 0)
             {
-              
-
                 ProgressBarUpdate(100, "field number =0 !....");
                 return;
             }
 
-
             string str29 = "begin to composit field picture....";
             log.Info(str29);
             Application.DoEvents();
             ProgressBarUpdate(15, str29);
 
-         
-
             //第一次循环,用来计算单个Field的像素分辨率,和将所有的物理位置存放到List当中
             List<Point> list_point = new List<Point>();
             int fieldwidth = 0, fieldheight = 0;
@@ -394,14 +388,9 @@ namespace OTSIncAReportGraph.Controls
                 list_point.Add(ls_point);
             }
 
-         
-
-
             //计算出整个绘制图像总Rectagnle的大小
             m_backRect = ReportFun. ConvertAndGetMaxRect(list_point, fieldwidth, fieldheight);
            
-
-           
             ProgressBarUpdate(18, "calculate ruler....");
 
             #region //标尺相关------------------------------------------------------------------------------
@@ -410,74 +399,49 @@ namespace OTSIncAReportGraph.Controls
             double d_onepixel_scale = Convert.ToDouble(ls_jsblrect.Width) / Convert.ToDouble(fieldwidth);
             //再用该比例对标尺进行相应的赋值
             m_pixelSize = (float)d_onepixel_scale;
-
- 
             #endregion //---------------------------------------------------------------------------------------
 
-        
-
             ProgressBarUpdate(20, "composit whole picture....");
 
             //70的进度条给到下面的循环中,计算进度条各分类进度分配
             float ls_int_progresscalc = 0;
             if (fieldlist.Count > 0)
                 ls_int_progresscalc = (float)70 / (float)fieldlist.Count;
-
             string str32 = "finished ";
-     
             string str33 = "total ";
-         
             string str34 = "field...";
 
-
             var otsLeftBottomPoint = ReportFun.GetOTSCoordLeftBottomPoint(list_point);
     
             for (int i = 0; i < fieldlist.Count(); i++)
             {
-               
                 ProgressBarUpdate(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + resultFile.List_OTSField.Count.ToString() + str34);
-
-           
-
                 //取出该Field的物理坐标,将其转换成对应的屏幕像素坐标,屏幕左上角为原点(0,0)的偏移值,用于后面计算各Segment的位置使用
-               
                 Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
-              
-                
                 Point offset_point = ReportFun.ConvertOTSCoordinateToScreenCoord(otsLeftBottomPoint, m_pixelSize, thisfield_point, m_backRect, new RectangleF(0,0,fieldwidth,fieldheight));//the ots coordinate is always the up right positive.
-               
                 DisplayField df = new DisplayField(fieldlist[i],fieldwidth,fieldheight, offset_point);
-        
                 m_list_allDfield.Add(df);
                 m_list_allDPart.AddRange(df.List_DParticle);
-              
-               
-
 
             }
-
-          
-
           
             ProgressBarUpdate(90, "convert solution...");
-
             //然后这里还需要计算出,各field的宽和高,帧图边框分别需要显示多少个框
             if (fieldwidth != 0 && fieldheight != 0)
             {
                 m_i_grid_showlinesnumber_width = Convert.ToInt32(BackRectF.Width / fieldwidth);
                 m_i_grid_showlinesnumber_height = Convert.ToInt32(BackRectF.Height / fieldheight);
             }
-        
 
             ProgressBarUpdate(95, "other work...");
-  
          
             //相关计数
             ReportFun.m_field_count = fieldlist.Count;
             ReportFun.m_particle_count = m_list_allDPart.Count;
         }
-  
-       
+
+    
+
         /// <summary>
         /// 分布图和BSE图中,从底层获取相关结果后,重新组织显示
         /// </summary>
@@ -1216,6 +1180,7 @@ namespace OTSIncAReportGraph.Controls
                         CMenuStrip.Items[(int)RightButtonMenu.Include].Visible = false;
                        
                         CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = false;
+                        CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = false;
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = true;
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Tag = item;
                     }
@@ -1241,7 +1206,7 @@ namespace OTSIncAReportGraph.Controls
 
                     }
                     CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = true;
-
+                    CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = true;
                     CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = false;
 
 
@@ -1480,6 +1445,7 @@ namespace OTSIncAReportGraph.Controls
         //复制图像
         private void toolStripMenuItem_copyimage_Click(object sender, EventArgs e)
         {
+
             //outpic();
             if (outpic())
             {
@@ -1489,7 +1455,7 @@ namespace OTSIncAReportGraph.Controls
             {
                 MessageBox.Show("Picture export failed");
             }
-            
+
             //CopyImage();
         }
 
@@ -1949,8 +1915,10 @@ namespace OTSIncAReportGraph.Controls
 
         private bool outpic()
         {
+
             SaveFileDialog sfd = new SaveFileDialog();
-            sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg|ALL Files(*.*)|*.*";
+            //|ALL Files(*.*)|*.*
+            sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg";
             if (sfd.ShowDialog() == DialogResult.OK)
             { 
                 try
@@ -1978,7 +1946,6 @@ namespace OTSIncAReportGraph.Controls
 
                     pic_bitmap.Save(sfd.FileName);
                     pic_bitmap.Dispose();
-                    pic_bitmap.Dispose();
                     return true;
                 }
                 catch
@@ -1990,6 +1957,88 @@ namespace OTSIncAReportGraph.Controls
             return false;
 
         }
+        private bool outpic_Render()
+        {
+            SaveFileDialog sfd = new SaveFileDialog();
+            sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg";
+            List<Field> fieldlist = resultFile.List_OTSField;
+
+            if (sfd.ShowDialog() == DialogResult.OK)
+            {
+                try
+                {
+                    double x_max ;
+                    double y_max ;
+                    DataTable picDatat = new DataTable();
+                    picDatat.Columns.Add("X", typeof(double));
+                    picDatat.Columns.Add("Y", typeof(double));
+                    picDatat.Columns.Add("pic_ID");
+                    foreach (var f in m_list_allDfield)
+                    {
+                        DataRow dr = picDatat.NewRow();
+                        dr["X"] = f.Rect.X;
+                        dr["Y"] = f.Rect.Y;
+                        dr["pic_ID"] = f.FieldID;
+                        picDatat.Rows.Add(dr);
+                    }
+                     x_max = Convert.ToDouble(picDatat.Compute("Max(X)", "true"));
+                     y_max = Convert.ToDouble(picDatat.Compute("Max(Y)", "true"));
+                    Bitmap pic_bitmap = new Bitmap((int)x_max, (int)y_max);
+                    Graphics graph = Graphics.FromImage(pic_bitmap);
+                    foreach (var f in m_list_allDfield)
+                    {
+                        Bitmap image = new Bitmap(f.OriginalImage.Width,f.OriginalImage.Height);
+                        Graphics g2= Graphics.FromImage(image);
+                        g2.DrawImage(f.OriginalImage,0,0, f.OriginalImage.Width, f.OriginalImage.Height);
+                        Graphics graph_2 = Graphics.FromImage(image);
+
+                        for (int i = 0; i < fieldlist.Count; i++)
+                        {
+                            if (fieldlist[i].FieldID.ToString() == f.FieldID.ToString())
+                            {
+                                //先获取该Field中的所有Particle
+                                List<Particle> list_particle;
+                                list_particle = fieldlist[i].ParticleList;
+                                //再循环计算所有的Particle对象
+                                foreach (Particle particle in list_particle)
+                                {
+                                    //创建DParticle颗粒
+                                    DisplayParticle dp = new DisplayParticle(particle);
+                                    List<Segment> list_seg;
+                                    list_seg = particle.SegmentList;
+                                    //创建颗粒分布图对应的类对象
+                                    List<DisplaySegment> list_dsegment = new List<DisplaySegment>();
+                                    //再循环取出里面所有的segment
+                                    foreach (Segment seg in list_seg)
+                                    {
+                                        #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
+                                        
+                                        Point on_p = new Point() { X = seg.Start, Y = seg.Height };
+                                        Point off_p = new Point() { X = seg.Start + seg.Length, Y = seg.Height };
+                                        Pen npen = new Pen(dp.Color);
+                                        graph_2.DrawLine(npen, on_p, off_p);
+                                 
+                                        #endregion
+                                    }
+                                }
+                            }
+                        }
+                        graph.DrawImage(image, f.Rect.X, f.Rect.Y, f.Rect.Width, f.Rect.Height);
+                    }
+
+                    pic_bitmap.Save(sfd.FileName);
+                    pic_bitmap.Dispose();
+                    pic_bitmap.Dispose();
+                    return true;
+                }
+                catch
+                {
+                    return false;
+                }
+
+            }
+            return false;
+        }
         private static byte[] ImgtoByte(Image img)
         {
             MemoryStream ms = new MemoryStream();
@@ -2046,9 +2095,20 @@ namespace OTSIncAReportGraph.Controls
                 );
 #endif
         }
-        #endregion
 
 
+        #endregion
 
+        private void ExportoriginalspliceToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            if (outpic_Render())
+            {
+                MessageBox.Show("Picture export complete");
+            }
+            else
+            {
+                MessageBox.Show("Picture export failed");
+            }
+        }
     }
 }

+ 14 - 3
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.designer.cs

@@ -33,6 +33,7 @@
             this.ToolStripMenuItem_selected = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItem_movesempoint = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem_copyimage = new System.Windows.Forms.ToolStripMenuItem();
+            this.ExportoriginalspliceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.CMenuStrip.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -42,9 +43,10 @@
             this.CMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.ToolStripMenuItem_selected,
             this.ToolStripMenuItem_movesempoint,
-            this.toolStripMenuItem_copyimage});
+            this.toolStripMenuItem_copyimage,
+            this.ExportoriginalspliceToolStripMenuItem});
             this.CMenuStrip.Name = "contextMenuStrip1";
-            this.CMenuStrip.Size = new System.Drawing.Size(219, 116);
+            this.CMenuStrip.Size = new System.Drawing.Size(219, 146);
             // 
             // ToolStripMenuItem_selected
             // 
@@ -67,9 +69,17 @@
             this.toolStripMenuItem_copyimage.Image = global::OTSIncAReportApp.Properties.Resources.复制图像;
             this.toolStripMenuItem_copyimage.Name = "toolStripMenuItem_copyimage";
             this.toolStripMenuItem_copyimage.Size = new System.Drawing.Size(218, 30);
-            this.toolStripMenuItem_copyimage.Text = "导出图像到文件";
+            this.toolStripMenuItem_copyimage.Text = "导出原图拼接图";
             this.toolStripMenuItem_copyimage.Click += new System.EventHandler(this.toolStripMenuItem_copyimage_Click);
             // 
+            // ExportoriginalspliceToolStripMenuItem
+            // 
+            this.ExportoriginalspliceToolStripMenuItem.Image = global::OTSIncAReportApp.Properties.Resources.复制图像;
+            this.ExportoriginalspliceToolStripMenuItem.Name = "ExportoriginalspliceToolStripMenuItem";
+            this.ExportoriginalspliceToolStripMenuItem.Size = new System.Drawing.Size(218, 30);
+            this.ExportoriginalspliceToolStripMenuItem.Text = "导出原图拼接分类图";
+            this.ExportoriginalspliceToolStripMenuItem.Click += new System.EventHandler(this.ExportoriginalspliceToolStripMenuItem_Click);
+            // 
             // Control_DrawDistrbutionImageAndBSE
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -91,5 +101,6 @@
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_movesempoint;
         private Control_Ruler control_Ruler1;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_copyimage;
+        private System.Windows.Forms.ToolStripMenuItem ExportoriginalspliceToolStripMenuItem;
     }
 }

+ 4 - 49
OTSSysMgrTools/Imagepro.cs

@@ -383,24 +383,13 @@ namespace OTSSysMgrTools
                 {
                     //设置为原始 扫描模式
                     cfun.SetSemScanMode(a_oldMode);
-                    //Scan类结束
-
-                    //初始化电镜参数
-                    //if (!cfun.SetAndStartScan())
-                    //{
-                    //    return 0;
-                    //}
+                   
                    
                 }
                 else
                 {
                     cfun.SetSemScanMode(a_oldMode);
-                    //记录日志
-                    //初始化电镜参数
-                    //if (!cfun.SetAndStartScan())
-                    //{
-                    //    return 0;
-                    //}
+                  
                 }
 
             }
@@ -408,45 +397,11 @@ namespace OTSSysMgrTools
             {
                 throw ex;
             }
-            finally
-            {
-                //cfun.ScanFinishedInstance();
-                //cfun.DisConnectSem();
-                //cfun.FreeDll();
-            }
+           
 
             return GetImgCount;
         }
 
-        /// <summary>
-        /// 将byte数组转换为文件并保存到指定地址
-        /// </summary>
-        /// <param name="buff">byte数组</param>
-        /// <param name="savepath">保存地址</param>
-        //public static void BytesConvertToFile(byte[] buff, string savepath, string fileName)
-        //{
-        //    try
-        //    {
-
-        //        //如果不存在就创建Enclosure文件夹 
-        //        if (Directory.Exists(savepath + @"\Enclosure\") == false)
-        //        {
-        //            Directory.CreateDirectory(savepath + @"\Enclosure\");
-        //        }
-
-        //        if (System.IO.File.Exists(savepath + @"\Enclosure\" + fileName))
-        //        {
-        //            System.IO.File.Delete(savepath + @"\Enclosure\" + fileName);
-        //        }
-        //        Bitmap bitmap=ToGrayBitmap(buff, 1024, 768);
-               
-        //        bitmap.Save(savepath + @"\Enclosure\" + fileName);
-                
-        //    }
-        //    catch (Exception)
-        //    {
-
-        //    }
-        //}
+       
     }
 }