Пример #1
0
 /// <summary>
 /// 根据输入的landsat7头文件MTL.txt和保存的位置,完成辐射定标,返回结果文件的路径
 /// </summary>
 /// <param name="inputStr">landsat头文件MTL.txt的路径</param>
 /// <param name="outputStr">定标后的保存文件夹</param>
 /// <returns>完成定标后的可见光和红外保存的路径,返回为字符串数组</returns>
 public static string[] IdlRadCalibration(string inputStr, string outputStr)
 {
     string[] resultStr = new string[2];
     try
     {
         //初始化COM_IDL_connectLib对象
         COM_IDL_connectLib.COM_IDL_connect oComIdl = new COM_IDL_connectLib.COM_IDL_connectClass();
         oComIdl.CreateObject(0, 0, 0);
         //定义IDL下的变量
         oComIdl.SetIDLVariable("inputFile", inputStr);
         oComIdl.SetIDLVariable("outputFolder", outputStr);
         //编译IDL源码
         oComIdl.ExecuteString(".compile '" + Application.StartupPath +
                               "\\IDLProcess\\ENVIPROVESS_TMCAL_DOIT.pro'");
         oComIdl.ExecuteString("ENVIPROVESS_TMCAL_DOIT,inputFile,outputFolder,mb_output=mb_output,thre_output=thre_output");
         //获取IDL下的变量值
         object objMulOutputName  = oComIdl.GetIDLVariable("mb_output");
         object objThreOutputName = oComIdl.GetIDLVariable("thre_output");
         //设置返回值
         resultStr[0] = objThreOutputName.ToString();
         resultStr[1] = objMulOutputName.ToString();
         oComIdl      = null;
     }
     catch (Exception e)
     {
         MessageBox.Show("辐射定标处理过程出现错误" + e.ToString());
     }
     return(resultStr);
 }
