浏览代码

complete the automatic beam off function and fix measure area calculation problem in the measure app

gsp 1 年之前
父节点
当前提交
8d667810f0

+ 1 - 1
Bin/x64/Debug/Config/SysData/OTSStage.stg

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="0">
+<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="3">
   <Collection RegName="Stagelist">
     <Member strName="圆形九圆孔50mm">
       <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,50000,0" shape="0:ROUND" />

+ 1 - 1
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CDomain.cs

@@ -14,7 +14,7 @@ namespace OTSDataType
 
     public class CDomain : ISlo
     {
-        protected const int DOMAIN_ITEM_NUMBER = 5;
+        //protected const int DOMAIN_ITEM_NUMBER = 5;
         protected otsdataconst.DOMAIN_SHAPE m_nShape;
         protected Rectangle m_rectangle;
         protected List<Point> m_PolygonPoint;

+ 27 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSSample.cs

@@ -292,19 +292,44 @@ namespace OTSDataType
                 // get image size
                 OTS_IMAGE_RESULOTION_OPTIONS nImageSizeId = m_poMsrParams.GetImageScanParam().GetImageResulotion();
                 long nResulotionId = RESOLUTION_ID_FIRST_TIE + (long)nImageSizeId;
-                int nImageSize = RESOLUTION_VALUE[nResulotionId].Width;
+                int nWidth = RESOLUTION_VALUE[nResulotionId].Width;
                 int nHeight = RESOLUTION_VALUE[nResulotionId].Height;
                 // pixel size (micros)
                 double dPixelSize = CalculatePixelSize();
                
 
                 // calculate pixel size 
-                dAFieldArea = (double)nImageSize * nHeight * dPixelSize * dPixelSize * 0.000001;// mm^2
+                dAFieldArea = (double)nWidth * nHeight * dPixelSize * dPixelSize * 0.000001;// mm^2
             }
 
             // return pixel size 
             return dAFieldArea;
 
+        }
+
+        public double GetTotalToMeasureArea()
+        {
+            double totalArea;
+            if (m_poMsrArea.GetShape() == DOMAIN_SHAPE.RECTANGLE)
+            {
+                totalArea = m_poMsrArea.GetRectDomain().Width * m_poMsrArea.GetRectDomain().Height;
+
+
+            }
+            else if (m_poMsrArea.GetShape() == DOMAIN_SHAPE.ROUND)
+            {
+
+                totalArea = (m_poMsrArea.GetRectDomain().Width / 2) * (m_poMsrArea.GetRectDomain().Width / 2) * 3.14159;
+
+            }
+            else 
+            {
+                double singleFldarea= CalculateAFieldArea();
+                totalArea = m_listFieldData.Count * singleFldarea;
+            
+            }
+            return totalArea * 0.000001;
+        
         }
         public bool InitFieldPosData(  out List<Point> lisFieldPos, out Size iSzie)
         {

+ 28 - 3
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -778,7 +778,15 @@ namespace OTSModelSharp
                         {
                             p.SetIsXrayParticle(true);
                         }
-                       CollectParticlesXrayData(curFld);
+                        try
+                        {
+                            CollectParticlesXrayData(curFld);
+                        }
+                        catch (Exception e)
+                        {
+                            log.Error(e.Message);
+                        }
+                      
 
 
                     }
@@ -789,7 +797,16 @@ namespace OTSModelSharp
                     curFld.SetIsMeasureComplete(true);
 
                     log.Info("Begin to classify particles! particle num:" + curFld.GetListAnalysisParticles().Count);
-                    ClassifyFieldParticles(curFld);
+                    try
+                    {
+                        ClassifyFieldParticles(curFld);
+                    }
+                    catch(Exception e)
+                    {
+                        log.Error(e.Message);
+                    
+                    }
+                   
 
                     MsgFieldBSE.InitFieldSTDColoredPartsDataMsg();
 
@@ -881,7 +898,15 @@ namespace OTSModelSharp
             var overlap = pImgProcessParam.GetOverlapParam();
             if (overlap > 0)
             {
-                curFldData.RemoveDuplicateOverlapParticles(overlap);
+                try
+                {
+                    curFldData.RemoveDuplicateOverlapParticles(overlap);
+                }
+                catch(Exception e)
+                {
+                    log.Error(e.Message);
+                }
+                
             }
 
 

+ 3 - 3
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSSampleVisualPropertyInfo.cs

@@ -1893,9 +1893,9 @@ namespace OTSMeasureApp
                 case OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_TO_MEASURE_AREA:
                     {
 
-                        double dFieldArea = 0; // this area should be the field area
-                        dFieldArea = m_Sample. CalculateAFieldArea();
-                        a_dValue = m_poSEMDataMsr.GetTotalFields() * dFieldArea;
+                        //double dFieldArea = 0; // this area should be the field area
+                        //dFieldArea = m_Sample. CalculateAFieldArea();
+                        a_dValue = m_Sample.GetTotalToMeasureArea();
                     }
                     break;
 

+ 2 - 6
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CreateRectangle.cs

@@ -240,7 +240,7 @@ namespace OTSMeasureApp
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
                 SolidBrush solidBrush = new SolidBrush(Color.FromArgb(50, Color.Black));
                 //字体大小 根据样品孔Rectangle大小
-                float fontSize = m_RegionF.Width / 4;
+                float fontSize = m_RegionF.Width / 2;
                 Font font = new Font("宋体", fontSize, FontStyle.Regular);
                 if (fontSize == 0)
                 {
@@ -250,11 +250,7 @@ namespace OTSMeasureApp
                 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;  //图片柔顺模式选择
                 e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
                 e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
-                //绘制文字阴影
-                RectangleF rectFont = m_RegionF;
-                rectFont.X += 2;
-                rectFont.Y += 2;
-                e.Graphics.DrawString(strContent, font, solidBrush, rectFont, sf);
+               
                 e.Graphics.DrawString(strContent, font, sampleBrush, m_RegionF, sf);
             }
             //矩形

+ 1 - 1
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceGraphicsPanelFun.cs

@@ -19,7 +19,7 @@ namespace OTSMeasureApp
                     ColorStr = "#c8c8c8";//c8c8c8圆角矩形
                     break;
                 case ColorType.FontColor:
-                    ColorStr = "#90ee90";//90ee90文字颜色
+                    ColorStr = "#228B22";//90ee90文字颜色
                     break;
                 case ColorType.SampleColor:
                     ColorStr = "#f4f4f4";//f4f4f4 样品未选择

+ 7 - 7
OTSIncAMeasureApp/ServiceCenter/OxfordExtender/OxfordSemController.cs

@@ -151,7 +151,7 @@ namespace OTSMeasureApp.ServiceCenter
 
         public bool SetSemBeamOn(bool val)
         {
-            return true;
+            return iExtender.SetBeamAndFilamentOnOrOff(val);
         }
 
         public bool GetSemBeamOn()
@@ -193,24 +193,24 @@ namespace OTSMeasureApp.ServiceCenter
         }
 
 
-        public bool SetSemBeamCurrentOff(bool a_dKV)
+        public bool SetSemBeamCurrentOff(bool val)
         {
-            throw new NotImplementedException();
+            return iExtender.SetBeamAndFilamentOnOrOff(val);
         }
 
-        public bool SetSemBeamBlank(bool a_dKV)
+        public bool SetSemBeamBlank(bool val)
         {
-            throw new NotImplementedException();
+            return iExtender.SetBeamAndFilamentOnOrOff(val);
         }
 
         bool ISemController.StopXrayAcquisition()
         {
-            throw new NotImplementedException();
+            return true;
         }
 
         public bool SetSemHTOff(bool value)
         {
-            return true;
+            return iExtender.SetBeamAndFilamentOnOrOff(value);
         }
 
         public bool RunHIGH_VACUUM()

+ 4 - 0
OTSIncAReportApp/1-UI/Control_Graph/OTSIncAReportGraphFuncation/OTSImageDisHelp.cs

@@ -282,6 +282,10 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             if (resultFile.List_OTSField == null)
                 return;
             Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == in_clr_fieldid).ParticleList.Find(x => x.ParticleId == in_clr_tagid);
+            if (particle == null)
+            {
+                return;
+            }
             var tmpPart = new ParticleData(resultFile.FilePath).GetParticleXrayDataByFidAndPid(Convert.ToString(particle.FieldId), Convert.ToString(particle.XrayId));
             if (tmpPart != null)
             {

+ 4 - 0
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -2699,6 +2699,10 @@ namespace OTSIncAReportGrids
                     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));
+                    if (particle == null)
+                    {
+                        return;
+                    }
                     control_XRayTable1.SetParticleInfo("Area:" + Math.Round(particle.Area, 2) + "  " + "DMAX:" + Math.Round(particle.DMAX, 2) +"  " + "DELONG:" + Math.Round(particle.DELONG, 2) + "  " + "DFERET:" + Math.Round(particle.DFERET, 2) + "  " + "DINSCR:" + Math.Round(particle.DINSCR, 2) + "\n" + "DMEAN:" + Math.Round(particle.DMEAN, 2) + "  " + "DMIN:" + Math.Round(particle.DMIN, 2) + "  " + "DPERP:" + Math.Round(particle.DPERP, 2) + "  " + "ORIENTATION:" + Math.Round(particle.ORIENTATION, 2) + "  " + "PERIMETER:" + Math.Round(particle.PERIMETER, 2));
 
                     //获取数据后,需要对xraytable设置

+ 5 - 5
OTSSysMgrApp/OTSSystemManagerForms.cs

@@ -182,7 +182,7 @@ namespace OTSSysMgrApp
             {
    
                     tabHardwareSet.Parent = tabControl1;
-                //}
+                
             }
             catch (Exception)
             {
@@ -206,7 +206,7 @@ namespace OTSSysMgrApp
             coB_CleannessType.SelectedIndex=0;
             this.coB_CleannessType.SelectedIndexChanged += new System.EventHandler(this.coB_CleannessType_SelectedIndexChanged);
             ReadSysType();
-            //btn_ok.Enabled = false;
+           
         }
         /// <summary>
         /// 将所有参数保存
