private void btn_ok_Click(object sender, EventArgs e) { #region 输出路径 if (this.txt_WatertableOutpath.Text.Equals("")) { MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_ok.Enabled = false; #region 界面参数获取 string sWatertableOutpath = this.txt_WatertableOutpath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 //string sIDLSavPath = Application.StartupPath; ; //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin")); string sIDLSavPath = FileManage.getApplicatonPath(); string sIDLSavPath_pro = sIDLSavPath + "IDLSav\\main_water_buildtable.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("watertableoutpath", sWatertableOutpath); //编译IDL功能源码 string sIDLSavPath_sav = sIDLSavPath + "IDLSav\\prosail_idl.sav"; oCom.ExecuteString("restore,\'" + sIDLSavPath_sav + "\'"); oCom.ExecuteString(".compile '" + sIDLSavPath_pro + "'"); oCom.ExecuteString("main_water_buildtable,watertableoutpath=watertableoutpath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //MessageBox.Show(objArr.ToString()); if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("查找表建立完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_ok.Enabled = true; this.btn_OpenOutPutpath.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion }
private void btn_OK_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 if (this.textBox_NdsiPath.Text.Equals("")) { MessageBox.Show("请选择输入NDSI图像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.textBox_OutPutPath.Text.Equals("")) { MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_Ok.Enabled = false; #region 界面参数获取 // NDSI图像 List<string> List_NDSI = new List<string>(); foreach (ListViewItem item in this.listView_NDSI.Items) { string s = this.textBox_NdsiPath.Text + "\\" + item.SubItems[0].Text.Trim(); List_NDSI.Add(s); } string[] sFilename_NDSI = (string[])List_NDSI.ToArray(); //输出路径 string sFilename_Output = this.textBox_OutPutPath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 string sIDLSavPath = FileManage.getApplicatonPath(); sIDLSavPath = sIDLSavPath + "IDLSav\\threshold_method.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("FilenameNDSI", sFilename_NDSI); oCom.SetIDLVariable("OutPutPath", sFilename_Output); //编译IDL功能源码 oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'"); oCom.ExecuteString("threshold_method,FilenameNDSI,OutPutPath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //返回错误消息 if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_Ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("计算完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_Ok.Enabled = true; this.btn_OpenOutPutPath.Visible = true; } catch (Exception ex) { // MessageBox.Show(ex.Message); } #endregion }
private void btn_OK_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 if (this.TextBox_AssImg.Text.Equals("")) { MessageBox.Show("请选择输入待评价影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.TextBox_RefImg.Text.Equals("")) { MessageBox.Show("请选择输入参考影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.TextBox_OutputPath.Text.Equals("")) { MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listView_Ass.Items.Count != this.listView_Ref.Items.Count) { MessageBox.Show("输入的待评价影像和参考影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!this.cbx_SpecAve_1.Checked && !this.cbx_SpecStd_2.Checked && !this.cbx_SpecERGAS_3.Checked && !this.cbx_SpecD_4.Checked && !this.cbx_SpecAngMap_5.Checked && !this.cbx_CCSpec_6.Checked && !this.cbx_SpatAve_7.Checked && !this.cbx_SpatStd_8.Checked && !this.cbx_AveGra_9.Checked && !this.cbx_CCSpat_10.Checked && !this.cbx_SpatERGAS_11.Checked) { MessageBox.Show("请至少选择一项评价指标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_OK.Enabled = false; #region 界面参数获取 //待评价影像 List <string> list_Ass = new List <string>(); foreach (ListViewItem item in this.listView_Ass.Items) { string s = this.TextBox_AssImg.Text + "\\" + item.SubItems[0].Text.Trim(); list_Ass.Add(s); } string[] sFilename_Ass = (string[])list_Ass.ToArray(); sGlobal_Filename_Ass = sFilename_Ass; //参考影像 List <string> list_Ref = new List <string>(); foreach (ListViewItem item in this.listView_Ref.Items) { string s = this.TextBox_RefImg.Text + "\\" + item.SubItems[0].Text.Trim(); list_Ref.Add(s); } string[] sFilename_Ref = (string[])list_Ref.ToArray(); //输出路径 string sFilename_Output = this.TextBox_OutputPath.Text.Trim(); sGlobal_OutDir = sFilename_Output; //何种质量 string sQuaKind = this.combx_Qua.SelectedValue.ToString(); string sQuaKindEn; if (sQuaKind == "光谱质量") { sQuaKindEn = "SpecQua"; } else { sQuaKindEn = "SpatQua"; } sGlobal_QuaKindEn = sQuaKindEn; //评价指标 string[] sQuaArr = new string[] { "", "", "", "", "", "", "", "", "", "", "" }; if (this.cbx_SpecAve_1.Checked) { sQuaArr[0] = "TRUE"; } if (this.cbx_SpecStd_2.Checked) { sQuaArr[1] = "TRUE"; } if (this.cbx_SpecERGAS_3.Checked) { sQuaArr[2] = "TRUE"; } if (this.cbx_SpecD_4.Checked) { sQuaArr[3] = "TRUE"; } if (this.cbx_SpecAngMap_5.Checked) { sQuaArr[4] = "TRUE"; } if (this.cbx_CCSpec_6.Checked) { sQuaArr[5] = "TRUE"; } if (this.cbx_SpatAve_7.Checked) { sQuaArr[6] = "TRUE"; } if (this.cbx_SpatStd_8.Checked) { sQuaArr[7] = "TRUE"; } if (this.cbx_AveGra_9.Checked) { sQuaArr[8] = "TRUE"; } if (this.cbx_CCSpat_10.Checked) { sQuaArr[9] = "TRUE"; } if (this.cbx_SpatERGAS_11.Checked) { sQuaArr[10] = "TRUE"; } #endregion #region 调用IDL程序 //IDLSav的路径 string sIDLSavPath = FileManage.getApplicatonPath(); sIDLSavPath = sIDLSavPath + "IDLSav\\SpecFusionAss.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("FilenameAss", sFilename_Ass); oCom.SetIDLVariable("FilenameRef", sFilename_Ref); oCom.SetIDLVariable("OutputPath", sFilename_Output); oCom.SetIDLVariable("QuaKind", sQuaKindEn); oCom.SetIDLVariable("QuaArr", sQuaArr); //编译idl功能源码 oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'"); //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'"); oCom.ExecuteString("SpecFusionAss,FilenameAss,FilenameRef,OutputPath,QuaKind,QuaArr,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //返回错误消息 if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_OK.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("光谱融合质量评价完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_OK.Enabled = true; this.btn_OpenOutputPath.Visible = true; QuaAssShowForm vSpecQuaAssShowForm = new QuaAssShowForm(this); vSpecQuaAssShowForm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion this.btn_OK.Enabled = true; }
private void btn_OK_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 if (this.TextBox_AssImg.Text.Equals("")) { MessageBox.Show("请选择输入待评价影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.TextBox_RefImg.Text.Equals("")) { MessageBox.Show("请选择输入参考影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.TextBox_OutputPath.Text.Equals("")) { MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listView_Ass.Items.Count != this.listView_Ref.Items.Count) { MessageBox.Show("输入的待评价影像和参考影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!this.cbx_SpecAve_1.Checked && !this.cbx_SpecStd_2.Checked && !this.cbx_SpecERGAS_3.Checked && !this.cbx_SpecD_4.Checked && !this.cbx_SpecAngMap_5.Checked && !this.cbx_CCSpec_6.Checked && !this.cbx_SpatAve_7.Checked && !this.cbx_SpatStd_8.Checked && !this.cbx_AveGra_9.Checked && !this.cbx_CCSpat_10.Checked && !this.cbx_SpatERGAS_11.Checked) { MessageBox.Show("请至少选择一项评价指标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_OK.Enabled = false; #region 界面参数获取 //待评价影像 List<string> list_Ass = new List<string>(); foreach (ListViewItem item in this.listView_Ass.Items) { string s = this.TextBox_AssImg.Text + "\\" + item.SubItems[0].Text.Trim(); list_Ass.Add(s); } string[] sFilename_Ass = (string[])list_Ass.ToArray(); sGlobal_Filename_Ass = sFilename_Ass; //参考影像 List<string> list_Ref = new List<string>(); foreach (ListViewItem item in this.listView_Ref.Items) { string s = this.TextBox_RefImg.Text + "\\" + item.SubItems[0].Text.Trim(); list_Ref.Add(s); } string[] sFilename_Ref = (string[])list_Ref.ToArray(); //输出路径 string sFilename_Output = this.TextBox_OutputPath.Text.Trim(); sGlobal_OutDir = sFilename_Output; //何种质量 string sQuaKind = this.combx_Qua.SelectedValue.ToString(); string sQuaKindEn; if (sQuaKind == "光谱质量") { sQuaKindEn = "SpecQua"; } else { sQuaKindEn = "SpatQua"; } sGlobal_QuaKindEn = sQuaKindEn; //评价指标 string[] sQuaArr = new string[] { "", "", "", "", "", "", "", "", "", "", "" }; if (this.cbx_SpecAve_1.Checked) { sQuaArr[0] = "TRUE"; } if (this.cbx_SpecStd_2.Checked) { sQuaArr[1] = "TRUE"; } if (this.cbx_SpecERGAS_3.Checked) { sQuaArr[2] = "TRUE"; } if (this.cbx_SpecD_4.Checked) { sQuaArr[3] = "TRUE"; } if (this.cbx_SpecAngMap_5.Checked) { sQuaArr[4] = "TRUE"; } if (this.cbx_CCSpec_6.Checked) { sQuaArr[5] = "TRUE"; } if (this.cbx_SpatAve_7.Checked) { sQuaArr[6] = "TRUE"; } if (this.cbx_SpatStd_8.Checked) { sQuaArr[7] = "TRUE"; } if (this.cbx_AveGra_9.Checked) { sQuaArr[8] = "TRUE"; } if (this.cbx_CCSpat_10.Checked) { sQuaArr[9] = "TRUE"; } if (this.cbx_SpatERGAS_11.Checked) { sQuaArr[10] = "TRUE"; } #endregion #region 调用IDL程序 //IDLSav的路径 string sIDLSavPath = FileManage.getApplicatonPath(); sIDLSavPath = sIDLSavPath + "IDLSav\\SpecFusionAss.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("FilenameAss", sFilename_Ass); oCom.SetIDLVariable("FilenameRef", sFilename_Ref); oCom.SetIDLVariable("OutputPath", sFilename_Output); oCom.SetIDLVariable("QuaKind", sQuaKindEn); oCom.SetIDLVariable("QuaArr", sQuaArr); //编译idl功能源码 oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'"); //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'"); oCom.ExecuteString("SpecFusionAss,FilenameAss,FilenameRef,OutputPath,QuaKind,QuaArr,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //返回错误消息 if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_OK.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("光谱融合质量评价完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_OK.Enabled = true; this.btn_OpenOutputPath.Visible = true; QuaAssShowForm vSpecQuaAssShowForm = new QuaAssShowForm(this); vSpecQuaAssShowForm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion this.btn_OK.Enabled = true; }
private void btn_ok_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 if (this.txt_chtableinpath.Text.Equals("")) { MessageBox.Show("请选择输入查找表!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.txt_ImageRefer_Inputpath.Text.Equals("")) { MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listViewImage.Items.Count <= 0) { MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DateTime dtRSData = this.dT_RSData.Value; if (dtRSData.Date == System.DateTime.Now.Date) { DialogResult dr; dr = MessageBox.Show("请确认影像过境时间是否是今天!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) { return; } } if (this.cbx_CropType.SelectedValue.ToString().Equals("请选择")) { MessageBox.Show("请选择作物类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.txt_ChImageOutPath.Text.Equals("")) { MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_ok.Enabled = false; #region 界面参数获取 List<string> list = new List<string>(); foreach (ListViewItem item in this.listViewImage.Items) { string s = item.SubItems[0].Text.Trim(); list.Add(s); } string[] sFilename = (string[])list.ToArray(); string scbx_CropType = this.cbx_CropType.SelectedValue.ToString(); string schtableinpath = this.txt_chtableinpath.Text.Trim(); string sImageRefer_Inputpath = this.txt_ImageRefer_Inputpath.Text.Trim(); string sChImageOutPath = this.txt_ChImageOutPath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 //string sIDLSavPath = Application.StartupPath; //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin")); string sIDLSavPath = FileManage.getApplicatonPath(); string sIDLSavPath_pro = sIDLSavPath + "IDLSav\\main_ch_retrieve_Crop.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("chtableinpath", schtableinpath); oCom.SetIDLVariable("Image_crop_inputpath", sImageRefer_Inputpath); oCom.SetIDLVariable("inputFiles", sFilename); oCom.SetIDLVariable("chimageoutpath", sChImageOutPath); oCom.SetIDLVariable("CropType", scbx_CropType); //编译IDL功能源码 //string sIDLSavPath_sav = sIDLSavPath + "IDLSav\\prosail_idl.sav"; //oCom.ExecuteString("restore,\'" + sIDLSavPath_sav + "\'"); oCom.ExecuteString(".compile '" + sIDLSavPath_pro + "'"); oCom.ExecuteString("main_ch_retrieve_Crop,chtableinpath=chtableinpath,inputFiles=inputFiles," +"CropType=CropType,chimageoutpath=chimageoutpath," +"Image_crop_inputpath=Image_crop_inputpath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //MessageBox.Show(objArr.ToString()); if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("冠层叶绿素分布图建立完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_ok.Enabled = true; this.btn_OpenOutPutpath.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion }
private void btn_ok_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 //作物分布图 if (this.txt_ImageCrop_Inputpath.Text.Equals("")) { MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //CCD影像输入 if (this.txt_CCDImageInputpath.Text.Equals("")) { MessageBox.Show("请选择输入CCD影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listViewCCDImage.Items.Count <= 0) { MessageBox.Show("请选择输入CCD影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DateTime dtCCDData = this.dT_CCDData.Value; if (dtCCDData.Date == System.DateTime.Now.Date) { DialogResult dr; dr = MessageBox.Show("请确认影像过境时间是否是今天!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) { return; } } //IRS数据 if (this.txt_IRSImageInputpath.Text.Equals("")) { MessageBox.Show("请选择输入IRS影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listViewIRSImage.Items.Count <= 0) { MessageBox.Show("请选择输入IRS影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.txt_SoybeanMDoutpath.Text.Equals("")) { MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_ok.Enabled = false; #region 界面参数获取 //CCD数据 List<string> list_CCD = new List<string>(); foreach (ListViewItem item in this.listViewCCDImage.Items) { //设置路径 string s = item.SubItems[0].Text.Trim(); list_CCD.Add(s); } string[] sFilename_CCD = (string[])list_CCD.ToArray(); //IRS数据 List<string> list_IRS = new List<string>(); foreach (ListViewItem item in this.listViewIRSImage.Items) { //设置路径 string s = item.SubItems[0].Text.Trim(); list_IRS.Add(s); } string[] sFilename_IRS = (string[])list_IRS.ToArray(); //输出路径 string sImageCrop_Inputpath = this.txt_ImageCrop_Inputpath.Text.Trim(); string sSoybeanMDoutpath = this.txt_SoybeanMDoutpath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 //string sIDLSavPath = Application.StartupPath; //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin")); string sIDLSavPath = FileManage.getApplicatonPath(); sIDLSavPath = sIDLSavPath + "IDLSav\\SoybeanMD.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("Image_crop_inputpath", sImageCrop_Inputpath); oCom.SetIDLVariable("CCDImageInputpath", sFilename_CCD); oCom.SetIDLVariable("IRSImageInputpath", sFilename_IRS); oCom.SetIDLVariable("Soybeanoutpath", sSoybeanMDoutpath); //编译IDL功能源码 oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'"); oCom.ExecuteString("SoybeanMD,CCDImageInputpath=CCDImageInputpath,IRSImageInputpath=IRSImageInputpath," + "Soybeanoutpath=Soybeanoutpath,Image_crop_inputpath=Image_crop_inputpath,Message=Message"); //oCom.ExecuteString("CCDImageInputpath=CCDImageInputpath,IRSImageInputpath=IRSImageInputpath,Soybeanoutpath=Soybeanoutpath,Image_crop_inputpath=Image_crop_inputpath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //MessageBox.Show(objArr.ToString()); if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("大豆成熟期预测完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_ok.Enabled = true; this.btn_OpenOutPutpath.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion }
private void btn_ok_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 if (this.txt_WatertableInpath.Text.Equals("")) { MessageBox.Show("请选择输入查找表!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.txt_ImageRefer_Inputpath.Text.Equals("")) { MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listViewImage.Items.Count <= 0) { MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DateTime dtRSData = this.dT_RSData.Value; if (dtRSData.Date == System.DateTime.Now.Date) { DialogResult dr; dr = MessageBox.Show("请确认影像过境时间是否是今天!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) { return; } } if (this.cbx_CropType.SelectedValue.ToString().Equals("请选择")) { MessageBox.Show("请选择作物类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.txt_WaterImageOutPath.Text.Equals("")) { MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_ok.Enabled = false; #region 界面参数获取 List <string> list = new List <string>(); foreach (ListViewItem item in this.listViewImage.Items) { string s = item.SubItems[0].Text.Trim(); list.Add(s); } string[] sFilename = (string[])list.ToArray(); string scbx_CropType = this.cbx_CropType.SelectedValue.ToString(); string sWatertableInpath = this.txt_WatertableInpath.Text.Trim(); string sImageRefer_Inputpath = this.txt_ImageRefer_Inputpath.Text.Trim(); string sWaterImageOutPath = this.txt_WaterImageOutPath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 //string sIDLSavPath = Application.StartupPath; //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin")); string sIDLSavPath = FileManage.getApplicatonPath(); string sIDLSavPath_pro = sIDLSavPath + "IDLSav\\main_water_retrieve_Crop.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("watertableinpath", sWatertableInpath); oCom.SetIDLVariable("Image_crop_inputpath", sImageRefer_Inputpath); oCom.SetIDLVariable("inputFiles", sFilename); oCom.SetIDLVariable("waterimageoutpath", sWaterImageOutPath); oCom.SetIDLVariable("CropType", scbx_CropType); //编译IDL功能源码 //string sIDLSavPath_sav = sIDLSavPath + "IDLSav\\prosail_idl.sav"; //oCom.ExecuteString("restore,\'" + sIDLSavPath_sav + "\'"); oCom.ExecuteString(".compile '" + sIDLSavPath_pro + "'"); oCom.ExecuteString("main_water_retrieve_Crop,watertableinpath=watertableinpath," + "CropType=CropType,inputFiles=inputFiles,waterimageoutpath=waterimageoutpath," + "Image_crop_inputpath=Image_crop_inputpath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //MessageBox.Show(objArr.ToString()); if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("冠层水分含量分布图建立完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_ok.Enabled = true; this.btn_OpenOutPutpath.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion }
private void btn_ok_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 //作物分布图 if (this.txt_ImageCrop_Inputpath.Text.Equals("")) { MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //CCD影像输入 if (this.txt_CCDImageInputpath.Text.Equals("")) { MessageBox.Show("请选择输入CCD影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listViewCCDImage.Items.Count <= 0) { MessageBox.Show("请选择输入CCD影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DateTime dtCCDData = this.dT_CCDData.Value; if (dtCCDData.Date == System.DateTime.Now.Date) { DialogResult dr; dr = MessageBox.Show("请确认影像过境时间是否是今天!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) { return; } } //IRS数据 if (this.txt_IRSImageInputpath.Text.Equals("")) { MessageBox.Show("请选择输入IRS影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listViewIRSImage.Items.Count <= 0) { MessageBox.Show("请选择输入IRS影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.txt_SoybeanMDoutpath.Text.Equals("")) { MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_ok.Enabled = false; #region 界面参数获取 //CCD数据 List <string> list_CCD = new List <string>(); foreach (ListViewItem item in this.listViewCCDImage.Items) { //设置路径 string s = item.SubItems[0].Text.Trim(); list_CCD.Add(s); } string[] sFilename_CCD = (string[])list_CCD.ToArray(); //IRS数据 List <string> list_IRS = new List <string>(); foreach (ListViewItem item in this.listViewIRSImage.Items) { //设置路径 string s = item.SubItems[0].Text.Trim(); list_IRS.Add(s); } string[] sFilename_IRS = (string[])list_IRS.ToArray(); //输出路径 string sImageCrop_Inputpath = this.txt_ImageCrop_Inputpath.Text.Trim(); string sSoybeanMDoutpath = this.txt_SoybeanMDoutpath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 //string sIDLSavPath = Application.StartupPath; //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin")); string sIDLSavPath = FileManage.getApplicatonPath(); sIDLSavPath = sIDLSavPath + "IDLSav\\SoybeanMD.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("Image_crop_inputpath", sImageCrop_Inputpath); oCom.SetIDLVariable("CCDImageInputpath", sFilename_CCD); oCom.SetIDLVariable("IRSImageInputpath", sFilename_IRS); oCom.SetIDLVariable("Soybeanoutpath", sSoybeanMDoutpath); //编译IDL功能源码 oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'"); oCom.ExecuteString("SoybeanMD,CCDImageInputpath=CCDImageInputpath,IRSImageInputpath=IRSImageInputpath," + "Soybeanoutpath=Soybeanoutpath,Image_crop_inputpath=Image_crop_inputpath,Message=Message"); //oCom.ExecuteString("CCDImageInputpath=CCDImageInputpath,IRSImageInputpath=IRSImageInputpath,Soybeanoutpath=Soybeanoutpath,Image_crop_inputpath=Image_crop_inputpath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //MessageBox.Show(objArr.ToString()); if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("大豆成熟期预测完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_ok.Enabled = true; this.btn_OpenOutPutpath.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion }
private void btn_ok_Click(object sender, EventArgs e) { #region 输出路径 if (this.txt_chtableOutPutpath.Text.Equals("")) { MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.cbx_CCDType.SelectedValue.ToString().Equals("请选择")) { MessageBox.Show("请选择数据类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_ok.Enabled = false; #region 界面参数获取 string scbx_CCDType = this.cbx_CCDType.SelectedValue.ToString(); //输出路径的选择非常重要 string schtableOutPutpath = this.txt_chtableOutPutpath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 // sIDLSavPath为"D:\\3_HongXing\\6_software\\CropWatchField\\CropWatchField\\bin\\Debug" // sIDLSavPath2为"D:\\3_HongXing\\6_software\\CropWatchField\\CropWatchField\\" //pro的路径正确 //string sIDLSavPath = Application.StartupPath; //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin")); string sIDLSavPath = FileManage.getApplicatonPath(); string sIDLSavPath_pro = sIDLSavPath + "IDLSav\\main_ch_buildtable.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("inputtype", scbx_CCDType); oCom.SetIDLVariable("chtableoutpath", schtableOutPutpath); //编译IDL功能源码 string sIDLSavPath_sav = sIDLSavPath + "IDLSav\\prosail_idl.sav"; oCom.ExecuteString("restore,\'" + sIDLSavPath_sav + "\'"); oCom.ExecuteString(".compile '" + sIDLSavPath_pro + "'"); oCom.ExecuteString("main_ch_buildtable,inputtype=inputtype,chtableoutpath=chtableoutpath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //MessageBox.Show(objArr.ToString()); if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("查找表建立完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_ok.Enabled = true; this.btn_OpenOutPutpath.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion }
private void btn_OK_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 if (this.textBox_NdsiPath.Text.Equals("")) { MessageBox.Show("请选择输入NDSI图像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.textBox_OutPutPath.Text.Equals("")) { MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_Ok.Enabled = false; #region 界面参数获取 // NDSI图像 List <string> List_NDSI = new List <string>(); foreach (ListViewItem item in this.listView_NDSI.Items) { string s = this.textBox_NdsiPath.Text + "\\" + item.SubItems[0].Text.Trim(); List_NDSI.Add(s); } string[] sFilename_NDSI = (string[])List_NDSI.ToArray(); //输出路径 string sFilename_Output = this.textBox_OutPutPath.Text.Trim(); #endregion #region 调用IDL程序 //IDLSav的路径 string sIDLSavPath = FileManage.getApplicatonPath(); sIDLSavPath = sIDLSavPath + "IDLSav\\threshold_method.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("FilenameNDSI", sFilename_NDSI); oCom.SetIDLVariable("OutPutPath", sFilename_Output); //编译IDL功能源码 oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'"); oCom.ExecuteString("threshold_method,FilenameNDSI,OutPutPath,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //返回错误消息 if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_Ok.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("计算完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_Ok.Enabled = true; this.btn_OpenOutPutPath.Visible = true; } catch (Exception ex) { // MessageBox.Show(ex.Message); } #endregion }
private void btn_OK_Click(object sender, EventArgs e) { #region 输入与输出路径条件判断 if (this.TextBox_LowPath.Text.Equals("")) { MessageBox.Show("请选择输入低空间分辨率影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.TextBox_HighPath.Text.Equals("")) { MessageBox.Show("请选择输入低空间分辨率影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.TextBox_OutputPath.Text.Equals("")) { MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.listView_Low.Items.Count != this.listView_High.Items.Count) { MessageBox.Show("输入的高低分辨率影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.cbx_Method.SelectedValue.ToString() == "PBIM" && this.TextBox_HLRatio.Text.Equals("")) { MessageBox.Show("请输入低高空间分辨率影像分辨率比值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion this.btn_OK.Enabled = false; #region 界面参数获取 //低空间分辨率影像 List <string> list_Low = new List <string>(); foreach (ListViewItem item in this.listView_Low.Items) { string s = this.TextBox_LowPath.Text + "\\" + item.SubItems[0].Text.Trim(); list_Low.Add(s); } string[] sFilename_Low = (string[])list_Low.ToArray(); //高空间分辨率影像 List <string> list_High = new List <string>(); foreach (ListViewItem item in this.listView_High.Items) { string s = this.TextBox_HighPath.Text + "\\" + item.SubItems[0].Text.Trim(); list_High.Add(s); } string[] sFilename_High = (string[])list_High.ToArray(); //输出路径 string sFilename_Output = this.TextBox_OutputPath.Text.Trim(); //方法 string sMethod = this.cbx_Method.SelectedValue.ToString(); //参数 string[] sPara = new string [] { "", "", "", "", "", "" }; if (sMethod == "PBIM") { sPara[0] = this.TextBox_HLRatio.Text.ToString(); } else if (sMethod == "High Pass Filter") { sPara[1] = this.cbx_Filter.SelectedValue.ToString(); } else if (sMethod == "Wavelet Transform") { sPara[2] = this.cbx_Basis.SelectedValue.ToString(); sPara[3] = this.cbx_Hr.SelectedValue.ToString(); sPara[4] = this.cbx_Lr.SelectedValue.ToString(); sPara[5] = this.cbx_Level.SelectedValue.ToString(); } #endregion #region 调用IDL程序 //IDLSav的路径 string sIDLSavPath = Application.StartupPath; sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin")); sIDLSavPath = sIDLSavPath + "IDLSav\\SpecFusion.pro"; COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass(); try { //初始化 oCom.CreateObject(0, 0, 0); //参数设置 oCom.SetIDLVariable("FilenameLow", sFilename_Low); oCom.SetIDLVariable("FilenameHigh", sFilename_High); oCom.SetIDLVariable("OutputPath", sFilename_Output); oCom.SetIDLVariable("OutQuaFile", sOutQuaFile); oCom.SetIDLVariable("para", sPara); oCom.SetIDLVariable("Method", sMethod); //编译idl功能源码 oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'"); //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'"); oCom.ExecuteString("SpecFusion,FilenameLow,FilenameHigh,OutputPath,Method,OutQuaFile,para,Message=Message"); object objArr = oCom.GetIDLVariable("Message"); //返回错误消息 if (objArr != null) { MessageBox.Show(objArr.ToString()); oCom.DestroyObject(); this.btn_OK.Enabled = true; return; } oCom.DestroyObject(); MessageBox.Show("光谱融合完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btn_OK.Enabled = true; this.btn_OpenOutputPath.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } #endregion }