Пример #2
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.listViewImage.Items.Count <= 1)
            {
                MessageBox.Show("请至少选择两景输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_ImageOutPath.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   sImageOutPath = this.txt_ImageOutPath.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\FileMosaic.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("FileSeeds", sFilename);
                oCom.SetIDLVariable("OutFile", sImageOutPath);
                oCom.SetIDLVariable("BACKGROUND", "0");
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("FileMosaic,FileSeeds,OutFile,/TIFF,Message=Message,BACKGROUND=0");
                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("影像拼接完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
        private void btn_classstatis_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断

            string sImageInput = this.txt_ImageInput.Text.Trim();
            if (sImageInput.Equals(""))
            {
                MessageBox.Show("请选择待分类统计影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            #endregion
            this.btn_classstatis.Enabled = false;

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\GetFileHist.pro";
            string sCSVPath = FileManage.getApplicatonPath();
            string sFullName = sCSVPath + "AllSense.csv";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                    //初始化
                    oCom.CreateObject(0, 0, 0);
                    //参数设置
                    oCom.SetIDLVariable("File", sImageInput);
                    oCom.SetIDLVariable("CSVPath", sFullName);
                    //oCom.SetIDLVariable("Background", "0");
                    //编译IDL功能源码
                    oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                    //执行计算
                    oCom.ExecuteString("GetFileHist,file,CSVPath,DataArray=DataArray");
                    //获取计算结果
                    object objArr = oCom.GetIDLVariable("DataArray");
                    //MessageBox.Show(objArr.ToString());
                    if (objArr == null)
                    {
                        MessageBox.Show("输入影像有误,请重新选择分类后影像!");
                        return;
                    }
                    //将对象转为一维数组
                    string[] arrStatistic = (string[])objArr;
                    //表头
                    string[] arrName = { "作物类型","面积(亩)","所占比例(%)"};
                    //数组行按","拆分后转DataTable
                    DataTable dt = StringFormater.Convert(arrName, arrStatistic);
                   //数据绑定
                    BindDataSource(dt);
                    oCom.DestroyObject();
                //MessageBox.Show("影像裁剪完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_classstatis.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #4
0
        private void btn_classstatis_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断

            string sImageInput = this.txt_ImageInput.Text.Trim();
            if (sImageInput.Equals(""))
            {
                MessageBox.Show("请选择待分类统计影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            #endregion
            this.btn_classstatis.Enabled = false;

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\GetFileHist.pro";
            string sCSVPath  = FileManage.getApplicatonPath();
            string sFullName = sCSVPath + "AllSense.csv";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("File", sImageInput);
                oCom.SetIDLVariable("CSVPath", sFullName);
                //oCom.SetIDLVariable("Background", "0");
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                //执行计算
                oCom.ExecuteString("GetFileHist,file,CSVPath,DataArray=DataArray");
                //获取计算结果
                object objArr = oCom.GetIDLVariable("DataArray");
                //MessageBox.Show(objArr.ToString());
                if (objArr == null)
                {
                    MessageBox.Show("输入影像有误,请重新选择分类后影像!");
                    return;
                }
                //将对象转为一维数组
                string[] arrStatistic = (string[])objArr;
                //表头
                string[] arrName = { "作物类型", "面积(亩)", "所占比例(%)" };
                //数组行按","拆分后转DataTable
                DataTable dt = StringFormater.Convert(arrName, arrStatistic);
                //数据绑定
                BindDataSource(dt);
                oCom.DestroyObject();
                //MessageBox.Show("影像裁剪完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_classstatis.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #5
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     #region 输入与输出路径条件判断
     if (this.TextBox_YieldPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输入单产影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.TextBox_OutputPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     #endregion
     #region 界面参数获取
     //单产文件
     List <string> list_Yield = new List <string>();
     foreach (ListViewItem item in this.listView_Yield.Items)
     {
         string s = this.TextBox_YieldPath.Text + "\\" + item.SubItems[0].Text.Trim();
         list_Yield.Add(s);
     }
     string[] sFilename_Yield = (string[])list_Yield.ToArray();
     //输出路径
     string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
     #endregion
     #region
     //IDLSav的路径
     string sIDLSavPath = FileManage.getApplicatonPath();
     sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_N.pro";
     COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
     try
     {
         //初始化
         oCom.CreateObject(0, 0, 0);
         //参数设置
         oCom.SetIDLVariable("YieldFilenames", sFilename_Yield);
         oCom.SetIDLVariable("OutputPath", sFilename_Output);
         //编译idl功能源码
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         oCom.ExecuteString("Nutrient_N,YieldFilenames,OutputPath,Message=Message");
         object objArr = oCom.GetIDLVariable("Message");
         //返回错误消息
         if (objArr != null)
         {
             MessageBox.Show(objArr.ToString());
             oCom.DestroyObject();
             return;
         }
         oCom.DestroyObject();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     #endregion
 }
Пример #6
0
        private void btn_His_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_ObserPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入地面观测数据文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            //地面观测数据文件
            string sFilename_Obser = this.TextBox_ObserPath.Text.Trim();
            ObserFilename = sFilename_Obser;
            #region
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\Histogram.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            //try
            //{
            //初始化
            oCom.CreateObject(0, 0, 0);
            //参数设置

            oCom.SetIDLVariable("ObserFilename", sFilename_Obser);

            //编译idl功能源码
            oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
            oCom.ExecuteString("Histogram,ObserFilename,Message=Message");
            object objArr = oCom.GetIDLVariable("Message");
            ////返回错误消息
            //if (objArr != null)
            //{
            //    MessageBox.Show(objArr.ToString());
            //    oCom.DestroyObject();
            //    return;
            //}
            //oCom.DestroyObject();
            oCom.DestroyObject();
            HistogramShow vHistogramShow = new HistogramShow(this);
            vHistogramShow.ShowDialog();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
            #endregion
        }
Пример #7
0
        private void btn_DisplayIDL_Click(object sender, EventArgs e)
        {
            Point pBtn           = this.pDisplayBtnIDL;
            Point pMain          = this.Location;
            int   HeightMainForm = this.Size.Height;
            int   x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Size.Width) / 2;
            int   y = pMain.Y + pBtn.Y + HeightMainForm + 8;

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = Application.StartupPath;
            sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin"));
            sIDLSavPath = sIDLSavPath + "IDLSav\\common_viewer.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置

                oCom.SetIDLVariable("w_xoffset", x);
                oCom.SetIDLVariable("w_yoffset", y);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("COMMON_VIEWER,w_xoffset,w_yoffset");
                object objArr = oCom.GetIDLVariable("Message");
                ////返回错误消息
                //if (objArr != null)
                //{
                //    MessageBox.Show(objArr.ToString());
                //    oCom.DestroyObject();
                //    return;
                //}
                oCom.DestroyObject();
            }
            catch (Exception ex)
            {
                // MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #8
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_inputfile_cropLand.Text.Equals(""))
            {
                MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_inputfile_bio.Text.Equals(""))
            {
                MessageBox.Show("请选择输入每天生物量存储路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_outfilepath_har.Text.Equals(""))
            {
                MessageBox.Show("请选择输入输出文件名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_maize_s.Value.Year != this.dT_maize_e.Value.Year)
            {
                MessageBox.Show("请选择输入正确的玉米年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_bean_s.Value.Year != this.dT_bean_e.Value.Year)
            {
                MessageBox.Show("请选择输入正确的大豆年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_wheat_s.Value.Year != this.dT_wheat_e.Value.Year)
            {
                MessageBox.Show("请选择输入正确的小麦年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_wheat_s.Value.Year != this.dT_maize_s.Value.Year || this.dT_wheat_s.Value.Year != this.dT_bean_s.Value.Year)
            {
                MessageBox.Show("请选择输入相同的作物年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string   txtinputfilecropLand = this.txt_inputfile_cropLand.Text.Trim();
            string   txtinputfilebio      = this.txt_inputfile_bio.Text.Trim();
            string   txtoutfilepathhar    = this.txt_outfilepath_har.Text.Trim();
            int[]    maizeLive            = new int[6];
            DateTime ymd0 = this.dT_maize_s.Value;
            maizeLive[0] = ymd0.Year;
            maizeLive[1] = ymd0.Month;
            maizeLive[2] = ymd0.Day;
            DateTime ymd1 = this.dT_maize_e.Value;
            maizeLive[3] = ymd1.Year;
            maizeLive[4] = ymd1.Month;
            maizeLive[5] = ymd1.Day;

            int[]    beanLive = new int[6];
            DateTime ymd2     = this.dT_bean_s.Value;
            beanLive[0] = ymd2.Year;
            beanLive[1] = ymd2.Month;
            beanLive[2] = ymd2.Day;
            DateTime ymd3 = this.dT_bean_e.Value;
            beanLive[3] = ymd3.Year;
            beanLive[4] = ymd3.Month;
            beanLive[5] = ymd3.Day;

            int[]    wheatLive = new int[6];
            DateTime ymd4      = this.dT_wheat_s.Value;
            wheatLive[0] = ymd4.Year;
            wheatLive[1] = ymd4.Month;
            wheatLive[2] = ymd4.Day;
            DateTime ymd5 = this.dT_wheat_e.Value;
            wheatLive[3] = ymd5.Year;
            wheatLive[4] = ymd5.Month;
            wheatLive[5] = ymd5.Day;
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\crop_harvest_all.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            Thread t = new Thread(new ThreadStart(thread1));
            t.Start();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("in_hx_crop_class", txtinputfilecropLand);
                oCom.SetIDLVariable("in_file_bio", txtinputfilebio);
                oCom.SetIDLVariable("maize_live_day", maizeLive);
                oCom.SetIDLVariable("bean_live_day", beanLive);
                oCom.SetIDLVariable("wheat_live_day", wheatLive);
                oCom.SetIDLVariable("out_filename", txtoutfilepathhar);
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("crop_harvest_all,in_hx_crop_class=in_hx_crop_class,in_file_bio=in_file_bio,maize_live_day=maize_live_day,bean_live_day=bean_live_day,wheat_live_day=wheat_live_day,out_filename=out_filename,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                t.Abort();
                MessageBox.Show("单产计算完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                t.Abort();
                MessageBox.Show("计算失败,请联系系统管理员!");
            }

            #endregion
        }
Пример #9
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            try
            {
                //acquire the year_start, year_end and element name
                int      year_from = cmbox_year_from.SelectedIndex + 2002;
                int      year_to   = cmbox_year_to.SelectedIndex + 2002;
                string[] ele_names = { "cdom",   "chlor",  "chlocx", "flh",    "kd490",  "par", "pic", "poc",
                                       "rrs488", "rrs531", "rrs547", "rrs645", "rrs667", "sst" };
                string[] fre_names = { "DAY", "MON" };

                //initial
                COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
                oCom.CreateObject(0, 0, 0);
                oCom.SetIDLVariable("path_input", cmbox_input.Text);
                oCom.SetIDLVariable("path_output", cmbox_output.Text);
                oCom.SetIDLVariable("year_start", year_from);
                oCom.SetIDLVariable("year_end", year_to);
                oCom.SetIDLVariable("NAD_str", ele_names[cmbox_element.SelectedIndex]);
                string root_dir = Application.StartupPath + @"\IDL\modis_data_query\";

                switch (fre_names[cmbox_frequency.SelectedIndex])
                {
                case "DAY":
                    oCom.ExecuteString(String.Format(".compile '{0}nasa_data_day_query.pro'", root_dir));
                    oCom.ExecuteString(String.Format(".compile '{0}nasa_data_day_query_batch.pro'", root_dir));
                    if (cb_filesave.Checked)
                    {
                        oCom.ExecuteString("nasa_data_day_query_batch, path_input, path_output, year_start, year_end, NAD_str, /OF_SAVE");
                    }
                    else
                    {
                        oCom.ExecuteString("nasa_data_day_query_batch, path_input, path_output, year_start, year_end, NAD_str");
                    }
                    //get the file path
                    file_path  = oCom.GetIDLVariable("!fp").ToString();
                    ofile_path = oCom.GetIDLVariable("!fp_of").ToString();
                    break;

                case "MON":
                    oCom.ExecuteString(String.Format(".compile '{0}nasa_data_mon_query.pro'", root_dir));
                    oCom.ExecuteString(String.Format(".compile '{0}nasa_data_mon_query_batch.pro'", root_dir));
                    if (cb_filesave.Checked)
                    {
                        oCom.ExecuteString("nasa_data_mon_query_batch, path_input, path_output, year_start, year_end, NAD_str, /OF_SAVE");
                    }
                    else
                    {
                        oCom.ExecuteString("nasa_data_mon_query_batch, path_input, path_output, year_start, year_end, NAD_str");
                    }
                    //get the file path
                    file_path  = oCom.GetIDLVariable("!fp").ToString();
                    ofile_path = oCom.GetIDLVariable("!fp_of").ToString();
                    break;

                default:
                    break;
                }

                link_openFile.Visible   = true;
                link_openFolder.Visible = true;
                link_openOFile.Visible  = true;
                if (cb_filesave.Checked)
                {
                    link_openOFile.Enabled = true;
                }
                else
                {
                    link_openOFile.Enabled = false;
                }

                rtb_status.Text  = "处理完成!";
                rtb_status.Text += "\n查找信息:" + fre_names[cmbox_frequency.SelectedIndex] + "/" +
                                   ele_names[cmbox_element.SelectedIndex].ToUpper() + " (" + year_from.ToString() +
                                   "年-" + year_to.ToString() + "年" + ")";

                //功能调用完毕后销毁对象,否则容易报错,没来得及回收资源
                //oCom.DestroyObject();
                //Marshal.ReleaseComObject(oCom);

                DialogResult dr = MessageBox.Show("处理完成!是否打开生成文件?", "信息提示",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dr == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(file_path);
                    if (cb_filesave.Checked)
                    {
                        System.Diagnostics.Process.Start(ofile_path);
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                rtb_status.Text         = "处理失败!";
                link_openFile.Visible   = false;
                link_openFolder.Visible = false;
                link_openOFile.Visible  = false;
            }
        }
Пример #10
0
        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 = FileManage.getApplicatonPath();
            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
        }
Пример #11
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_ImageInput.Text.Equals(""))
            {
                MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sMinclass = this.txt_minclass.Text;
            if (sMinclass.Equals(""))
            {
                MessageBox.Show("请输入最小分类数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int nMinclass;
            bool bMinclass = int.TryParse(sMinclass, out nMinclass);
            if (bMinclass==false)
            {
                MessageBox.Show("最小分类数只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sMaxclass = this.txt_maxclass.Text;
            if (sMaxclass.Equals(""))
            {
                MessageBox.Show("请输入最大分类数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int nMaxclass;
            bool bMaxclass = int.TryParse(sMaxclass, out nMaxclass);
            if (bMaxclass == false)
            {
                MessageBox.Show("最大分类数只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (nMaxclass < nMinclass)
            {
                MessageBox.Show("最大分类数不能小于最小分类数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sIterations = this.txt_Iterations.Text;
            if (sIterations.Equals(""))
            {
                MessageBox.Show("请选择最大迭代次数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int nIterations;
            bool bIterations = int.TryParse(sIterations, out nIterations);
            if (bIterations == false)
            {
                MessageBox.Show("最大迭代次数只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string sChangethersh = this.txt_changethersh.Text;
            if (sChangethersh.Equals(""))
            {
                MessageBox.Show("请输入变化阈值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int nChangethersh;
            bool bChangethersh = int.TryParse(sChangethersh, out nChangethersh);
            if (bChangethersh == false)
            {
                MessageBox.Show("变化阈值只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (nChangethersh < 0 && nChangethersh>100)
            {
                MessageBox.Show("变化阈值只能为0-100的数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            float fChangethersh=0.00f;
            bool f = float.TryParse(sChangethersh, out fChangethersh);
            fChangethersh = fChangethersh / 100;

            if (this.txt_ImageOutPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string sFilename = this.txt_ImageInput.Text.Trim();
            string sImageOutPath = this.txt_ImageOutPath.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\class_isodata.pro";

            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("inputfile", sFilename);
                oCom.SetIDLVariable("MIN_CLASSES", sMinclass);
                oCom.SetIDLVariable("NUM_CLASSES", sMaxclass);
                oCom.SetIDLVariable("ITERATIONS", sIterations);
                oCom.SetIDLVariable("CHANGE_THRESH", fChangethersh);
                oCom.SetIDLVariable("outputDir", sImageOutPath);
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("CLASS_ISODATA,inputfile,outputDir,ITERATIONS = ITERATIONS,NUM_CLASSES = NUM_CLASSES,CHANGE_THRESH = CHANGE_THRESH,MIN_CLASSES = MIN_CLASSES,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("分类完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            #endregion
        }
Пример #12
0
        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 = FileManage.getApplicatonPath();
            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
        }
Пример #13
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_inputfile_cropLand.Text.Equals(""))
            {
                MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_inputfile_bio.Text.Equals(""))
            {
                MessageBox.Show("请选择输入每天生物量存储路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_outfilepath_har.Text.Equals(""))
            {
                MessageBox.Show("请选择输入输出文件名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_maize_s.Value.Year != this.dT_maize_e.Value.Year)
            {
                MessageBox.Show("请选择输入正确的玉米年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_bean_s.Value.Year != this.dT_bean_e.Value.Year)
            {
                MessageBox.Show("请选择输入正确的大豆年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_wheat_s.Value.Year != this.dT_wheat_e.Value.Year)
            {
                MessageBox.Show("请选择输入正确的小麦年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_wheat_s.Value.Year != this.dT_maize_s.Value.Year || this.dT_wheat_s.Value.Year != this.dT_bean_s.Value.Year)
            {
                MessageBox.Show("请选择输入相同的作物年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string txtinputfilecropLand = this.txt_inputfile_cropLand.Text.Trim();
            string txtinputfilebio = this.txt_inputfile_bio.Text.Trim();
            string txtoutfilepathhar = this.txt_outfilepath_har.Text.Trim();
            int[] maizeLive = new int[6];
            DateTime ymd0 = this.dT_maize_s.Value;
            maizeLive[0] = ymd0.Year;
            maizeLive[1] = ymd0.Month;
            maizeLive[2] = ymd0.Day;
            DateTime ymd1 = this.dT_maize_e.Value;
            maizeLive[3] = ymd1.Year;
            maizeLive[4] = ymd1.Month;
            maizeLive[5] = ymd1.Day;

            int[] beanLive = new int[6];
            DateTime ymd2 = this.dT_bean_s.Value;
            beanLive[0] = ymd2.Year;
            beanLive[1] = ymd2.Month;
            beanLive[2] = ymd2.Day;
            DateTime ymd3 = this.dT_bean_e.Value;
            beanLive[3] = ymd3.Year;
            beanLive[4] = ymd3.Month;
            beanLive[5] = ymd3.Day;

            int[] wheatLive = new int[6];
            DateTime ymd4 = this.dT_wheat_s.Value;
            wheatLive[0] = ymd4.Year;
            wheatLive[1] = ymd4.Month;
            wheatLive[2] = ymd4.Day;
            DateTime ymd5 = this.dT_wheat_e.Value;
            wheatLive[3] = ymd5.Year;
            wheatLive[4] = ymd5.Month;
            wheatLive[5] = ymd5.Day;
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\crop_harvest_all.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            Thread t = new Thread(new ThreadStart(thread1));
            t.Start();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("in_hx_crop_class",txtinputfilecropLand);
                oCom.SetIDLVariable("in_file_bio", txtinputfilebio);
                oCom.SetIDLVariable("maize_live_day", maizeLive);
                oCom.SetIDLVariable("bean_live_day", beanLive);
                oCom.SetIDLVariable("wheat_live_day", wheatLive);
                oCom.SetIDLVariable("out_filename", txtoutfilepathhar);
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("crop_harvest_all,in_hx_crop_class=in_hx_crop_class,in_file_bio=in_file_bio,maize_live_day=maize_live_day,bean_live_day=bean_live_day,wheat_live_day=wheat_live_day,out_filename=out_filename,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                t.Abort();
                MessageBox.Show("单产计算完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled = true;
                this.btn_OpenOutPut.Visible = true;

            }
            catch (Exception ex)
            {
                t.Abort();
                MessageBox.Show("计算失败,请联系系统管理员!");
            }

            #endregion
        }
Пример #14
0
 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_AbsDiffAve_1.Checked && !this.cbx_EA_2.Checked && !this.cbx_Bias_3.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();
     this.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[] sQuaArr = new string[] { "", "", "", "" };
     if (this.cbx_AbsDiffAve_1.Checked)
     {
         sQuaArr[0] = "TRUE";
     }
     if (this.cbx_EA_2.Checked)
     {
         sQuaArr[1] = "TRUE";
     }
     if (this.cbx_Bias_3.Checked)
     {
         sQuaArr[2] = "TRUE";
     }
     if (this.cbx_LinearFit_4.Checked)
     {
         sQuaArr[3] = "TRUE";
     }
     #endregion
     #region 调用IDL程序
     //IDLSav的路径
     string sIDLSavPath = FileManage.getApplicatonPath();
     sIDLSavPath = sIDLSavPath + "IDLSav\\TSFusionAss.pro";
     COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
     try
     {
         //初始化
         oCom.CreateObject(0, 0, 0);
         //参数设置
         oCom.SetIDLVariable("F_files", sFilename_Ass);
         oCom.SetIDLVariable("Ref_files", sFilename_Ref);
         oCom.SetIDLVariable("OutPutPath", sFilename_Output);
         oCom.SetIDLVariable("QuaArr", sQuaArr);
         //编译2次idl功能源码(奇怪啊,非得编译两次才能运行,无法理解)
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
         //执行
         oCom.ExecuteString("TSFusionAss,Ref_files,F_files,OutPutPath,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 vQuaAssShowForm = new QuaAssShowForm(this);
         vQuaAssShowForm.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     #endregion
     this.btn_OK.Enabled = true;
 }
Пример #15
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_Filename_Cropland.Text.Equals(""))
            {
                MessageBox.Show("请选择输入作物分布图路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_Filename_harvest.Text.Equals(""))
            {
                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.txt_outFilename_N.Text.Equals(""))
            {
                MessageBox.Show("请选择输入碱解氮含量输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_outFilename_O.Text.Equals(""))
            {
                MessageBox.Show("请选择输入有机质含量输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string FilenameCropland = this.txt_Filename_Cropland.Text.Trim();
            string FilenameHharvest = this.txt_Filename_harvest.Text.Trim();
            string outFilenameN     = this.txt_outFilename_N.Text.Trim();


            string outFilenameO = this.txt_outFilename_O.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\harvest_to_soil_nitrogen.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("in_farm_land", FilenameCropland);
                oCom.SetIDLVariable("in_crop_harvest", FilenameHharvest);
                oCom.SetIDLVariable("out_dir_N", outFilenameN);
                oCom.SetIDLVariable("out_dir_O", outFilenameO);
                //编译idl功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("harvest_to_soil_nitrogen,in_farm_land,in_crop_harvest,out_dir_N,out_dir_O,message = message");
                object objArr = oCom.GetIDLVariable("message");
                //返回错误消息
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("养分监测完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #16
0
        private void btn_His_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_ObserPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入地面观测数据文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            //地面观测数据文件
            string sFilename_Obser = this.TextBox_ObserPath.Text.Trim();
            ObserFilename = sFilename_Obser;
            #region
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\Histogram.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            //try
            //{
            //初始化
            oCom.CreateObject(0, 0, 0);
            //参数设置

            oCom.SetIDLVariable("ObserFilename", sFilename_Obser);

            //编译idl功能源码
            oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
            oCom.ExecuteString("Histogram,ObserFilename,Message=Message");
            object objArr = oCom.GetIDLVariable("Message");
            ////返回错误消息
            //if (objArr != null)
            //{
            //    MessageBox.Show(objArr.ToString());
            //    oCom.DestroyObject();
            //    return;
            //}
            //oCom.DestroyObject();
            oCom.DestroyObject();
            HistogramShow vHistogramShow = new HistogramShow(this);
            vHistogramShow.ShowDialog();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
            #endregion
        }
Пример #17
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_HJPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入环境星影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_ObserPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入地面观测数据文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_OutputPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            #region 界面参数获取
            //环境星影像文件
            List<string> list_HJ = new List<string>();
            foreach (ListViewItem item in this.listView_HJ.Items)
            {
                string s = this.TextBox_HJPath.Text + "\\" + item.SubItems[0].Text.Trim();
                list_HJ.Add(s);
            }
            string[] sFilename_HJ = (string[])list_HJ.ToArray();
            //地面观测数据文件
            string sFilename_Obser = this.TextBox_ObserPath.Text.Trim();
            ObserFilename = sFilename_Obser;
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            #endregion
            #region
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_OM.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("HJFilenames", sFilename_HJ);
                oCom.SetIDLVariable("ObserFilename", sFilename_Obser);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);
                oCom.SetIDLVariable("sHistogram", sHistogram);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                oCom.ExecuteString("Nutrient_OM,HJFilenames,ObserFilename,OutputPath,sHistogram,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_OutputPath.Visible = true;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #18
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.listViewImage.Items.Count <= 0)
            {
                MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if(this.txt_ReferenceImage.Text.Equals(""))
            {
                MessageBox.Show("请选择输出范围!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_ImageOutPath.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 sReferenceImage = this.txt_ReferenceImage.Text.Trim();
            string sImageOutPath = this.txt_ImageOutPath.Text.Trim();

            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\FileCut.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                foreach (string sFile in sFilename)
                {
                    //初始化
                    oCom.CreateObject(0, 0, 0);
                    //参数设置
                    oCom.SetIDLVariable("File", sFile);
                    oCom.SetIDLVariable("ReferFile", sReferenceImage);
                    oCom.SetIDLVariable("OUTPUTDIR", sImageOutPath);
                    oCom.SetIDLVariable("TIFF", "/TIFF");
                    //string sName = sFilename[0].ToString();
                    string outputname = StringFormater.getNewName(sFile, sImageOutPath);
                    oCom.SetIDLVariable("OUTPUTFILE", outputname);
                    //编译IDL功能源码
                    oCom.ExecuteString(".compile '" + sIDLSavPath + "'");

                    oCom.ExecuteString("FileCut,File,OUTPUTDIR=OUTPUTDIR,ReferFile,/TIFF,OUTPUTFILE=OUTPUTFILE,Message=Message");

                    object objArr = oCom.GetIDLVariable("Message");
                    //MessageBox.Show(objArr.ToString());
                    if (objArr != null)
                    {
                        MessageBox.Show(objArr.ToString());
                        return;
                    }
                    oCom.DestroyObject();
                }
                MessageBox.Show("影像裁剪完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #19
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_YieldPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入单产影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_CropPath.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_Yield.Items.Count != this.listView_Crop.Items.Count)
            {
                MessageBox.Show("输入的单产影像与作物分布影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_OK.Enabled = false;
            #region 界面参数获取
            //单产文件
            List <string> list_Yield = new List <string>();
            foreach (ListViewItem item in this.listView_Yield.Items)
            {
                string s = this.TextBox_YieldPath.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Yield.Add(s);
            }
            string[] sFilename_Yield = (string[])list_Yield.ToArray();
            //作物分布
            List <string> list_Crop = new List <string>();
            foreach (ListViewItem item in this.listView_Crop.Items)
            {
                string s = this.TextBox_CropPath.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Crop.Add(s);
            }
            string[] sFilename_Crop = (string[])list_Crop.ToArray();
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            //方法
            string sMethod = this.cbx_Method.SelectedValue.ToString();
            //参数
            string HisPara1 = this.txt_HistPara1.Text;             //组距
            string HisPara2 = this.cbx_N.SelectedValue.ToString(); //[mu-N*sigma,mu+N*sigma]中的N
            string Percent  = this.txt_Percent.Text;               //百分数
            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            if (sMethod == "高斯拟合")
            {
                sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_gaussfit.pro";
                COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
                //try
                //{
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置

                oCom.SetIDLVariable("YieldFilenames", sFilename_Yield);
                oCom.SetIDLVariable("CropClassifyFilenames", sFilename_Crop);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);

                oCom.SetIDLVariable("HisPara1", HisPara1);
                oCom.SetIDLVariable("HisPara2", HisPara2);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("Nutrient_GaussFit,YieldFilenames,CropClassifyFilenames,OutputPath,HisPara1,HisPara2,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);
                //}
            }
            else
            {
                sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_percent.pro";
                COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
                //try
                //{
                //初始化
                oCom.CreateObject(0, 0, 0);

                oCom.SetIDLVariable("YieldFilenames", sFilename_Yield);
                oCom.SetIDLVariable("CropClassifyFilenames", sFilename_Crop);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);

                oCom.SetIDLVariable("HisPara1", HisPara1);
                oCom.SetIDLVariable("HisPara2", Percent);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("Nutrient_Percent,YieldFilenames,CropClassifyFilenames,OutputPath,HisPara1,HisPara2,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
        }
Пример #20
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     #region 输入与输出路径条件判断
     if (this.TextBox_HJPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输入环境星影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.TextBox_ObserPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输入地面观测数据文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.TextBox_OutputPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     #endregion
     #region 界面参数获取
     //环境星影像文件
     List <string> list_HJ = new List <string>();
     foreach (ListViewItem item in this.listView_HJ.Items)
     {
         string s = this.TextBox_HJPath.Text + "\\" + item.SubItems[0].Text.Trim();
         list_HJ.Add(s);
     }
     string[] sFilename_HJ = (string[])list_HJ.ToArray();
     //地面观测数据文件
     string sFilename_Obser = this.TextBox_ObserPath.Text.Trim();
     ObserFilename = sFilename_Obser;
     //输出路径
     string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
     #endregion
     #region
     //IDLSav的路径
     string sIDLSavPath = FileManage.getApplicatonPath();
     sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_OM.pro";
     COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
     try
     {
         //初始化
         oCom.CreateObject(0, 0, 0);
         //参数设置
         oCom.SetIDLVariable("HJFilenames", sFilename_HJ);
         oCom.SetIDLVariable("ObserFilename", sFilename_Obser);
         oCom.SetIDLVariable("OutputPath", sFilename_Output);
         oCom.SetIDLVariable("sHistogram", sHistogram);
         //编译idl功能源码
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         oCom.ExecuteString("Nutrient_OM,HJFilenames,ObserFilename,OutputPath,sHistogram,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_OutputPath.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     #endregion
 }
Пример #21
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.listViewImage.Items.Count <= 1)
            {
                MessageBox.Show("请至少选择两景输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_ImageOutPath.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 sImageOutPath = this.txt_ImageOutPath.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\FileMosaic.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("FileSeeds", sFilename);
                oCom.SetIDLVariable("OutFile", sImageOutPath);
                oCom.SetIDLVariable("BACKGROUND", "0");
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("FileMosaic,FileSeeds,OutFile,/TIFF,Message=Message,BACKGROUND=0");
                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("影像拼接完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #22
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.listViewImage.Items.Count <= 0)
            {
                MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (this.txt_ReferenceImage.Text.Equals(""))
            {
                MessageBox.Show("请选择输出范围!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_ImageOutPath.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   sReferenceImage = this.txt_ReferenceImage.Text.Trim();
            string   sImageOutPath   = this.txt_ImageOutPath.Text.Trim();

            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\FileCut.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                foreach (string sFile in sFilename)
                {
                    //初始化
                    oCom.CreateObject(0, 0, 0);
                    //参数设置
                    oCom.SetIDLVariable("File", sFile);
                    oCom.SetIDLVariable("ReferFile", sReferenceImage);
                    oCom.SetIDLVariable("OUTPUTDIR", sImageOutPath);
                    oCom.SetIDLVariable("TIFF", "/TIFF");
                    //string sName = sFilename[0].ToString();
                    string outputname = StringFormater.getNewName(sFile, sImageOutPath);
                    oCom.SetIDLVariable("OUTPUTFILE", outputname);
                    //编译IDL功能源码
                    oCom.ExecuteString(".compile '" + sIDLSavPath + "'");

                    oCom.ExecuteString("FileCut,File,OUTPUTDIR=OUTPUTDIR,ReferFile,/TIFF,OUTPUTFILE=OUTPUTFILE,Message=Message");

                    object objArr = oCom.GetIDLVariable("Message");
                    //MessageBox.Show(objArr.ToString());
                    if (objArr != null)
                    {
                        MessageBox.Show(objArr.ToString());
                        return;
                    }
                    oCom.DestroyObject();
                }
                MessageBox.Show("影像裁剪完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #23
0
 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;
     }
     #endregion
     #region 界面参数获取
     //低空间分辨率影像路径
     string sFilename_LowPath = this.TextBox_LowPath.Text.Trim() + Path.DirectorySeparatorChar;
     //高空间分辨率影像路径
     string sFilename_HighPath = this.TextBox_HighPath.Text.Trim() + Path.DirectorySeparatorChar;
     //输出路径
     string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
     //融合方法
     string sMethod = this.cbx_Method.SelectedValue.ToString();
     //相似像元窗口大小
     string sWinSize = this.cbx_WinSize.SelectedValue.ToString();
     //基准影像窗口大小
     string sTWinSize = this.txt_TWinSize.Text.Trim();
     #endregion
     #region 调用IDL程序
     //IDLSav的路径
     string sIDLSavPath = FileManage.getApplicatonPath();
     sIDLSavPath = sIDLSavPath + "IDLSav\\TSFusion.pro";
     COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
     try
     {
         //初始化
         oCom.CreateObject(0, 0, 0);
         //参数设置
         oCom.SetIDLVariable("CFileDir", sFilename_LowPath);
         oCom.SetIDLVariable("FFileDir", sFilename_HighPath);
         oCom.SetIDLVariable("OutputPath", sFilename_Output);
         oCom.SetIDLVariable("Method", sMethod);
         oCom.SetIDLVariable("WinSize", sWinSize);
         oCom.SetIDLVariable("TWinSize", sTWinSize);
         //编译idl功能源码
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
         oCom.ExecuteString("TSFusion,CFileDir,FFileDir,OutputPath,Method,WinSize,TWinSize,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
 }
Пример #24
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_YieldPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入单产影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_CropPath.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_Yield.Items.Count != this.listView_Crop.Items.Count)
            {
                MessageBox.Show("输入的单产影像与作物分布影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_OK.Enabled = false;
            #region 界面参数获取
            //单产文件
            List<string> list_Yield = new List<string>();
            foreach (ListViewItem item in this.listView_Yield.Items)
            {
                string s = this.TextBox_YieldPath.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Yield.Add(s);
            }
            string[] sFilename_Yield = (string[])list_Yield.ToArray();
            //作物分布
            List<string> list_Crop = new List<string>();
            foreach (ListViewItem item in this.listView_Crop.Items)
            {
                string s = this.TextBox_CropPath.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Crop.Add(s);
            }
            string[] sFilename_Crop = (string[])list_Crop.ToArray();
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            //方法
            string sMethod = this.cbx_Method.SelectedValue.ToString();
            //参数
            string HisPara1 = this.txt_HistPara1.Text;//组距
            string HisPara2 = this.cbx_N.SelectedValue.ToString();//[mu-N*sigma,mu+N*sigma]中的N
            string Percent = this.txt_Percent.Text;//百分数
            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            if (sMethod == "高斯拟合")
            {
                sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_gaussfit.pro";
                COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
                //try
                //{
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置

                oCom.SetIDLVariable("YieldFilenames", sFilename_Yield);
                oCom.SetIDLVariable("CropClassifyFilenames", sFilename_Crop);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);

                oCom.SetIDLVariable("HisPara1", HisPara1);
                oCom.SetIDLVariable("HisPara2", HisPara2);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("Nutrient_GaussFit,YieldFilenames,CropClassifyFilenames,OutputPath,HisPara1,HisPara2,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);
                //}
            }
            else
            {
                sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_percent.pro";
                COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
                //try
                //{
                //初始化
                oCom.CreateObject(0, 0, 0);

                oCom.SetIDLVariable("YieldFilenames", sFilename_Yield);
                oCom.SetIDLVariable("CropClassifyFilenames", sFilename_Crop);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);

                oCom.SetIDLVariable("HisPara1", HisPara1);
                oCom.SetIDLVariable("HisPara2", Percent);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("Nutrient_Percent,YieldFilenames,CropClassifyFilenames,OutputPath,HisPara1,HisPara2,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
        }
Пример #25
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.listViewImage.Items.Count <= 0)
            {
                MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_ImageOutPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.cbx_SensorType.SelectedValue.ToString().Equals("请选择"))
            {
                MessageBox.Show("请选择传感器类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.cbx_BandBlue.SelectedValue.ToString().Equals("请选择"))
            {
                MessageBox.Show("请选择蓝光波段!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.cbx_BandGreen.SelectedValue.ToString().Equals("请选择"))
            {
                MessageBox.Show("请选择绿光波段!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.cbx_BandRed.SelectedValue.ToString().Equals("请选择"))
            {
                MessageBox.Show("请选择红光波段!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.cbx_BandNInfrared.SelectedValue.ToString().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   sSensorType    = this.cbx_SensorType.SelectedValue.ToString();
            string   sBandBlue      = this.cbx_BandBlue.SelectedValue.ToString();
            string   sBandGreen     = this.cbx_BandGreen.SelectedValue.ToString();
            string   sBandRed       = this.cbx_BandRed.SelectedValue.ToString();
            string   sBandNInfrared = this.cbx_BandNInfrared.SelectedValue.ToString();

            string sImageOutPath = this.txt_ImageOutPath.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\openfile.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("filename", sFilename);
                oCom.SetIDLVariable("ImageOutPath", sIDLSavPath);
                oCom.SetIDLVariable("SensorType", sSensorType);
                oCom.SetIDLVariable("BandBlue", sBandBlue);
                oCom.SetIDLVariable("BandGreen", sBandGreen);
                oCom.SetIDLVariable("BandRed", sBandRed);
                oCom.SetIDLVariable("BandNInfrared", sBandNInfrared);

                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("OpenFile,filename,ImageOutPath=ImageOutPath,OutType,ErrorMSG=msg");
                object objArr = oCom.GetIDLVariable("msg");
                //MessageBox.Show(objArr.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                oCom.DestroyObject();

                MessageBox.Show("格式转换完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
            }

            #endregion
        }
Пример #26
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_ImageInput.Text.Equals(""))
            {
                MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sMinclass = this.txt_minclass.Text;
            if (sMinclass.Equals(""))
            {
                MessageBox.Show("请输入最小分类数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int  nMinclass;
            bool bMinclass = int.TryParse(sMinclass, out nMinclass);
            if (bMinclass == false)
            {
                MessageBox.Show("最小分类数只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sMaxclass = this.txt_maxclass.Text;
            if (sMaxclass.Equals(""))
            {
                MessageBox.Show("请输入最大分类数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int  nMaxclass;
            bool bMaxclass = int.TryParse(sMaxclass, out nMaxclass);
            if (bMaxclass == false)
            {
                MessageBox.Show("最大分类数只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (nMaxclass < nMinclass)
            {
                MessageBox.Show("最大分类数不能小于最小分类数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sIterations = this.txt_Iterations.Text;
            if (sIterations.Equals(""))
            {
                MessageBox.Show("请选择最大迭代次数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int  nIterations;
            bool bIterations = int.TryParse(sIterations, out nIterations);
            if (bIterations == false)
            {
                MessageBox.Show("最大迭代次数只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string sChangethersh = this.txt_changethersh.Text;
            if (sChangethersh.Equals(""))
            {
                MessageBox.Show("请输入变化阈值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int  nChangethersh;
            bool bChangethersh = int.TryParse(sChangethersh, out nChangethersh);
            if (bChangethersh == false)
            {
                MessageBox.Show("变化阈值只能为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (nChangethersh < 0 && nChangethersh > 100)
            {
                MessageBox.Show("变化阈值只能为0-100的数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            float fChangethersh = 0.00f;
            bool  f             = float.TryParse(sChangethersh, out fChangethersh);
            fChangethersh = fChangethersh / 100;

            if (this.txt_ImageOutPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string sFilename     = this.txt_ImageInput.Text.Trim();
            string sImageOutPath = this.txt_ImageOutPath.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\class_isodata.pro";

            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("inputfile", sFilename);
                oCom.SetIDLVariable("MIN_CLASSES", sMinclass);
                oCom.SetIDLVariable("NUM_CLASSES", sMaxclass);
                oCom.SetIDLVariable("ITERATIONS", sIterations);
                oCom.SetIDLVariable("CHANGE_THRESH", fChangethersh);
                oCom.SetIDLVariable("outputDir", sImageOutPath);
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("CLASS_ISODATA,inputfile,outputDir,ITERATIONS = ITERATIONS,NUM_CLASSES = NUM_CLASSES,CHANGE_THRESH = CHANGE_THRESH,MIN_CLASSES = MIN_CLASSES,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("分类完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            #endregion
        }
Пример #27
0
        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;
            }
            #endregion
            #region 界面参数获取
            //低空间分辨率影像路径
            string sFilename_LowPath = this.TextBox_LowPath.Text.Trim() + Path.DirectorySeparatorChar;
            //高空间分辨率影像路径
            string sFilename_HighPath = this.TextBox_HighPath.Text.Trim() + Path.DirectorySeparatorChar;
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            //融合方法
            string sMethod = this.cbx_Method.SelectedValue.ToString();
            //相似像元窗口大小
            string sWinSize = this.cbx_WinSize.SelectedValue.ToString();
            //基准影像窗口大小
            string sTWinSize = this.txt_TWinSize.Text.Trim();
            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\TSFusion.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("CFileDir", sFilename_LowPath);
                oCom.SetIDLVariable("FFileDir", sFilename_HighPath);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);
                oCom.SetIDLVariable("Method", sMethod);
                oCom.SetIDLVariable("WinSize", sWinSize);
                oCom.SetIDLVariable("TWinSize", sTWinSize);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("TSFusion,CFileDir,FFileDir,OutputPath,Method,WinSize,TWinSize,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
        }
Пример #28
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_filename_a0.Text.Equals(""))
            {
                MessageBox.Show("请选择输入气象数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_inputfile_lat.Text.Equals(""))
            {
                MessageBox.Show("请选择输入经纬度数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_inputfile_HJ.Text.Equals(""))
            {
                MessageBox.Show("请选择输入文件路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_maize_s.Text.Equals(""))
            {
                MessageBox.Show("请选择输出作物生长起始时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_outfilepath_bio.Text.Equals(""))
            {
                MessageBox.Show("请选择输出文件路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string   txtfilenamea      = this.txt_filename_a0.Text.Trim();
            string   txtinputfilelat   = this.txt_inputfile_lat.Text.Trim();
            string   txtinputfileHJ    = this.txt_inputfile_HJ.Text.Trim() + "\\";
            string   txtoutfilepathbio = this.txt_outfilepath_bio.Text.Trim() + "\\";
            int[]    cropLive          = new int [3];
            DateTime ymd0 = this.dT_maize_s.Value;
            cropLive[0] = ymd0.Year;
            cropLive[1] = ymd0.Month;
            cropLive[2] = ymd0.Day;
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\bio_hongxing.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("meteorology_data", txtfilenamea);
                oCom.SetIDLVariable("latitude", txtinputfilelat);
                oCom.SetIDLVariable("start_end_day", cropLive);
                oCom.SetIDLVariable("HJ_file", txtinputfileHJ);
                oCom.SetIDLVariable("out_bio", txtoutfilepathbio);
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("bio_hongxing,latitude=latitude, HJ_file=HJ_file, meteorology_data=meteorology_data, out_bio=out_bio,start_end_day=start_end_day, Message= Message");
                object objArr = oCom.GetIDLVariable("Message");
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    this.btn_ok.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("每日生物量计算完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            #endregion
        }
Пример #29
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_filename_a0.Text.Equals(""))
            {
                MessageBox.Show("请选择输入气象数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_inputfile_lat.Text.Equals(""))
            {
                MessageBox.Show("请选择输入经纬度数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_inputfile_HJ.Text.Equals(""))
            {
                MessageBox.Show("请选择输入文件路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.dT_maize_s.Text.Equals(""))
            {
                MessageBox.Show("请选择输出作物生长起始时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_outfilepath_bio.Text.Equals(""))
            {
                MessageBox.Show("请选择输出文件路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string txtfilenamea = this.txt_filename_a0.Text.Trim();
            string txtinputfilelat = this.txt_inputfile_lat.Text.Trim();
            string txtinputfileHJ = this.txt_inputfile_HJ.Text.Trim()+"\\";
            string txtoutfilepathbio = this.txt_outfilepath_bio.Text.Trim()+ "\\";
            int[] cropLive = new int [3];
            DateTime ymd0 = this.dT_maize_s.Value;
            cropLive[0] = ymd0.Year ;
            cropLive[1] = ymd0.Month ;
            cropLive[2] = ymd0.Day;
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\bio_hongxing.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("meteorology_data", txtfilenamea);
                oCom.SetIDLVariable("latitude", txtinputfilelat);
                oCom.SetIDLVariable("start_end_day", cropLive);
                oCom.SetIDLVariable("HJ_file", txtinputfileHJ);
                oCom.SetIDLVariable("out_bio", txtoutfilepathbio);
                //编译IDL功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("bio_hongxing,latitude=latitude, HJ_file=HJ_file, meteorology_data=meteorology_data, out_bio=out_bio,start_end_day=start_end_day, Message= Message");
                object objArr = oCom.GetIDLVariable("Message");
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    this.btn_ok.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("每日生物量计算完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            #endregion
        }
Пример #30
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_Filename_Cropland.Text.Equals(""))
            {
                MessageBox.Show("请选择输入作物分布图路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_Filename_harvest.Text.Equals(""))
            {
                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.txt_outFilename_N.Text.Equals(""))
            {
                MessageBox.Show("请选择输入碱解氮含量输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_outFilename_O.Text.Equals(""))
            {
                MessageBox.Show("请选择输入有机质含量输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string FilenameCropland = this.txt_Filename_Cropland.Text.Trim();
            string FilenameHharvest = this.txt_Filename_harvest.Text.Trim();
            string outFilenameN = this.txt_outFilename_N.Text.Trim();

            string outFilenameO = this.txt_outFilename_O.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\harvest_to_soil_nitrogen.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("in_farm_land", FilenameCropland);
                oCom.SetIDLVariable("in_crop_harvest", FilenameHharvest);
                oCom.SetIDLVariable("out_dir_N", outFilenameN);
                oCom.SetIDLVariable("out_dir_O", outFilenameO);
                //编译idl功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("harvest_to_soil_nitrogen,in_farm_land,in_crop_harvest,out_dir_N,out_dir_O,message = message");
                object objArr = oCom.GetIDLVariable("message");
                //返回错误消息
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("养分监测完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled = true;
                this.btn_OpenOutPut.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #31
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_YieldPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入单产影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_OutputPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            #region 界面参数获取
            //单产文件
            List<string> list_Yield = new List<string>();
            foreach (ListViewItem item in this.listView_Yield.Items)
            {
                string s = this.TextBox_YieldPath.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Yield.Add(s);
            }
            string[] sFilename_Yield = (string[])list_Yield.ToArray();
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            #endregion
            #region
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\nutrient_N.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("YieldFilenames", sFilename_Yield);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                oCom.ExecuteString("Nutrient_N,YieldFilenames,OutputPath,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                //返回错误消息
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    return;
                }
                oCom.DestroyObject();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
Пример #32
0
        //private void btn_OpenOutPut_Click(object sender, EventArgs e)
        //{
        //    string sFilename = this.txt_outfilepath_O.Text.Trim();
        //    string sPath = Path.GetDirectoryName(sFilename);
        //    System.Diagnostics.Process.Start("explorer.exe", sPath);
        //}

        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_inputfile_HJccd.Text.Equals(""))
            {
                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.txt_inputfile_landclass.Text.Equals(""))
            {
                MessageBox.Show("请选择输入裸土分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_outfilepath_O.Text.Equals(""))
            {
                MessageBox.Show("请选择输入输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            string txtinputfileHJccd     = this.txt_inputfile_HJccd.Text.Trim();
            string txtinputfilelandclass = this.txt_inputfile_landclass.Text.Trim();
            string txtoutfilepathO       = this.txt_outfilepath_O.Text.Trim();

            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\ccdimg_to_soil_nitrogen.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("inputfile_path", txtinputfileHJccd);
                oCom.SetIDLVariable("inputfile_crop", txtinputfilelandclass);
                oCom.SetIDLVariable("outputfile_path", txtoutfilepathO);

                //编译idl功能源码
                oCom.ExecuteString(".compile '" + sIDLSavPath + "'");
                oCom.ExecuteString("ccdimg_to_soil_nitrogen,inputfile_path,inputfile_crop,outputfile_path,message = message");
                object objArr = oCom.GetIDLVariable("message");
                //返回错误消息
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("养分监测完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }