Преглед изворни кода

optimize code, add log info when set working distance and set magnification.

gsp пре 3 година
родитељ
комит
46ebc13689

+ 21 - 9
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -105,8 +105,7 @@ namespace OTSModelSharp
                     return false;
                 }
             }
-            log.Info("set magnification:" + dMag.ToString());
-            log.Info("set Working Distance:" + dWorkDis.ToString());
+          
             pSEMCtrl.SetMagnification(dMag);
             pSEMCtrl.SetWorkingDistance(dWorkDis);
 
@@ -466,18 +465,31 @@ namespace OTSModelSharp
                 }
             }
             log.Info("Begin to move SEM stage to " + a_SEMpt.X + "," + a_SEMpt.Y);
-            CSampleParam pMsrParam = m_Sample.GetMsrParams();
-            if (pMsrParam.SlopParam.IsUsingSlopParam)
-            {
-                double wd = pMsrParam.SlopParam.GetWD(a_SEMpt);
-
-                pSEMController.SetWorkingDistance(wd);
-            }
+           
             // move SEM to the position (rotation 0)
             if (!pSEMController.MoveSEMToPoint(a_SEMpt))
             {
                 log.Error("MoveSEMToPoint: failed to call MoveSEMToPoint method.");
                 return false;
+            }
+            CSampleParam pMsrParam = m_Sample.GetMsrParams();
+            if (pMsrParam.SlopParam.IsUsingSlopParam)
+            {
+                double wd = pMsrParam.SlopParam.GetWD(a_SEMpt);
+                double originWd = 0;
+                pSEMController.GetWorkingDistance(ref originWd);
+                if ((wd - originWd) > 2)
+                {
+                    log.Warn("Working Distance is invalid,outof the moving scope(2cm)  wd=" + wd.ToString("F2"));
+
+                }
+                else 
+                {
+                    Thread.Sleep(hardWareDelay);
+                    pSEMController.SetWorkingDistance(wd);
+                }
+
+              
             }
             Thread.Sleep(hardWareDelay);
             return true;

+ 4 - 4
OTSIncAMeasureApp/1-OTSMeasure/OTSMeasureDisplayResult.cs

@@ -354,8 +354,8 @@ namespace OTSMeasureApp
                     int XOffice = 0;
                     int YOffice = 0;
                     //以放大倍数 获取当前倍数扫描尺寸 与100倍扫描尺寸的比例
