|  | @@ -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
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |