public bool SetParam(CFigureManager fm) { uc_view_ptrn.VIEW_Set_Clear_DispObject(); m_fm = fm; // Set language type m_speaker.LANGUAGE = fm.LANGUAGE; // load ptrn setting PARAM_PTRN param_ptrn = fm.param_ptrn; // Check current ptrn teaching file string strPtrnPath = Path.GetFileName(param_ptrn.PTRN_FILE); /*****/ strPtrnPath = Path.Combine(m_fm.param_path.i06_PATH_IMG_PTRN, strPtrnPath); // check the status in case of empty ptrn teaching data info. if (m_speaker.Check_Ptrn_Is_Error_Teaching_File_Validity(strPtrnPath) == true) { return(false); } //************************************************************************************* // Set Draw Ptrn Image if (m_speaker.Check_Is_Error_File_Path_Validity(strPtrnPath) == false) { Bitmap bmpTemp = Bitmap.FromFile(strPtrnPath) as Bitmap; PIC_PTRN_NORMAL.Image = new Bitmap(bmpTemp); PIC_PTRN_EDGE.Image = _Ptrn_Preprocess_Edge(bmpTemp); bmpTemp.Dispose(); } else { param_ptrn.PTRN_FILE = string.Empty; } //************************************************************************************* // Display parameter TXT_PTRN_FILE_NAME.Text = param_ptrn.PTRN_FILE; TXT_PTRN_ACC_RATIO.Text = param_ptrn.ACC_RATIO.ToString("F4"); CHK_PTRN_APPLY_EDGE_BASED.Checked = param_ptrn.BOOL_EDGE_BASED; CHK_PTRN_SEARCH_GLOBAL.Checked = param_ptrn.BOOL_GLOBAL_SEARCHING; CControl.SetTextBoxFrom_RectangleF(param_ptrn.RC_SEARCH_RGN, TXT_LOCAL_SEARCH_RGN_X, TXT_LOCAL_SEARCH_RGN_Y, TXT_LOCAL_SEARCH_RGN_W, TXT_LOCAL_SEARCH_RGN_H); CControl.SetTextBoxFrom_RectangleF(param_ptrn.RC_TEMPLATE, TXT_PTRN_TEACH_ROI_X, TXT_PTRN_TEACH_ROI_Y, TXT_PTRN_TEACH_ROI_W, TXT_PTRN_TEACH_ROI_H); // set image on the view BTN_SET_INTERNAL_IMAGE_Click(null, EventArgs.Empty); // update ptrn file list BTN_UPDATE_PTRN_LIST_Click(null, EventArgs.Empty); // draw searcing region if (param_ptrn.BOOL_GLOBAL_SEARCHING == false && param_ptrn.RC_SEARCH_RGN.Width != 0 && param_ptrn.RC_SEARCH_RGN.Height != 0) { uc_view_ptrn.DrawRect(param_ptrn.RC_SEARCH_RGN, Color.Orange); } return(true); }
private void BTN_PTRN_APPLY_Click(object sender, EventArgs e) { PARAM_PTRN ptrn = new PARAM_PTRN(); ptrn.BOOL_EDGE_BASED /*********/ = CHK_PTRN_APPLY_EDGE_BASED.Checked; ptrn.BOOL_GLOBAL_SEARCHING /***/ = CHK_PTRN_SEARCH_GLOBAL.Checked; //************************************************************************************* // Makesure Teaching File Existance string strCurrentPtrnFile = TXT_PTRN_FILE_NAME.Text; /*****/ strCurrentPtrnFile = Path.Combine(m_fm.param_path.i06_PATH_IMG_PTRN, strCurrentPtrnFile); // path verification if (m_speaker.Check_Is_Error_File_Path_Validity(strCurrentPtrnFile) == true) { return; } ptrn.PTRN_FILE /***************/ = Path.GetFileName(strCurrentPtrnFile); //************************************************************************************* // Set Template Teaching Region and Verification RectangleF rcTeaching = CControl.GetRectangleFrom_TextBox_Set(TXT_PTRN_TEACH_ROI_X, TXT_PTRN_TEACH_ROI_Y, TXT_PTRN_TEACH_ROI_W, TXT_PTRN_TEACH_ROI_H); if (m_speaker.Check_Is_Invalid_Figure(rcTeaching, uc_view_ptrn.VIEW_GetImageW(), uc_view_ptrn.VIEW_GetImageH()) == true) { return; } ptrn.RC_TEMPLATE = rcTeaching; //************************************************************************************* // Set Searching Region if (CHK_PTRN_SEARCH_GLOBAL.Checked == false) { ptrn.RC_SEARCH_RGN = CControl.GetRectangleFrom_TextBox_Set(TXT_LOCAL_SEARCH_RGN_X, TXT_LOCAL_SEARCH_RGN_Y, TXT_LOCAL_SEARCH_RGN_W, TXT_LOCAL_SEARCH_RGN_H); } else if (CHK_PTRN_SEARCH_GLOBAL.Checked == true) { ptrn.RC_SEARCH_RGN = new RectangleF(0, 0, uc_view_ptrn.VIEW_GetImageW(), uc_view_ptrn.VIEW_GetImageH()); } //************************************************************************************* // Set Acceptance Ration and Verification double fACCR = CControl.GetDoubleFrom_TextBox(TXT_PTRN_ACC_RATIO); if (m_speaker.Check_Ptrn_Is_Error_Acceptance_ratio(fACCR) == true) { return; } ptrn.ACC_RATIO = fACCR; //************************************************************************************* eventDele_ApplyParamPtrn(ptrn); this.Hide(); }