-                    int ScanFieldSize = m_MeasureApp.m_ProjParam.m_ResultData.GetWorkingSample().GetSEMDataMsr().GetScanFieldSize();
-                    int ScanFieldSize100 = m_MeasureApp.m_ProjParam.m_ResultData.GetWorkingSample().GetSEMDataMsr().GetScanFieldSize100();
+                    int ScanFieldSize = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize();
+                    int ScanFieldSize100 = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize100();
                     float Scale = Convert.ToSingle(ScanFieldSize100) / Convert.ToSingle(ScanFieldSize);
                     if (Scale > 0)
                     {
@@ -392,8 +392,8 @@ namespace OTSMeasureApp
                     int XOffice = 0;
                     int YOffice = 0;
                     //以放大倍数 获取当前倍数扫描尺寸 与100倍扫描尺寸的比例
-                    int ScanFieldSize = m_MeasureApp.m_ProjParam.m_ResultData.GetWorkingSample().GetSEMDataMsr().GetScanFieldSize();
-                    int ScanFieldSize100 = m_MeasureApp.m_ProjParam.m_ResultData.GetWorkingSample().GetSEMDataMsr().GetScanFieldSize100();
+                    int ScanFieldSize = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize();
+                    int ScanFieldSize100 = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize100();
                     float Scale = ScanFieldSize100 / ScanFieldSize;
                     minTempRange = Convert.ToInt32(minTempRange / Scale);
                     maxTempRange = Convert.ToInt32(maxTempRange / Scale);

+ 1 - 1
OTSIncAMeasureApp/1-OTSMeasure/OTSMeasureResultWindow.cs

@@ -371,7 +371,7 @@ namespace OTSMeasureApp
         public void GetResultFileInfoBySampleName(string sampleName)
         {
             //显示样品名称信息
-            COTSSample sample = m_MeasureAppForm.m_ProjParam.m_ResultData.GetSampleByName(sampleName);
+            COTSSample sample = m_MeasureAppForm.m_ProjParam.GetResultData().GetSampleByName(sampleName);
             //设置当前样品名称
             SetSampleName(sampleName);
             //已完成的数量

+ 127 - 95
OTSIncAMeasureApp/2-OTSMeasureParamManage/COTSMeasureParam.cs

@@ -71,27 +71,59 @@ namespace OTSMeasureApp
 
         /// <summary></summary>
         /// <remarks>创建</remarks>
-        public COTSMsrPrjResultData m_ResultData;
+        private COTSMsrPrjResultData resultData;
 
 
 
         //参数文件
-        public COTSDefaultParam m_DefaultParam = null;
+        private COTSDefaultParam defaultParam = null;
         //样品台文件(读取样品台数据等)                            
-        public CStageParam m_StageParam = null;
-        public CSpecialGrayRangeParam  m_specialRanges=null;
-  
+        private CStageParam stageParam = null;
+        private CSpecialGrayRangeParam specialRanges = null;
+
         //测量样品链表
         List<COTSSample> m_MeasureSampleList = new List<COTSSample>();
 
         NLog.Logger log ;
 
+        public CSpecialGrayRangeParam SpecialRanges { get => specialRanges; set => specialRanges = value; }
+
+        public CStageParam GetStageParam()
+        {
+            return stageParam;
+        }
+
+        public void SetStageParam(CStageParam value)
+        {
+            stageParam = value;
+        }
+
+        public COTSDefaultParam GetDefaultParam()
+        {
+            return defaultParam;
+        }
+
+        public void SetDefaultParam(COTSDefaultParam value)
+        {
+            defaultParam = value;
+        }
+
+        public COTSMsrPrjResultData GetResultData()
+        {
+            return resultData;
+        }
+
+        public void SetResultData(COTSMsrPrjResultData value)
+        {
+            resultData = value;
+        }
+
         public COTSMeasureParam(OTSIncAMeasureAppForm MeasureApp)
         {
             log = NLog.LogManager.GetCurrentClassLogger();
             m_MeasureAppFrom = MeasureApp;
-           
-            m_ResultData = new COTSMsrPrjResultData();
+
+            SetResultData(new COTSMsrPrjResultData());
 
 
         }
@@ -104,9 +136,9 @@ namespace OTSMeasureApp
         public bool LoadParamFile()
         {
             //加载样品参数文件:   \Config\SysData\OTSProgMgrParam.pmf
-            m_DefaultParam = new COTSDefaultParam();
-            m_DefaultParam.LoadInfoFromProgMgrFile();
-            if (null == m_DefaultParam)
+            SetDefaultParam(new COTSDefaultParam());
+            GetDefaultParam().LoadInfoFromProgMgrFile();
+            if (null == GetDefaultParam())
             {
                 return false;
             }
@@ -118,9 +150,9 @@ namespace OTSMeasureApp
         //检查参数样品台文件是否存在
         public bool LoadStageParamFile()
         {
-            m_StageParam = new CStageParam();
+            SetStageParam(new CStageParam());
             // 加载样品台文件;  \Config\SysData\OTSStage.stg
-            if (!m_StageParam.Load(true, false))
+            if (!GetStageParam().Load(true, false))
             {
                 return false;
             }
@@ -131,9 +163,9 @@ namespace OTSMeasureApp
 
         public bool LoadSpecialGrayRangeParamFile()
         {
-            m_specialRanges = new CSpecialGrayRangeParam();
+            SpecialRanges = new CSpecialGrayRangeParam();
            
-            if (!m_specialRanges.LoadParam());
+            if (!SpecialRanges.LoadParam());
             {
                 return false;
             }
@@ -150,39 +182,39 @@ namespace OTSMeasureApp
             {
 
                 //设置样品台参数
-                CStage Stage = m_StageParam.GetWorkingStage();
+                CStage Stage = GetStageParam().GetWorkingStage();
                 if (null == Stage)
                 {
                     return false;
                 }
-                m_ResultData.SetStage(Stage);
+                GetResultData().SetStage(Stage);
                 
 
                 // 设置 SEM stage data
-                CSEMStageData SEMData = m_DefaultParam.GetStageDataParam();
+                CSEMStageData SEMData = GetDefaultParam().GetStageDataParam();
                 if (null == SEMData)
                 {
                     return false;
                 }
-                m_ResultData.SetSEMStageData(SEMData);
+                GetResultData().SetSEMStageData(SEMData);
             }
 
             //设置 general parameter
-            COTSGeneralParam GenParam = m_DefaultParam.GetGenParam();
+            COTSGeneralParam GenParam = GetDefaultParam().GetGenParam();
             if (null == GenParam)
             {
                 return false;
             }
-            m_ResultData.SetGenParam(GenParam);
+            GetResultData().SetGenParam(GenParam);
 
 
 
-            if (m_ResultData.GetPathName()=="")
+            if (GetResultData().GetPathName()=="")
             {
-                m_ResultData.SetPathName("Untitled");             
+                GetResultData().SetPathName("Untitled");             
             }
 
-            m_ResultData.m_nPackId = m_DefaultParam.m_nPackId;
+            GetResultData().m_nPackId = GetDefaultParam().m_nPackId;
 
 
             return true;
@@ -193,12 +225,12 @@ namespace OTSMeasureApp
         //新建样品工作文件 0:报错 1:正常 2:取消
         public int CreateNewFile()
         {
-            if (m_ResultData.IsModified())    // 文件被修改
+            if (GetResultData().IsModified())    // 文件被修改
             {
                 int iRev = m_MeasureAppFrom.ShowSaveInfoMsgBox();
                 if ((int)MessageBoxRev.DIALOG_YES == iRev)
                 {
-                    if (!m_ResultData.Save())
+                    if (!GetResultData().Save())
                     {
 
                         return 0;
@@ -213,10 +245,10 @@ namespace OTSMeasureApp
             //新建新的工作文件
             //重新生成一个工作文件对象
             COTSMsrPrjResultData ProjDataMgr = new COTSMsrPrjResultData();
-            m_ResultData.SetPathName("Untitled");
-          
+            GetResultData().SetPathName("Untitled");
+
 
-            m_ResultData = ProjDataMgr;
+            SetResultData(ProjDataMgr);
             this.LoadStageParamFile();
            
             if (!this.InitResultData())
@@ -236,7 +268,7 @@ namespace OTSMeasureApp
         public Point ChangeOTSToSemCoord(Point POTSCoord)
         {
             System.Drawing.Point VSemCoord = new System.Drawing.Point();
-            m_DefaultParam.GetStageDataParam().ConverOTSToSEMPoint(POTSCoord, ref VSemCoord);
+            GetDefaultParam().GetStageDataParam().ConverOTSToSEMPoint(POTSCoord, ref VSemCoord);
             return (Point)VSemCoord;
         }
 
@@ -244,7 +276,7 @@ namespace OTSMeasureApp
         public Point ConverSEMToOTSPoint(Point PSEMCoord)
         {
             System.Drawing.Point VOTSCoord = new System.Drawing.Point();
-            m_DefaultParam.GetStageDataParam().ConverSEMToOTSPoint(PSEMCoord, ref VOTSCoord);
+            GetDefaultParam().GetStageDataParam().ConverSEMToOTSPoint(PSEMCoord, ref VOTSCoord);
             return (Point)VOTSCoord;
         }
 
@@ -258,7 +290,7 @@ namespace OTSMeasureApp
             SetSampleDefaultPara(ref NewSample, a_strHoleName);
             //NewSample.
             //添加样品
-            m_ResultData.AddSample(NewSample);
+            GetResultData().AddSample(NewSample);
 
           
             // 获取样品的属性值
@@ -293,17 +325,17 @@ namespace OTSMeasureApp
             CDomain pMsrArea = CalculateDefaultArea(pHole);
             // measure data parameters containing particle analysis std, image scan parameter, image process parameter and x-ray parameter 
             CSampleParam poMsrParams = new CSampleParam();
-            poMsrParams.m_nPackId = m_DefaultParam.m_nPackId;
-            poMsrParams.m_runmode = m_DefaultParam.m_runmode;
-            var m_pParam = m_DefaultParam.GetGenParam();
+            poMsrParams.m_nPackId = GetDefaultParam().m_nPackId;
+            poMsrParams.m_runmode = GetDefaultParam().m_runmode;
+            var m_pParam = GetDefaultParam().GetGenParam();
             MEMBRANE_TYPE a_nVal = (MEMBRANE_TYPE)m_pParam.GetMembraneType();
-            poMsrParams.SetImageScanParam(m_DefaultParam.GetImageScanParam ());
-            poMsrParams.SetImageProcessParam(m_DefaultParam.GetImageProcParam()); 
-            poMsrParams.SetXRayParam(m_DefaultParam.GetXRayParam());
+            poMsrParams.SetImageScanParam(GetDefaultParam().GetImageScanParam ());
+            poMsrParams.SetImageProcessParam(GetDefaultParam().GetImageProcParam()); 
+            poMsrParams.SetXRayParam(GetDefaultParam().GetXRayParam());
             String sSTDName = m_pParam.GetSTDSelect();
             poMsrParams.SetSTDName(sSTDName);
             poMsrParams.SetSteelTechnology((STEEL_TECHNOLOGY)m_pParam.GetSteelTechnology());
-            poMsrParams.SetSpecialGrayRangeParam(m_specialRanges);
+            poMsrParams.SetSpecialGrayRangeParam(SpecialRanges);
             // set sample parameters
             pSample.SetName(strNewSampleName);
             pSample.SetSampleHoleName(pHole.GetName());
@@ -313,7 +345,7 @@ namespace OTSMeasureApp
             pSample.SetMembraneType(a_nVal);
             pSample.SetMsrParams(poMsrParams);
             CSEMDataMsr semData = new CSEMDataMsr();
-            var m_pSEMStageData = m_DefaultParam.GetStageDataParam();
+            var m_pSEMStageData = GetDefaultParam().GetStageDataParam();
             semData.SetScanFieldSize100(m_pSEMStageData.GetScanFieldSize100());
             pSample.SetSEMDataMsr(semData);
 
@@ -325,7 +357,7 @@ namespace OTSMeasureApp
             String strNewSmplName = "";
 
             // safety check
-            var m_pParam = m_DefaultParam.GetGenParam();
+            var m_pParam = GetDefaultParam().GetGenParam();
             if (m_pParam == null)
             {
                 // shouldn't happen, invalid general parameter pointer.
@@ -362,7 +394,7 @@ namespace OTSMeasureApp
 
             // go through sample list
             int nIndex = 0;
-            var m_listSamples = m_ResultData.GetSampleList();
+            var m_listSamples = GetResultData().GetSampleList();
             foreach (var pSample in m_listSamples)
             {
                 // return TRUE if this is not an exclude sample and its name is same with input
@@ -384,7 +416,7 @@ namespace OTSMeasureApp
         {
 
             // get holes list of the stage
-            var m_pStage = m_StageParam.GetWorkingStage();
+            var m_pStage = GetStageParam().GetWorkingStage();
             List<CHole> listHoles = m_pStage.GetHoleList();
             //返回样品孔对象
             CHole cReHole = new CHole();
@@ -429,7 +461,7 @@ namespace OTSMeasureApp
                 // has this hole any sample in it?
                 String strHoleName = pHole.GetName();
                 bool IsChanged = false;
-                var m_listSamples = m_ResultData.GetSampleList();
+                var m_listSamples = GetResultData().GetSampleList();
                 foreach (COTSSample sampleItem in m_listSamples)
                 {
                     if (strHoleName == sampleItem.GetSampleHoleName())
@@ -451,7 +483,7 @@ namespace OTSMeasureApp
         {
             Rectangle rectHole = a_pHole.GetDomainRect();
             System.Drawing.Point ptCenter = new System.Drawing.Point((rectHole.Left + rectHole.Right) / 2, (rectHole.Top + rectHole.Bottom) / 2);
-            var m_pParam = m_DefaultParam.GetGenParam();
+            var m_pParam = GetDefaultParam().GetGenParam();
             DOMAIN_SHAPE nShape = m_pParam.GetShape();
 
             double dArea = m_pParam.GetArea() * 1000000;
@@ -490,13 +522,13 @@ namespace OTSMeasureApp
         public bool SetSampleParamVal(OTS_SAMPLE_PROP_GRID_ITEMS ItemId, OTS_ITEM_TYPES ValType, object objVal)
         {
 
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
 
             bool bSetFalg = false;
             //判断样品名是否有效
             if (ItemId == OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_NAME)
             {
-                if (!m_ResultData.IsValidSampleName((string)objVal))
+                if (!GetResultData().IsValidSampleName((string)objVal))
                 {
                     bSetFalg = false;
                     return false;
@@ -506,7 +538,7 @@ namespace OTSMeasureApp
 
             if (bSetFalg)
             {
-                m_ResultData.SetModify(true);
+                GetResultData().SetModify(true);
             }
             return bSetFalg;
         }
@@ -515,7 +547,7 @@ namespace OTSMeasureApp
         public string GetWorkSampleName()
         {
 
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return "";
@@ -538,7 +570,7 @@ namespace OTSMeasureApp
                 return false;
             }
 
-            if (!m_ResultData.SetWorkingSampleByName(sNewWorkSampleName))
+            if (!GetResultData().SetWorkingSampleByName(sNewWorkSampleName))
             {
                 return false;
             }
@@ -550,7 +582,7 @@ namespace OTSMeasureApp
         public COTSSample GetWorkSample()
         {
 
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
 
@@ -563,32 +595,32 @@ namespace OTSMeasureApp
         //string sWorkSampleName : 删除工作样品名称
         public bool DeleteWorkSample(string sWorkSampleName)
         {
-            return m_ResultData.DeleteSampleByName(sWorkSampleName);
+            return GetResultData().DeleteSampleByName(sWorkSampleName);
         }
 
         // 获取样品总数
         //返回样品总数
         public int GetSampleCount()
         {
-            return m_ResultData.GetSampleList().Count();
+            return GetResultData().GetSampleList().Count();
         }
 
         //改变工作样品名称
         //String sWSampleNewName
         public bool ChangeWorkSampleName(String sWSampleNewName)
         {
-            if (!m_ResultData.IsValidSampleName(sWSampleNewName))
+            if (!GetResultData().IsValidSampleName(sWSampleNewName))
             {
                 return false;
             }
-            COTSSample WorkSample = m_ResultData.GetWorkingSample();
+            COTSSample WorkSample = GetResultData().GetWorkingSample();
             if (null == WorkSample)
             {
                 return false;
             }
 
             WorkSample.SetName(sWSampleNewName);
-            m_ResultData.SetModify(true);
+            GetResultData().SetModify(true);
             return true;
 
         }
@@ -598,7 +630,7 @@ namespace OTSMeasureApp
         public SampleMeasurePara SetWorkSampleHoleNameAndMeasureArea(SampleMeasurePara SMeasurePara)
         {
             SampleMeasurePara SMPara = new SampleMeasurePara();
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return SMPara;
@@ -644,7 +676,7 @@ namespace OTSMeasureApp
         public void SetMeasureAreaShape(int iShape)
         {
             //  SampleMeasurePara SMPara = new SampleMeasurePara();
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return;
@@ -660,7 +692,7 @@ namespace OTSMeasureApp
         {
             OTS_SAMPLE_PROP_GRID_ITEM_GROUPS GroupID = OTS_SAMPLE_PROP_GRID_ITEM_GROUPS.INVALID;
             OTS_SAMPLE_PROP_GRID_ITEMS iItemID = OTS_SAMPLE_PROP_GRID_ITEMS.INVALID;
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return;
@@ -678,13 +710,13 @@ namespace OTSMeasureApp
         //bool ParaLockFlag : 样品参数锁
         public bool SetWorkSampleParamLock(bool ParaLockFlag)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
             }
             WSample.SetParamLock(ParaLockFlag);
-            m_ResultData.SetModify(true);
+            GetResultData().SetModify(true);
             return true;
         }
 
@@ -692,7 +724,7 @@ namespace OTSMeasureApp
         //ref bool ParamLockFlag : 获取的工作样品参数锁
         public bool GetWSampleParaLock(ref bool ParamLockFlag)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -704,7 +736,7 @@ namespace OTSMeasureApp
         //获取工作样品测量锁
         public bool GetWSampleParaLock(ref OTSSamplePropertyInfo SMInfo)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -721,13 +753,13 @@ namespace OTSMeasureApp
         //重新设置样品在样品列表中的位置(当拖动TREEVIEW的样品顺序后执行 )
         public bool SortSamplePosition(List<string> SNameList)
         {
-            if (!m_ResultData.ResetSamplesListOrder(SNameList))
+            if (!GetResultData().ResetSamplesListOrder(SNameList))
             {
                 return false;
             }
 
             List<COTSSample> SampleList = new List<COTSSample>();
-            SampleList = m_ResultData.GetSampleList();
+            SampleList = GetResultData().GetSampleList();
 
             return true;
         }
@@ -738,7 +770,7 @@ namespace OTSMeasureApp
             m_MeasureSampleList.Clear();
             List<COTSSample> MSampleList = new List<COTSSample>();
 
-            if (!CheckMeasureParam(m_ResultData, ref MSampleList, bCheckFlag))
+            if (!CheckMeasureParam(GetResultData(), ref MSampleList, bCheckFlag))
             {
                 return false;
             }
@@ -1070,7 +1102,7 @@ namespace OTSMeasureApp
         //List<string> MParamFileNameList:  测量参数文件链表
         public bool GetMeasureParamFileName(ref int iNamePos, ref List<string> MParamFileNameList)
         {
-            if (!m_ResultData.GetParamFileList(ref iNamePos, ref MParamFileNameList))
+            if (!GetResultData().GetParamFileList(ref iNamePos, ref MParamFileNameList))
             {
                 return false;
             }
@@ -1080,7 +1112,7 @@ namespace OTSMeasureApp
         //int iNamePos:  文件名在链表中的位置
         public bool SetMeasrueParamFileName(int iNamePos)
         {
-            if (!m_ResultData.ChangeParamFromList(iNamePos))
+            if (!GetResultData().ChangeParamFromList(iNamePos))
             {
                 return false;
             }
@@ -1092,7 +1124,7 @@ namespace OTSMeasureApp
         //List<string> STDFileNameList:  STD文件链表
         public bool GetSTDFileName(ref int iNamePos, ref List<string> STDFileNameList)
         {
-            if (!m_ResultData.GetSTDFileList(ref iNamePos, ref STDFileNameList))
+            if (!GetResultData().GetSTDFileList(ref iNamePos, ref STDFileNameList))
             {
                 return false;
             }
@@ -1101,7 +1133,7 @@ namespace OTSMeasureApp
         //设置STD 标准库文件名称
         public bool SetSTDFileName(int iNamePos)
         {
-            if (!m_ResultData.ChangeSTDFromList(iNamePos))
+            if (!GetResultData().ChangeSTDFromList(iNamePos))
             {
                 return false;
             }
@@ -1112,7 +1144,7 @@ namespace OTSMeasureApp
         public bool SaveWorkMeasureFile()
         {
             CSampleParamMgr SMeasureParamData = new CSampleParamMgr();
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -1158,7 +1190,7 @@ namespace OTSMeasureApp
                 return false;
             }
 
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -1181,7 +1213,7 @@ namespace OTSMeasureApp
         //判断是否允许修改样品名
         public bool CheckSampleNameIsValid(string sNewName)
         {
-            return m_ResultData.IsValidSampleName(sNewName);
+            return GetResultData().IsValidSampleName(sNewName);
         }
 
         //设置电镜参数
@@ -1192,8 +1224,8 @@ namespace OTSMeasureApp
         {
             try
             {
-                m_ResultData.GetWorkingSample().GetSEMDataMsr().SetWorkingDistance(iWDistance);
-                m_ResultData.GetWorkingSample().GetSEMDataMsr().SetMagnification(dMagni);
+                GetResultData().GetWorkingSample().GetSEMDataMsr().SetWorkingDistance(iWDistance);
+                GetResultData().GetWorkingSample().GetSEMDataMsr().SetMagnification(dMagni);
             }
             catch (Exception)
             {
@@ -1201,7 +1233,7 @@ namespace OTSMeasureApp
         }
         public void SetFliedsCount(int FliedsCount)
         {
-            m_ResultData.GetWorkingSample().GetSEMDataMsr().SetTotalFields(FliedsCount);
+            GetResultData().GetWorkingSample().GetSEMDataMsr().SetTotalFields(FliedsCount);
         }
         //获取电镜参数
         //int iScanFieldSize: Field扫描参数
@@ -1209,13 +1241,13 @@ namespace OTSMeasureApp
         //double dMagni: 放大倍数
         public void GetWorkingSampleSEMData(ref double iWDistance, ref double dMagni)
         {
-            iWDistance = m_ResultData.GetWorkingSample().GetSEMDataMsr().GetWorkingDistance();
-            dMagni = m_ResultData.GetWorkingSample().GetSEMDataMsr().GetMagnification();
+            iWDistance = GetResultData().GetWorkingSample().GetSEMDataMsr().GetWorkingDistance();
+            dMagni = GetResultData().GetWorkingSample().GetSEMDataMsr().GetMagnification();
         }
 
         public int GetTotalFieldsCount()
         {
-            int icount = m_ResultData.GetWorkingSample().GetSEMDataMsr().GetTotalFields();
+            int icount = GetResultData().GetWorkingSample().GetSEMDataMsr().GetTotalFields();
             return icount;
         }
 
@@ -1224,7 +1256,7 @@ namespace OTSMeasureApp
         //Rectangle Srect: 测量区域大小
         public bool GetWSampleMrsArea(ref int iShape, ref Rectangle Srect)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -1252,13 +1284,13 @@ namespace OTSMeasureApp
         //当Samplelist中的链表有sample 的checkbox状态是选中状态,则返回TRUE. 说明可以测量
         public bool GetSampleCheckBoxStatus()
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
             }
             List<COTSSample> SampleList = new List<COTSSample>();
-            SampleList = m_ResultData.GetSampleList();
+            SampleList = GetResultData().GetSampleList();
             int iCount = SampleList.Count();
             if (0 == iCount)
             {
@@ -1279,7 +1311,7 @@ namespace OTSMeasureApp
         //获取BSE图像数据
         public bool GetBSEImageSize(ref int iHeight, ref int iWidth)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -1301,7 +1333,7 @@ namespace OTSMeasureApp
         {
             try
             {
-                COTSSample WSample = m_ResultData.GetWorkingSample();
+                COTSSample WSample = GetResultData().GetWorkingSample();
                 if (null == WSample)
                 {
                     return "";
@@ -1335,7 +1367,7 @@ namespace OTSMeasureApp
         public bool GetMagAndDistance(ref double SemMag, ref double dDistance)
         {
           
-                COTSSample WSample = m_ResultData.GetWorkingSample();
+                COTSSample WSample = GetResultData().GetWorkingSample();
                 if (null == WSample)
                 {
                     return false;
@@ -1362,10 +1394,10 @@ namespace OTSMeasureApp
            
 
             //样品的标题名 (Treeview的根节点名)           
-            SMeasureInfo.sSampleSoluName = m_ResultData.GetFileName();
+            SMeasureInfo.sSampleSoluName = GetResultData().GetFileName();
 
             // Treeview 的样品信息  
-            SMeasureInfo.TSampleParam.sSampleTitleName = m_ResultData.GetFileName();
+            SMeasureInfo.TSampleParam.sSampleTitleName = GetResultData().GetFileName();
 
             //获得 样品属性值
 
@@ -1527,7 +1559,7 @@ namespace OTSMeasureApp
         public bool SaveMeasureSampleInfo()
         {
 
-            if (!m_ResultData.Save())
+            if (!GetResultData().Save())
             {
                 return false;
             }
@@ -1537,7 +1569,7 @@ namespace OTSMeasureApp
         //获取测量Sample的开始时间
         public bool GetMsrSampleStartTime(ref DateTime MsrFieldStartTime)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -1549,7 +1581,7 @@ namespace OTSMeasureApp
         //获取测量已用时间
         public bool GetMsrSampleUsedTime(ref TimeSpan TUsedTime)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -1563,7 +1595,7 @@ namespace OTSMeasureApp
         // 获取测量样品中之前已经测量完成Field帧图,(上一次未测量完成继续测试)
         public bool GetBeforeCompleteField(ref string MsrSampleName, ref List<Point> FieldList)
         {
-            COTSSample WSample = m_ResultData.GetWorkingSample();
+            COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
                 return false;
@@ -1585,14 +1617,14 @@ namespace OTSMeasureApp
         public Rectangle CalculateMsrArea(string cHoleName)
         {
             CHole cHoleClr = null;
-            foreach (CHole item in m_ResultData.GetStage().GetHoleList())
+            foreach (CHole item in GetResultData().GetStage().GetHoleList())
             {
                 if (item.GetName() == cHoleName)
                 {
                     cHoleClr = item;
                 }
             }
-            CDomain CDomain = m_ResultData.CalculateMsrArea(cHoleClr);
+            CDomain CDomain = GetResultData().CalculateMsrArea(cHoleClr);
             return (Rectangle)CDomain.GetRectDomain();
         }
 
@@ -1604,9 +1636,9 @@ namespace OTSMeasureApp
         public bool GetCompletedMeasureFileName(ref List<string> mrFilePathList)
         {
             //测量文件路径
-            string proFilePath = m_ResultData.GetPathName();
+            string proFilePath = GetResultData().GetPathName();
             //样品列表
-            List<COTSSample> sampleList = m_ResultData.GetSampleList();
+            List<COTSSample> sampleList = GetResultData().GetSampleList();
             //获取样品数量
             int sampleCount = sampleList.Count;
             string mrSuffix = ".rst";
@@ -1660,7 +1692,7 @@ namespace OTSMeasureApp
         public bool GetWorkSampleMeasureStatus()
         {
             bool reuslt = false;
-            COTSSample COTSSample = m_ResultData.GetWorkingSample();
+            COTSSample COTSSample = GetResultData().GetWorkingSample();
             int sampleStatus = COTSSample.GetMsrStatus().GetCompletedFields();
             if (sampleStatus > 0)
             {

+ 1 - 1
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSPropertyWindow.cs

@@ -47,7 +47,7 @@ namespace OTSMeasureApp
             m_SampleGrid.ShowSampleInfoGrid(SampleInfo);
 
 
-            int iPropertyDisplayMode = m_MeasureAppForm.m_ProjParam.m_DefaultParam.GetGenParam().PropertyDisplayMode();
+            int iPropertyDisplayMode = m_MeasureAppForm.m_ProjParam.GetDefaultParam().GetGenParam().PropertyDisplayMode();
             if (iPropertyDisplayMode == 1)
             {
                 for (int i = 6; i < PropGrid.Rows.Count(); i++)

+ 4 - 4
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -366,7 +366,7 @@ namespace OTSMeasureApp
                     }
                 }
                 ////绘制已完成的帧图状态
-                COTSMsrPrjResultData cProjMgr = m_MeasureAppForm.m_ProjParam.m_ResultData;
+                COTSMsrPrjResultData cProjMgr = m_MeasureAppForm.m_ProjParam.GetResultData();
                 //当前工作样品的测量区域 获取帧图信息
                 COTSSample cSample = cProjMgr.GetWorkingSample();
                 int CompletedFieldsCount = cSample.GetMsrStatus().GetCompletedFields();
@@ -3641,7 +3641,7 @@ namespace OTSMeasureApp
         {
             Rectangle Srect = new Rectangle();
             List<SampleMeasurePara> sampleMeasureParasList = new List<SampleMeasurePara>();
-            List<COTSSample> cSample = m_MeasureAppForm.m_ProjParam.m_ResultData.GetSampleList();
+            List<COTSSample> cSample = m_MeasureAppForm.m_ProjParam.GetResultData().GetSampleList();
             foreach (var item in cSample)
             {
                 CDomain pMsrArea = new CDomain();
@@ -3733,7 +3733,7 @@ namespace OTSMeasureApp
         }
         public bool GetField(ref List<Point> pFields, ref Size iSzie)
         {
-            var m_ResultData = m_MeasureAppForm.m_ProjParam.m_ResultData;
+            var m_ResultData = m_MeasureAppForm.m_ProjParam.GetResultData();
             
             COTSSample WSample = m_ResultData.GetWorkingSample();
             if (null == WSample)
@@ -3757,7 +3757,7 @@ namespace OTSMeasureApp
             {
                 //获取最小放大倍数与FieldSize100倍数
                 pSEMDataMsr.SetScanFieldSize100(m_OTSSampleStageData.iScanFieldSize100);
-                double dMagnification = m_MeasureAppForm.m_ProjParam.m_DefaultParam.GetStageDataParam().GetMinMag();
+                double dMagnification = m_MeasureAppForm.m_ProjParam.GetDefaultParam().GetStageDataParam().GetMinMag();
                 pSEMDataMsr.SetMagnification(dMagnification);
                 //设置样品孔当前位置信息
                 Rectangle sampleHoleRect = CMeasureThreadWrapper.c_DomainMessure.GetRectDomain();

+ 5 - 5
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -291,7 +291,7 @@ namespace OTSMeasureApp
                 int nDwellTime = 4;
                 try
                 {
-                    int level = (int)m_MeasureAppForm.m_ProjParam.m_ResultData.GetWorkingSample().GetMsrParams().GetImageScanParam().GetScanImageSpeed();
+                    int level = (int)m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample().GetMsrParams().GetImageScanParam().GetScanImageSpeed();
                     switch (level)
                     {
                         case 0:
@@ -1505,7 +1505,7 @@ namespace OTSMeasureApp
                 initResult = cfun.EDSInit();
                 if (initResult)
                 {
-                    COTSMsrPrjResultData cProjMgr = m_MeasureAppForm.m_ProjParam.m_ResultData;
+                    COTSMsrPrjResultData cProjMgr = m_MeasureAppForm.m_ProjParam.GetResultData();
                     //获取工作样品对象
                     COTSSample sampleClr = cProjMgr.GetWorkingSample();
 
@@ -1605,7 +1605,7 @@ namespace OTSMeasureApp
             //获取使用标准库的名称,也许这个也不是很正确??
             string str_stdname = "";
             string str_IncALibName = "";
-            COTSSample cSample = m_MeasureAppForm.m_ProjParam.m_ResultData.GetWorkingSample();
+            COTSSample cSample = m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample();
             if (nInclusionID < 1000)
             {
                 //小于1000,使用系统默认分类
@@ -1921,12 +1921,12 @@ namespace OTSMeasureApp
                 grayEnd = toolWindow.BseGrayMaxValue;
                 //设置去背景参数
                 COTSImageProcParam cOTSImgProc = new COTSImageProcParam();
-                cOTSImgProc = m_MeasureAppForm.m_ProjParam.m_ResultData.GetWorkingSample().GetMsrParams().GetImageProcessParam();
+                cOTSImgProc = m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample().GetMsrParams().GetImageProcessParam();
                 CIntRange cIntRange = new CIntRange();
                 cIntRange.SetStart(grayStart);
                 cIntRange.SetEnd(grayEnd);
                 cOTSImgProc.SetBGGray(cIntRange);
-                m_MeasureAppForm.m_ProjParam.m_ResultData.GetWorkingSample().GetMsrParams().SetImageProcessParam(cOTSImgProc);
+                m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample().GetMsrParams().SetImageProcessParam(cOTSImgProc);
                 //更新属性窗口
                 m_MeasureAppForm.UpdatePropertyVal();
                 //确认后进行去背景

+ 2 - 2
OTSIncAMeasureApp/6-OTSDisplayTreeViewData/OTSSolutionWindow.cs

@@ -449,7 +449,7 @@ namespace OTSMeasureApp
                 if (DialogResult.OK == MessageBox.Show(sDeleteSampleName, "Tip", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
                 {
                     //1.删除样品测量信息
-                    string mPathName = m_MeasureAppForm.m_ProjParam.m_ResultData.GetPathName();
+                    string mPathName = m_MeasureAppForm.m_ProjParam.GetResultData().GetPathName();
                     string smPathName = mPathName.Substring(0, mPathName.LastIndexOf("\\"))+"\\" + m_WorkSampleNode.Text;
                     if (DeleteFile(smPathName))
                     {
@@ -461,7 +461,7 @@ namespace OTSMeasureApp
                             m_TreeViewBase.GetTreeWorkSampleNode(m_WorkSampleName);
                         }
                         //保存测量文件
-                        m_MeasureAppForm.m_ProjParam.m_ResultData.Save();
+                        m_MeasureAppForm.m_ProjParam.GetResultData().Save();
                         //重新打开文件
 
                     }

+ 6 - 6
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -133,7 +133,7 @@ namespace OTSMeasureApp
 
             //和DataMgr进行数据交互类
             m_ProjParam = new COTSMeasureParam(this);
-            m_ProjData = m_ProjParam.m_ResultData;
+            m_ProjData = m_ProjParam.GetResultData();
             //初始化Ribbon类,操作Ribbon按钮的可用或者不可用
             m_RibbonFun = new OTSRibbonFun(this);
 
@@ -149,7 +149,7 @@ namespace OTSMeasureApp
         {
             if (e.Name == "SpecialGrayConfig.xml")
             {
-                m_ProjParam.m_specialRanges.IsInited = false;
+                m_ProjParam.SpecialRanges.IsInited = false;
                 foreach (var s in this.m_ProjData.GetSampleList())
                 {
                     s.GetMsrParams().GetSpecialGrayRangeParam().IsInited = false;
@@ -179,11 +179,11 @@ namespace OTSMeasureApp
                         m_SamplepaceWindow.InitStageDisplay(m_ProjData.GetStage(),m_ProjData.GetSEMStageData());
 
                         //添加启动系统界面显示
-                        if (m_ProjParam.m_DefaultParam.m_nPackId == OTS_SysType_ID.IncA)
+                        if (m_ProjParam.GetDefaultParam().m_nPackId == OTS_SysType_ID.IncA)
                         {
                             this.Text += "(Inclusion)";
                         }
-                        else if (m_ProjParam.m_DefaultParam.m_nPackId == OTS_SysType_ID.CleannessA)
+                        else if (m_ProjParam.GetDefaultParam().m_nPackId == OTS_SysType_ID.CleannessA)
                         {
                             this.Text += "(Cleanness)";
                         }
@@ -565,7 +565,7 @@ namespace OTSMeasureApp
 
             //获取工作样品
             OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
-            if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.m_ResultData.GetWorkingSample(), ref SMInfo))
+            if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetResultData().GetWorkingSample(), ref SMInfo))
             {
                 log.Error("(OTSIncAMeasureAppForm.OpenExistSampleFile)  m_DataMgrFun.GetSamplePropertyVal(m_DataMgrFun.GetWorkSample(), ref SMInfo) = false Failed !");
                 return false;
@@ -1232,7 +1232,7 @@ namespace OTSMeasureApp
             
             if (ProjDataMgr.Load())
             {
-                m_ProjParam.m_ResultData = ProjDataMgr;
+                m_ProjParam.SetResultData(ProjDataMgr);
                 m_ProjParam.InitResultData();
                 m_ProjData = ProjDataMgr;
                 bOpenFlag = true;

+ 2 - 0
OTSIncAMeasureApp/ServiceCenter/SemController.cs

@@ -133,6 +133,7 @@ namespace OTSModelSharp.ServiceInterface
                 return false;
             }
             //hw.SetMagnification(a_dMagnification);
+            NLog.LogManager.GetCurrentClassLogger().Warn("Set magnification:" + a_dMagnification.ToString("F2"));
             hw.SetSemMagnification(a_dMagnification);
             return true;
         }
@@ -153,6 +154,7 @@ namespace OTSModelSharp.ServiceInterface
             {
                 return false;
             }
+            NLog.LogManager.GetCurrentClassLogger().Warn("Set WorkingDistance:" + a_distance.ToString("F2"));
             return hw.SetSemWorkingDistance(a_distance);
         }