@@ -350,7 +350,7 @@ namespace OTSSysMgrApp
 
 
 
-        private bool CopyConfigBySysType()
+        private bool ChangeSysType()
         {
             SwitchSystemValidation switchSystemValidation = new SwitchSystemValidation();
             DialogResult dialogResult = switchSystemValidation.ShowDialog();
@@ -621,7 +621,7 @@ namespace OTSSysMgrApp
         private void radioButton_IncA_CheckedChanged(object sender, EventArgs e)
         {
             bool r = radioButton_IncA.Checked;
-            if (!CopyConfigBySysType())
+            if (!ChangeSysType())
             {
                 this.radioButton_IncA.CheckedChanged -= new System.EventHandler(this.radioButton_IncA_CheckedChanged);
                 radioButton_CleannessA.Checked = r;
@@ -635,7 +635,7 @@ namespace OTSSysMgrApp
             if(radioButton_CleannessA.Checked)
             {
                 this.radioButton_IncA.CheckedChanged -= new System.EventHandler(this.radioButton_IncA_CheckedChanged);
-                CopyConfigBySysType();
+                ChangeSysType();
                 this.radioButton_IncA.CheckedChanged += new System.EventHandler(this.radioButton_IncA_CheckedChanged);
             }
         }

+ 3 - 3
OTSSysMgrApp/SemTestForms.cs

@@ -1077,14 +1077,14 @@ namespace OTSSysMgrApp
 
         private void bVoltageClose_Click(object sender, EventArgs e)
         {
-            bool a_HTValue = true;
+            bool a_HTValue = false;
             bool result = m_SemHardwareMgr.SetSemBeamCurrentOff(a_HTValue);
 
         }
 
         private void bVoltageStatus_Click(object sender, EventArgs e)
         {
-            bool a_HTValue = true;
+            bool a_HTValue = false;
    
             bool result = m_SemHardwareMgr.SetSemBeamBlank(a_HTValue);
 
@@ -1121,7 +1121,7 @@ namespace OTSSysMgrApp
 
         private void button3_Click_1(object sender, EventArgs e)
         {
-            bool result = m_SemHardwareMgr.SetSemHTOff(true);
+            bool result = m_SemHardwareMgr.SetSemHTOff(false);
         }
 
         private void btn_HIGH_VACUUM_Click(object sender, EventArgs e)

+ 6 - 0
OxfordExtenderWrapper/ExtenderIpcUI1.cs

@@ -339,6 +339,12 @@ namespace OxfordExtenderWrapper
             return iExtender.GetSemBeamOn();
 
         }
+        public bool SetBeamAndFilamentOnOrOff(bool val)
+        {
+           bool b1= iExtender.SetSemBeamOnOrOff(val);
+            bool b2=iExtender.SetSemFilamentOnOrOff(val);
+            return b1||b2;
+        }
         public void StopXrayAquisition()
         {
 

+ 72 - 0
OxfordExtenderWrapper/ExtenderWrapper.cs

@@ -1850,6 +1850,78 @@ namespace OxfordExtenderWrapper
             
             }
            
+        }
+        public bool SetSemBeamOnOrOff(bool val)
+        {
+            double beamon ;
+            if (val)
+            {
+                beamon = 1;
+            }
+            else
+            {
+                beamon = 0;
+
+            }
+            Dictionary<Column, double> columnDictionary = new Dictionary<Column, double>
+            {
+                { Column.BeamOn, (double)beamon }
+
+            };
+
+            m_CollumnUpdated = false;
+            this.microscopeController.SetColumnConditions(columnDictionary);
+            int time1 = Environment.TickCount;
+            int time2;
+            while (!m_CollumnUpdated)
+            {
+                Application.DoEvents();
+                time2 = Environment.TickCount;
+                if (time2 - time1 > 10000)
+                {
+                    currentCommand.returnType = false;
+                    return false;
+
+                }
+            }
+            return true;
+
+        }
+        public bool SetSemFilamentOnOrOff(bool val)
+        {
+            double beamon;
+            if (val)
+            {
+                beamon = 1;
+            }
+            else
+            {
+                beamon = 0;
+
+            }
+            Dictionary<Column, double> columnDictionary = new Dictionary<Column, double>
+            {
+                { Column.FilamentOn, (double)beamon }
+
+            };
+
+            m_CollumnUpdated = false;
+            this.microscopeController.SetColumnConditions(columnDictionary);
+            int time1 = Environment.TickCount;
+            int time2;
+            while (!m_CollumnUpdated)
+            {
+                Application.DoEvents();
+                time2 = Environment.TickCount;
+                if (time2 - time1 > 10000)
+                {
+                    currentCommand.returnType = false;
+                    return false;
+
+                }
+            }
+            return true;
+
         }
         public void StopXrayAquisition()
         {