Bläddra i källkod

add param and debug measure file

HaoShuang 5 år sedan
förälder
incheckning
acc5f20649

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 173 - 169
HOZProject/FormUnitControl.Designer.cs


+ 7 - 0
HOZProject/FormUnitControl.cs

@@ -1256,5 +1256,12 @@ namespace HOZProject
         {
             iSEM.ImageFrozen();
         }
+
+        //测量线程测试
+        private void button1_Click(object sender, EventArgs e)
+        {
+            FormMeasureTest Measure = new FormMeasureTest();
+            Measure.Show();
+        }
     }
 }

+ 2 - 1
HOZProject/Program.cs

@@ -17,7 +17,8 @@ namespace HOZProject
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             //Application.Run(new FormUCMain());
-            Application.Run(new FormUnitControl());
+            //Application.Run(new FormUnitControl());
+            Application.Run(new FormMeasureTest());
         }
     }
 }

+ 9 - 0
HOZProject/UnitControl.csproj

@@ -65,8 +65,17 @@
     <Compile Include="FormUnitControl.Designer.cs">
       <DependentUpon>FormUnitControl.cs</DependentUpon>
     </Compile>
+    <Compile Include="FormMeasureTest.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FormMeasureTest.Designer.cs">
+      <DependentUpon>FormMeasureTest.cs</DependentUpon>
+    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="FormMeasureTest.resx">
+      <DependentUpon>FormMeasureTest.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FormShowImage.resx">
       <DependentUpon>FormShowImage.cs</DependentUpon>
     </EmbeddedResource>

+ 11 - 12
MeasureData/CutHole.cs

@@ -49,8 +49,19 @@ namespace MeasureData
             get { return this.m_HoleName; }
             set { this.m_HoleName = value; }
         }
+        #endregion       
+
+        #region 坐标位置
+        private SemPosition m_Position;
+
+        public SemPosition Position
+        {
+            get { return this.m_Position; }
+            set { this.m_Position = value; }
+        }
         #endregion
 
+        #region 工作条件
         #region 样品名
         /// <summary>
         /// 样品名
@@ -64,18 +75,6 @@ namespace MeasureData
         }
         #endregion
 
-        #region 坐标位置
-        private SemPosition m_Position;
-
-        public SemPosition Position
-        {
-            get { return this.m_Position; }
-            set { this.m_Position = value; }
-        }
-        #endregion
-
-        #region 工作条件
-
         //是否有pt工序
         private Boolean m_pt;
 

+ 1 - 0
MeasureData/MeasureData.csproj

@@ -48,6 +48,7 @@
   <ItemGroup>
     <Compile Include="CutHole.cs" />
     <Compile Include="MeasureFile.cs" />
+    <Compile Include="MeasureParam.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ResultFile.cs" />
     <Compile Include="SemPosition.cs" />

+ 343 - 17
MeasureData/MeasureFile.cs

@@ -10,6 +10,7 @@ using System.Threading.Tasks;
 using FileManager;
 using System.Xml;
 using System.IO;
+//using System.Windows.Forms.dll;
 
 namespace MeasureData
 {
@@ -21,7 +22,6 @@ namespace MeasureData
         #region 内容
         //文件名
         private string m_fileName;
-
         public string FileName
         {
             get { return this.m_fileName; }
@@ -30,7 +30,6 @@ namespace MeasureData
 
         //文件路径
         private string m_filepath;
-
         public string FilePath
         {
             get { return this.m_filepath; }
@@ -39,13 +38,20 @@ namespace MeasureData
 
         //切孔链表
         private List<CutHole> m_listCutHole;
-
         public List<CutHole> ListCutHole
         {
             get { return this.m_listCutHole; }
             set { this.m_listCutHole = value; }
         }
 
+        //测量参数
+        private MeasureParam m_measureParam;
+        public MeasureParam MParam
+        {
+            get { return this.m_measureParam; }
+            set { this.m_measureParam = value; }
+        }
+        #endregion
         /// <summary>
         /// 创建XML文件
         /// </summary>
@@ -111,8 +117,7 @@ namespace MeasureData
 
             }
         }
-        #endregion
-
+       
         //构造函数
         public MeasureFile()
         {
@@ -122,26 +127,32 @@ namespace MeasureData
         public void Init()
         {
             this.ListCutHole = new List<CutHole>();
+            this.FileName = @"";
+            this.FilePath = @"";
+            this.MParam = new MeasureParam();
         }
         #region 操作
 
-
-
         //新建
-        public void New()
+        public bool New()
         {
-            int ret = CreateXml();
-            if(ret>0)
-            {
-                XmlDocument doc = new XmlDocument();
-                doc.Load(this.FilePath + "\\" + this.FileName);//载入xml文件
+            //int ret = CreateXml();
+            //if(ret>0)
+            //{
+            //    XmlDocument doc = new XmlDocument();
+            //    doc.Load(this.FilePath + "\\" + this.FileName);//载入xml文件
 
-                XmlNode root = doc.SelectSingleNode("XMLData");
+            //    XmlNode root = doc.SelectSingleNode("XMLData");
 
-                Serialize(true, doc, root);
+            //    Serialize(true, doc, root);
 
-                doc.Save(this.FilePath + "\\" + this.FileName);
-            }
+            //    doc.Save(this.FilePath + "\\" + this.FileName);
+            //}
+
+            // 设置路径为初始默认路径
+            FilePath = UNTITLED_FILE_NAME;
+            // Ok, return TRUE
+            return true;
         }
 
         //打开
@@ -160,6 +171,321 @@ namespace MeasureData
         {
         }
 
+        //从文件生成切割孔信息
+        public void GetCutHolesFromFile(string a_FilePathName)
+        {
+            //弹出打开txt文件的对话矿
+            a_FilePathName.Trim();
+            if (string.IsNullOrEmpty(a_FilePathName))
+            {
+                ////新建一个文件对话框
+                //OpenFileDialog pOpenFileDialog = new OpenFileDialog();
+
+                ////设置对话框标题
+                //pOpenFileDialog.Title = "打开shp文件";
+
+                ////设置打开文件类型
+                //pOpenFileDialog.Filter = "Shape文件(*.shp)|*.shp";
+
+                ////监测文件是否存在
+                //pOpenFileDialog.CheckFileExists = true;
+
+                ////文件打开后执行以下程序
+                //if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
+                //{
+                //    System.IO.Path.GetFullPath(openFileDialog1.FileName);                             //绝对路径
+                //    System.IO.Path.GetExtension(openFileDialog1.FileName);                           //文件扩展名
+                //    System.IO.Path.GetFileNameWithoutExtension(openFileDialog1.FileName);//文件名没有扩展
+                //    名
+                //    System.IO.Path.GetFileName(openFileDialog1.FileName);                          //得到文件
+                //    System.IO.Path.GetDirectoryName(openFileDialog1.FileName);                  //得到路径
+                //}
+            }
+            //按行取出txt文件
+            //解析切孔生成带有位置的切孔
+
+            //// check file pathname
+            //a_strFilePathName.Trim();
+            //if (a_strFilePathName.IsEmpty())
+            //{
+            //    // open file dialog
+            //    CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST, TEXTFILE_FILTER);
+            //    CString strDlgTitle = _T("");
+            //    strDlgTitle.LoadString(IDS_OPEN_STAGE_FILE);
+            //    dlg.m_ofn.lpstrTitle = strDlgTitle;
+            //    if (dlg.DoModal() != IDOK)
+            //    {
+            //        // user didn't click OK button, return FALSE
+            //        LogTrace(__FILE__, __LINE__, _T("LoadStageFromTextFile: user canceled on file open dialog."));
+            //        return FALSE;
+            //    }
+            //    else
+            //    {
+            //        a_strFilePathName = dlg.GetPathName();
+            //    }
+            //}
+
+            //// load string lines from the file
+            //std::vector<CString> listLineStr = COTSHelper::LoadTextFileToCStingList(a_strFilePathName);
+
+            //// get stage components
+            //// stage name
+            //CString strName = _T("");
+            //// coordinate system
+            //COORDINATE_SYSTEM_SETTING nCoodrSysSetting = COORDINATE_SYSTEM_SETTING::INVALID;
+            //// boundary
+            //CDomainPtr pBoundary = nullptr;
+            //// STD
+            //CDomainPtr pSTD = nullptr;
+            //// Ferrari
+            //CDomainPtr pFerrari = nullptr;
+            //// Holes list
+            //CHolesList listHoles;
+            //for (auto strLine : listLineStr)
+            //{
+            //    // split the string line with ":"
+            //    std::vector<CString> listStr = COTSHelper::SplitString(strLine, FILE_TITLE_SPLIT);
+
+            //    // jump over the string if it is invalid
+            //    // it should have a title string and value string
+            //    if ((int)listStr.size() != TEXTFILE_ITEM_COLUMN_NUMBER)
+            //    {
+            //        continue;
+            //    }
+            //    CString strTitle = listStr[0];
+            //    CString strValue = listStr[1];
+
+            //    // get stage component
+            //    for (int i = (int)STAGE_ITEMS::MIN; i <= (int)STAGE_ITEMS::MAX; ++i)
+            //    {
+            //        // match title?
+            //        CString strFileItemTitle;
+            //        strFileItemTitle.LoadString(IDS_STAGE_FILE_TITLE_FIRST + i);
+            //        if (strTitle.CompareNoCase(strFileItemTitle) == 0)
+            //        {
+            //            // found a stage item
+            //            switch ((STAGE_ITEMS)i)
+            //            {
+            //                case STAGE_ITEMS::NAME:
+            //                    {
+            //                        // jump over if name is set
+            //                        if (strName.IsEmpty())
+            //                        {
+            //                            // jump over if value string is empty
+            //                            strValue.Trim();
+            //                            if (!strValue.IsEmpty())
+            //                            {
+            //                                strName = strValue;
+            //                            }
+            //                        }
+            //                    }
+            //                    break;
+
+            //                case STAGE_ITEMS::COORDINATE_SYSTEM:
+            //                    {
+            //                        // jump over if coordinate system setting is set
+            //                        if (nCoodrSysSetting == COORDINATE_SYSTEM_SETTING::INVALID)
+            //                        {
+            //                            // jump over if value string is empty
+            //                            strValue.Trim();
+            //                            if (!strValue.IsEmpty())
+            //                            {
+            //                                // string to int
+            //                                int nValue;
+            //                                if (COTSHelper::StringToInt(strValue, nValue))
+            //                                {
+            //                                    // validation
+            //                                    if (nValue >= (int)COORDINATE_SYSTEM_SETTING::MIN && nValue <= (int)COORDINATE_SYSTEM_SETTING::MAX)
+            //                                    {
+            //                                        nCoodrSysSetting = (COORDINATE_SYSTEM_SETTING)nValue;
+            //                                    }
+            //                                }
+            //                            }
+
+            //                        }
+            //                    }
+            //                    break;
+
+            //                case STAGE_ITEMS::BOUNDARY:
+            //                    {
+            //                        // jump over if boundary is set
+            //                        if (pBoundary == nullptr)
+            //                        {
+            //                            // get boundary
+            //                            CDomainPtr pDomain = GetDomain(strValue);
+            //                            if (pDomain != nullptr)
+            //                            {
+            //                                pBoundary = pDomain;
+            //                            }
+            //                        }
+            //                    }
+            //                    break;
+
+            //                case STAGE_ITEMS::STD:
+            //                    {
+            //                        // jump over if STD is set
+            //                        if (pSTD == nullptr)
+            //                        {
+            //                            // get STD
+            //                            CDomainPtr pDomain = GetDomain(strValue);
+            //                            if (pDomain != nullptr)
+            //                            {
+            //                                pSTD = pDomain;
+            //                            }
+            //                        }
+            //                    }
+            //                    break;
+
+            //                case STAGE_ITEMS::FERRARI:
+            //                    {
+            //                        // jump over if pFerrari is set
+            //                        if (pFerrari == nullptr)
+            //                        {
+            //                            // get STD
+            //                            CDomainPtr pDomain = GetDomain(strValue);
+            //                            if (pDomain != nullptr)
+            //                            {
+            //                                pFerrari = pDomain;
+            //                            }
+            //                        }
+            //                    }
+            //                    break;
+
+            //                case STAGE_ITEMS::HOLE:
+            //                    {
+            //                        // try to get a sample hole with the value string
+            //                        CHolePtr pHole = GetHole(strValue);
+            //                        if (pHole != nullptr)
+            //                        {
+            //                            listHoles.push_back(pHole);
+            //                        }
+            //                    }
+            //                    break;
+            //            }
+
+            //            // get out the for loop
+            //            break;
+            //        }
+            //    }
+            //}
+
+            //// check stage components
+            //// name should be ok
+            //if (pBoundary == nullptr)
+            //{
+            //    return FALSE;
+            //}
+            //if (pBoundary->IsInvalid())
+            //{
+            //    // boundary is invalid
+            //    return FALSE;
+            //}
+            //if (pSTD != nullptr)
+            //{
+            //    // STD has to be inside of the boundary
+            //    if (!pBoundary->DomainInDomain(*(pSTD.get())))
+            //    {
+            //        // STD is over the boundary
+            //        return FALSE;
+            //    }
+            //}
+            //else
+            //{
+            //    LogErrorTrace(__FILE__, __LINE__, _T("LoadStageFromTextFile: empty STD domain pointer."));
+            //    return FALSE;
+            //}
+
+            //if (pFerrari != nullptr)
+            //{
+            //    // Ferrari has to be inside of the boundary
+            //    if (!pBoundary->DomainInDomain(*(pFerrari.get())))
+            //    {
+            //        // Ferrari is over the boundary
+            //        return FALSE;
+            //    }
+            //    else if (pSTD->IntersectDomain(*(pFerrari.get())))
+            //    {
+            //        // Ferrari has common part with STD
+            //        return FALSE;
+            //    }
+            //}
+            //else
+            //{
+            //    LogErrorTrace(__FILE__, __LINE__, _T("LoadStageFromTextFile: empty Ferrari domain pointer."));
+            //    return FALSE;
+            //}
+
+
+            //// hole has to be inside of the boundary and can't have common part with STD and each other
+            //CHolesList listStageHoles;
+            //for (auto pHole : listHoles)
+            //{
+            //    if (!pBoundary->DomainInDomain(*(pHole.get())))
+            //    {
+            //        // this hole is over the boundary, jump over
+            //        continue;
+            //    }
+            //    else if (pSTD->IntersectDomain(*(pHole.get())))
+            //    {
+            //        // this hole has common part with STD, jump over
+            //        continue;
+            //    }
+            //    else if (pFerrari->IntersectDomain(*(pHole.get())))
+            //    {
+            //        // this hole has common part with Ferrari, jump over
+            //        continue;
+            //    }
+
+            //    BOOL bHasCommonPart = FALSE;
+            //    for (auto pStageHole : listStageHoles)
+            //    {
+            //        if (pStageHole->IntersectDomain(*(pHole.get())))
+            //        {
+            //            // this hole has common part with a hole already on the stage
+            //            bHasCommonPart = TRUE;
+            //            break;
+            //        }
+            //    }
+            //    if (bHasCommonPart)
+            //    {
+            //        // this hole has common part with a hole already on the stage, jump over
+            //        continue;
+            //    }
+
+            //    // the hole is ok, add it into stage holes list
+            //    listStageHoles.push_back(pHole);
+            //}
+            //if (listStageHoles.size() == 0)
+            //{
+            //    // no hole at all
+            //    return FALSE;
+            //}
+
+            //// the stage is in SEM coordinate system, convert all components to OTS system 
+            //if (nCoodrSysSetting == COORDINATE_SYSTEM_SETTING::SEM)
+            //{
+            //    if (!ConverSEMToOTSSystem(pBoundary, pSTD, listStageHoles))
+            //    {
+            //        return FALSE;
+            //    }
+            //}
+
+            //// create stage
+            //CStagePtr pStage(new CStage());
+
+            //// set stage components
+            //pStage->SetName(strName);
+            //pStage->SetBoundary(pBoundary);
+            //pStage->SetSTD(pSTD);
+            //pStage->SetFerrari(pFerrari);
+            //pStage->SetHoleList(listStageHoles);
+
+            //// add the stage into stages list
+            //m_listStages.push_back(pStage);
+
+            //// ok, return TRUE
+            //return TRUE;
+        }
         #endregion
     }
 }

+ 104 - 0
MeasureData/MeasureParam.cs

@@ -0,0 +1,104 @@
+//时间:20200618
+//作者:郝爽
+//功能:测量参数
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using FileManager;
+using System.Xml;
+using System.IO;
+
+namespace MeasureData
+{
+    public class MeasureParam : ISlo
+    {
+        #region 内容
+        //工作条件,一次测量的全部切孔都是一类的
+
+        // 样品名
+        private string m_SampleName;
+        public string SampleName
+        {
+            get { return this.m_SampleName; }
+            set { this.m_SampleName = value; }
+        }
+
+        //是否有pt工序
+        private Boolean m_pt;
+        public Boolean PT
+        {
+            get { return this.m_pt; }
+            set { this.m_pt = value; }
+        }
+
+        //FIB工作模板
+        private string m_fibTemp;
+        public string FIBTemp
+        {
+            get { return this.m_fibTemp; }
+            set { this.m_fibTemp = value; }
+        }
+
+        //PT工作模板,这个暂时不使用,FIB和PT是一个模板
+        private string m_ptTemp;
+        public string PTTemp
+        {
+            get { return this.m_ptTemp; }
+            set { this.m_ptTemp = value; }
+        }
+        #endregion
+
+        //构造函数
+        public MeasureParam()
+        {
+            Init();
+        }
+
+        public void Init()
+        {
+            this.SampleName = @"";
+            this.PT = false;
+            this.FIBTemp = @"";
+            this.PTTemp = @"";
+        }
+
+        //XML文件保存测量参数
+        public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
+        {
+            Slo<MeasureParam> slo_msparam = new Slo<MeasureParam>();
+
+            xString sampleName = new xString();
+            xBool pt = new xBool();
+            xString FIBtemp = new xString();
+            xString PTtemp = new xString();
+
+            sampleName.AssignValue(this.SampleName);
+            pt.AssignValue(this.PT);
+            FIBtemp.AssignValue(this.FIBTemp);
+            PTtemp.AssignValue(this.PTTemp);
+
+            slo_msparam.Register("SampleName", sampleName);
+            slo_msparam.Register("PT", pt);
+            slo_msparam.Register("FIBTemp", FIBtemp);
+            slo_msparam.Register("PTTemp", PTtemp);
+
+            if (isStoring)
+            {
+                slo_msparam.Serialize(true, xml, rootNode);
+            }
+            else
+            {
+                slo_msparam.Serialize(false, xml, rootNode);
+
+                this.SampleName = sampleName.value();
+                this.PT = pt.value();
+                this.FIBTemp = FIBtemp.value();
+                this.PTTemp = PTtemp.value();
+            }
+        }
+
+    }
+}

+ 1 - 6
MeasureData/SemPosition.cs

@@ -146,12 +146,7 @@ namespace MeasureData
             m_t = 0;
             m_m = 0;
         }
-
-        //从文件中加载位置信息
-        public void GetPtsFromFile(string fileName)
-        {
-
-        }
+          
 
         public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
         {

Vissa filer visades inte eftersom för många filer har ändrats