예제 #1
0
        private void BindDataSource()
        {
            string    sPath = FileManage.getApplicatonPath() + "cropcode.xml";
            DataTable dt    = XmlManage.getCropCodeFromXml(sPath);

            gridControl1.DataSource = dt;
        }
예제 #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
        }
예제 #3
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";

            HistogramShow vHistogramShow = new HistogramShow(this);
            vHistogramShow.ShowDialog();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
            #endregion
        }
예제 #4
0
        /// <summary>
        /// “更多符号”按下时触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMoreSymbols_Click(object sender, EventArgs e)
        {
            if (this.contextMenuMoreSymbolInitiated == false)
            {
                //string sInstall = ReadRegistry("SOFTWARE\\ESRI\\Desktop10.1\\CoreRuntime");
                //string path2 = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\") - 3) + "\\FeatureStyle";
                string path2 = FileManage.getApplicatonPath() + "FeatureStyle";
                //取得菜单项数量
                string[]            styleNames            = System.IO.Directory.GetFiles(path2, "*.ServerStyle");
                ToolStripMenuItem[] symbolContextMenuItem = new ToolStripMenuItem[styleNames.Length + 1];
                //循环添加其它符号菜单项到菜单
                for (int i = 0; i < styleNames.Length; i++)
                {
                    symbolContextMenuItem[i] = new ToolStripMenuItem();
                    symbolContextMenuItem[i].CheckOnClick = true;
                    symbolContextMenuItem[i].Text         = System.IO.Path.GetFileNameWithoutExtension(styleNames[i]);
                    if (symbolContextMenuItem[i].Text == "ESRI")
                    {
                        symbolContextMenuItem[i].Checked = true;
                    }
                    symbolContextMenuItem[i].Name = styleNames[i];
                }
                //添加“更多符号”菜单项到菜单最后一项
                symbolContextMenuItem[styleNames.Length]      = new ToolStripMenuItem();
                symbolContextMenuItem[styleNames.Length].Text = "添加符号";
                symbolContextMenuItem[styleNames.Length].Name = "AddMoreSymbol";

                //添加所有的菜单项到菜单
                this.contextMenuStripMoreSymbol.Items.AddRange(symbolContextMenuItem);
                this.contextMenuMoreSymbolInitiated = true;
            }
            //显示菜单
            this.contextMenuStripMoreSymbol.Show(this.btnMoreSymbols.Location);
        }
예제 #5
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
        }
예제 #6
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
 }
예제 #7
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输出路径
            if (this.txt_WatertableOutpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;

            #region 界面参数获取
            string sWatertableOutpath = this.txt_WatertableOutpath.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            //string sIDLSavPath = Application.StartupPath; ;
            //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin"));
            string sIDLSavPath     = FileManage.getApplicatonPath();
            string sIDLSavPath_pro = sIDLSavPath + "IDLSav\\main_water_buildtable.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("watertableoutpath", sWatertableOutpath);
                //编译IDL功能源码

                string sIDLSavPath_sav = sIDLSavPath + "IDLSav\\prosail_idl.sav";
                oCom.ExecuteString("restore,\'" + sIDLSavPath_sav + "\'");
                oCom.ExecuteString(".compile '" + sIDLSavPath_pro + "'");
                oCom.ExecuteString("main_water_buildtable,watertableoutpath=watertableoutpath,Message=Message");

                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    this.btn_ok.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("查找表建立完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled             = true;
                this.btn_OpenOutPutpath.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            #endregion
        }
예제 #8
0
        /// <summary>
        /// 输出类型数据绑定,从XML文件中获取
        /// </summary>
        public void ComBoxDataBind()
        {
            string sPath = FileManage.getApplicatonPath();

            //string sPath = Application.StartupPath;
            sPath = sPath + "ImageFormatType.xml";
            List <string> list = XmlManage.getXmlListByNodesName(sPath, "ImageFormatType", "OutPutType", "Name");

            this.cbx_FormatType.DataSource = list;
        }
예제 #9
0
        private void barBtnItemRecode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string sIDLSavPath = FileManage.getApplicatonPath();

            sIDLSavPath = sIDLSavPath + "IDLSav\\recode.sav";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            //初始化
            oCom.CreateObject(0, 0, 0);
            oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
            oCom.ExecuteString("RECODE");
            CodeListXtraForm clxf = new CodeListXtraForm();

            clxf.ShowDialog();
        }
예제 #10
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
        }
        /// <summary>
        /// 输出类型数据绑定,从XML文件中获取
        /// </summary>
        public void ComBoxDataBind()
        {
            string sPath = FileManage.getApplicatonPath();

            sPath = sPath + "ImageFormatType.xml";
            List <string> listHJSensorType = XmlManage.getXmlListByNodesName(sPath, "ImageFormatType", "HJSensorType", "Name");

            this.cbx_SensorType.DataSource = listHJSensorType;
            List <string> listHJBandType = XmlManage.getXmlListByNodesName(sPath, "ImageFormatType", "HJBandType", "Name");

            string[] sBandBlue = listHJBandType.ToArray();
            this.cbx_BandBlue.DataSource = sBandBlue;
            string[] sBandGreen = listHJBandType.ToArray();
            this.cbx_BandGreen.DataSource = sBandGreen;
            string[] sBandRed = listHJBandType.ToArray();
            this.cbx_BandRed.DataSource = sBandRed;
            string[] sBandNInfrared = listHJBandType.ToArray();
            this.cbx_BandNInfrared.DataSource = sBandNInfrared;
        }
예제 #12
0
        /// <summary>
        /// InputFileselect,mutiply
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_InPutFile_Click(object sender, EventArgs e)
        {
            this.listViewImage.GridLines = true;
            OpenFileDialog dlg   = new OpenFileDialog();  //创建一个OpenFileDialog
            string         sPath = FileManage.getApplicatonPath();

            sPath = sPath + "ImageFormatType.xml";
            List <string> list = XmlManage.getXmlListByNodesName(sPath, "ImageFormatType", "InputType", "Name");
            string        strs = "";
            string        str1 = "";
            string        str2 = "";

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i].ToString();
                str1 += item + ";";
                str2 += item + ";";
                strs += "(" + item + ")|" + item + "|";
            }
            //MessageBox.Show("str1=" + str1 + "\n" + " str2=" + str2);
            string str3 = "(" + str1 + ")|" + str2 + "|";

            strs            = strs + "(*.*)|*.*";
            dlg.Filter      = str3 + strs;
            dlg.Multiselect = true;//设置属性为多选
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string str = " ";
                for (int i = 0; i < dlg.FileNames.Length; i++)  //根据数组长度定义循环次数
                {
                    str = dlg.FileNames.GetValue(i).ToString(); //获取文件文件名
                    ListViewItem item = new ListViewItem()
                    {
                        Text = "  " + str
                    };
                    this.listViewImage.Items.Add(item);
                }
            }
        }
예제 #13
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            //作物分布图
            if (this.txt_ImageCrop_Inputpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //CCD影像输入
            if (this.txt_CCDImageInputpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入CCD影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.listViewCCDImage.Items.Count <= 0)
            {
                MessageBox.Show("请选择输入CCD影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            DateTime dtCCDData = this.dT_CCDData.Value;
            if (dtCCDData.Date == System.DateTime.Now.Date)
            {
                DialogResult dr;
                dr = MessageBox.Show("请确认影像过境时间是否是今天!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dr == DialogResult.No)
                {
                    return;
                }
            }
            //IRS数据
            if (this.txt_IRSImageInputpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入IRS影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.listViewIRSImage.Items.Count <= 0)
            {
                MessageBox.Show("请选择输入IRS影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (this.txt_SoybeanMDoutpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;
            #region 界面参数获取
            //CCD数据
            List <string> list_CCD = new List <string>();
            foreach (ListViewItem item in this.listViewCCDImage.Items)
            {
                //设置路径
                string s = item.SubItems[0].Text.Trim();
                list_CCD.Add(s);
            }
            string[] sFilename_CCD = (string[])list_CCD.ToArray();
            //IRS数据
            List <string> list_IRS = new List <string>();
            foreach (ListViewItem item in this.listViewIRSImage.Items)
            {
                //设置路径
                string s = item.SubItems[0].Text.Trim();
                list_IRS.Add(s);
            }
            string[] sFilename_IRS = (string[])list_IRS.ToArray();
            //输出路径
            string sImageCrop_Inputpath = this.txt_ImageCrop_Inputpath.Text.Trim();
            string sSoybeanMDoutpath    = this.txt_SoybeanMDoutpath.Text.Trim();
            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            //string sIDLSavPath = Application.StartupPath;
            //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin"));
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\SoybeanMD.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("Image_crop_inputpath", sImageCrop_Inputpath);
                oCom.SetIDLVariable("CCDImageInputpath", sFilename_CCD);
                oCom.SetIDLVariable("IRSImageInputpath", sFilename_IRS);
                oCom.SetIDLVariable("Soybeanoutpath", sSoybeanMDoutpath);
                //编译IDL功能源码

                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                oCom.ExecuteString("SoybeanMD,CCDImageInputpath=CCDImageInputpath,IRSImageInputpath=IRSImageInputpath,"
                                   + "Soybeanoutpath=Soybeanoutpath,Image_crop_inputpath=Image_crop_inputpath,Message=Message");
                //oCom.ExecuteString("CCDImageInputpath=CCDImageInputpath,IRSImageInputpath=IRSImageInputpath,Soybeanoutpath=Soybeanoutpath,Image_crop_inputpath=Image_crop_inputpath,Message=Message");

                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    this.btn_ok.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("大豆成熟期预测完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled             = true;
                this.btn_OpenOutPutpath.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
예제 #14
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输出路径
            if (this.txt_chtableOutPutpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.cbx_CCDType.SelectedValue.ToString().Equals("请选择"))
            {
                MessageBox.Show("请选择数据类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;

            #region 界面参数获取
            string scbx_CCDType = this.cbx_CCDType.SelectedValue.ToString();
            //输出路径的选择非常重要
            string schtableOutPutpath = this.txt_chtableOutPutpath.Text.Trim();
            #endregion


            #region 调用IDL程序
            //IDLSav的路径
            // sIDLSavPath为"D:\\3_HongXing\\6_software\\CropWatchField\\CropWatchField\\bin\\Debug"
            // sIDLSavPath2为"D:\\3_HongXing\\6_software\\CropWatchField\\CropWatchField\\"
            //pro的路径正确

            //string sIDLSavPath = Application.StartupPath;
            //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin"));
            string sIDLSavPath     = FileManage.getApplicatonPath();
            string sIDLSavPath_pro = sIDLSavPath + "IDLSav\\main_ch_buildtable.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("inputtype", scbx_CCDType);
                oCom.SetIDLVariable("chtableoutpath", schtableOutPutpath);
                //编译IDL功能源码
                string sIDLSavPath_sav = sIDLSavPath + "IDLSav\\prosail_idl.sav";
                oCom.ExecuteString("restore,\'" + sIDLSavPath_sav + "\'");
                oCom.ExecuteString(".compile '" + sIDLSavPath_pro + "'");
                oCom.ExecuteString("main_ch_buildtable,inputtype=inputtype,chtableoutpath=chtableoutpath,Message=Message");

                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    this.btn_ok.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("查找表建立完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled             = true;
                this.btn_OpenOutPutpath.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            #endregion
        }
예제 #15
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.textBox_CCDPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入CCD影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.textBox_IRSPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入IRS影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.textBox_OutPutPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.listView_CCD.Items.Count != this.listView_IRS.Items.Count)
            {
                MessageBox.Show("输入的CCD影像数和IRS影像数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_Ok.Enabled = false;
            #region 界面参数获取
            //   CCD影像
            List <string> List_CCD = new List <string>();
            foreach (ListViewItem item in this.listView_CCD.Items)
            {
                string s = this.textBox_CCDPath.Text + "\\" + item.SubItems[0].Text.Trim();
                List_CCD.Add(s);
            }
            string[] sFilename_CCD = (string[])List_CCD.ToArray();
            //   IRS影像
            List <string> List_IRS = new List <string>();
            foreach (ListViewItem item in this.listView_IRS.Items)
            {
                string s = this.textBox_IRSPath.Text + "\\" + item.SubItems[0].Text.Trim();
                List_IRS.Add(s);
            }
            string[] sFilename_IRS = (string[])List_IRS.ToArray();
            //输出路径
            string sFilename_Output = this.textBox_OutPutPath.Text.Trim();
            //方法
            string sMethod = this.cbx_Method.SelectedValue.ToString();

            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\ndsi.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("FilenameCCD", sFilename_CCD);
                oCom.SetIDLVariable("FilenameIRS", sFilename_IRS);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);
                //  oCom.SetIDLVariable("Method", sMethod);
                //               编译IDL功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                oCom.ExecuteString("NDSI,FilenameCCD,FilenameIRS,OutputPath,Message=Message");
                //               object objArr = oCom.GetIDLVariable("Message");
                //               返回错误消息
                //               if (objArr != null)
//                {
//                   MessageBox.Show(objArr.ToString());
//                   oCom.DestroyObject();
//                    this.btn_Ok.Enabled = true;
//                    return;
//               }
                oCom.DestroyObject();
                MessageBox.Show("计算完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_Ok.Enabled             = true;
                this.btn_OpenOutPutPath.Visible = true;
            }
            catch (Exception ex)
            {
                //  MessageBox.Show(ex.Message);
            }
            #endregion
        }
예제 #16
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;
 }
예제 #17
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_SpecAve_1.Checked && !this.cbx_SpecStd_2.Checked && !this.cbx_SpecERGAS_3.Checked && !this.cbx_SpecD_4.Checked &&
                !this.cbx_SpecAngMap_5.Checked && !this.cbx_CCSpec_6.Checked && !this.cbx_SpatAve_7.Checked && !this.cbx_SpatStd_8.Checked &&
                !this.cbx_AveGra_9.Checked && !this.cbx_CCSpat_10.Checked && !this.cbx_SpatERGAS_11.Checked)
            {
                MessageBox.Show("请至少选择一项评价指标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_OK.Enabled = false;
            #region 界面参数获取
            //待评价影像
            List <string> list_Ass = new List <string>();
            foreach (ListViewItem item in this.listView_Ass.Items)
            {
                string s = this.TextBox_AssImg.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Ass.Add(s);
            }
            string[] sFilename_Ass = (string[])list_Ass.ToArray();
            sGlobal_Filename_Ass = sFilename_Ass;
            //参考影像
            List <string> list_Ref = new List <string>();
            foreach (ListViewItem item in this.listView_Ref.Items)
            {
                string s = this.TextBox_RefImg.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Ref.Add(s);
            }
            string[] sFilename_Ref = (string[])list_Ref.ToArray();
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            sGlobal_OutDir = sFilename_Output;
            //何种质量
            string sQuaKind = this.combx_Qua.SelectedValue.ToString();
            string sQuaKindEn;
            if (sQuaKind == "光谱质量")
            {
                sQuaKindEn = "SpecQua";
            }
            else
            {
                sQuaKindEn = "SpatQua";
            }
            sGlobal_QuaKindEn = sQuaKindEn;
            //评价指标
            string[] sQuaArr = new string[] { "", "", "", "", "", "", "", "", "", "", "" };
            if (this.cbx_SpecAve_1.Checked)
            {
                sQuaArr[0] = "TRUE";
            }
            if (this.cbx_SpecStd_2.Checked)
            {
                sQuaArr[1] = "TRUE";
            }
            if (this.cbx_SpecERGAS_3.Checked)
            {
                sQuaArr[2] = "TRUE";
            }
            if (this.cbx_SpecD_4.Checked)
            {
                sQuaArr[3] = "TRUE";
            }
            if (this.cbx_SpecAngMap_5.Checked)
            {
                sQuaArr[4] = "TRUE";
            }
            if (this.cbx_CCSpec_6.Checked)
            {
                sQuaArr[5] = "TRUE";
            }
            if (this.cbx_SpatAve_7.Checked)
            {
                sQuaArr[6] = "TRUE";
            }
            if (this.cbx_SpatStd_8.Checked)
            {
                sQuaArr[7] = "TRUE";
            }
            if (this.cbx_AveGra_9.Checked)
            {
                sQuaArr[8] = "TRUE";
            }
            if (this.cbx_CCSpat_10.Checked)
            {
                sQuaArr[9] = "TRUE";
            }
            if (this.cbx_SpatERGAS_11.Checked)
            {
                sQuaArr[10] = "TRUE";
            }
            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\SpecFusionAss.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置

                oCom.SetIDLVariable("FilenameAss", sFilename_Ass);
                oCom.SetIDLVariable("FilenameRef", sFilename_Ref);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);
                oCom.SetIDLVariable("QuaKind", sQuaKindEn);
                oCom.SetIDLVariable("QuaArr", sQuaArr);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("SpecFusionAss,FilenameAss,FilenameRef,OutputPath,QuaKind,QuaArr,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                //返回错误消息
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    this.btn_OK.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("光谱融合质量评价完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_OK.Enabled             = true;
                this.btn_OpenOutputPath.Visible = true;
                QuaAssShowForm vSpecQuaAssShowForm = new QuaAssShowForm(this);
                vSpecQuaAssShowForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
            this.btn_OK.Enabled = true;
        }
예제 #18
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
 }
예제 #19
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
        }
예제 #20
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
        }
예제 #21
0
        /// <summary>
        /// 从注册表中取得指定软件的路径
        /// </summary>
        /// <param name="sKey"></param>
        /// <returns></returns>
        //private string ReadRegistry(string sKey)
        //{
        //    //Open the subkey for reading
        //    Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey, true);
        //    if (rk == null) return "";
        //    // Get the data from a specified item in the key.
        //    return (string)rk.GetValue("InstallDir");
        //}

        private void SymbolSelectorFrm_Load(object sender, EventArgs e)
        {
            //取得ArcGIS安装路径
            //string sInstall = ReadRegistry("SOFTWARE\\ESRI\\Desktop10.1\\CoreRuntime");
            //载入ESRI.ServerStyle文件到SymbologyControl
            //string path1 = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\") - 3);
            string path1 = FileManage.getApplicatonPath();

            this.axSymbologyControl.LoadStyleFile(path1 + "FeatureStyle\\ESRI.ServerStyle");
            //确定图层的类型(点线面),设置好SymbologyControl的StyleClass,设置好各控件的可见性(visible)
            IGeoFeatureLayer pGeoFeatureLayer = (IGeoFeatureLayer)pLayer;

            switch (((IFeatureLayer)pLayer).FeatureClass.ShapeType)
            {
            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
                this.SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassMarkerSymbols);
                this.lblAngle.Visible        = true;
                this.nudAngle.Visible        = true;
                this.lblSize.Visible         = true;
                this.nudSize.Visible         = true;
                this.lblWidth.Visible        = false;
                this.nudWidth.Visible        = false;
                this.lblOutlineColor.Visible = false;
                this.btnOutlineColor.Visible = false;
                break;

            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
                this.SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassLineSymbols);
                this.lblAngle.Visible        = false;
                this.nudAngle.Visible        = false;
                this.lblSize.Visible         = false;
                this.nudSize.Visible         = false;
                this.lblWidth.Visible        = true;
                this.nudWidth.Visible        = true;
                this.lblOutlineColor.Visible = false;
                this.btnOutlineColor.Visible = false;
                break;

            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
                this.SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassFillSymbols);
                this.lblAngle.Visible        = false;
                this.nudAngle.Visible        = false;
                this.lblSize.Visible         = false;
                this.nudSize.Visible         = false;
                this.lblWidth.Visible        = true;
                this.nudWidth.Visible        = true;
                this.lblOutlineColor.Visible = true;
                this.btnOutlineColor.Visible = true;
                break;

            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch:
                this.SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassFillSymbols);
                this.lblAngle.Visible        = false;
                this.nudAngle.Visible        = false;
                this.lblSize.Visible         = false;
                this.nudSize.Visible         = false;
                this.lblWidth.Visible        = true;
                this.nudWidth.Visible        = true;
                this.lblOutlineColor.Visible = true;
                this.btnOutlineColor.Visible = true;
                break;

            default:
                this.Close();
                break;
            }
        }
예제 #22
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
 }
예제 #23
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
        }
        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
        }
예제 #25
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
        }
예제 #26
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     #region 输入与输出路径条件判断
     if (this.textBox_NdsiPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输入NDSI图像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.textBox_OutPutPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     #endregion
     this.btn_Ok.Enabled = false;
     #region 界面参数获取
     //   NDSI图像
     List <string> List_NDSI = new List <string>();
     foreach (ListViewItem item in this.listView_NDSI.Items)
     {
         string s = this.textBox_NdsiPath.Text + "\\" + item.SubItems[0].Text.Trim();
         List_NDSI.Add(s);
     }
     string[] sFilename_NDSI = (string[])List_NDSI.ToArray();
     //输出路径
     string sFilename_Output = this.textBox_OutPutPath.Text.Trim();
     #endregion
     #region 调用IDL程序
     //IDLSav的路径
     string sIDLSavPath = FileManage.getApplicatonPath();
     sIDLSavPath = sIDLSavPath + "IDLSav\\threshold_method.pro";
     COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
     try
     {
         //初始化
         oCom.CreateObject(0, 0, 0);
         //参数设置
         oCom.SetIDLVariable("FilenameNDSI", sFilename_NDSI);
         oCom.SetIDLVariable("OutPutPath", sFilename_Output);
         //编译IDL功能源码
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         oCom.ExecuteString("threshold_method,FilenameNDSI,OutPutPath,Message=Message");
         object objArr = oCom.GetIDLVariable("Message");
         //返回错误消息
         if (objArr != null)
         {
             MessageBox.Show(objArr.ToString());
             oCom.DestroyObject();
             this.btn_Ok.Enabled = true;
             return;
         }
         oCom.DestroyObject();
         MessageBox.Show("计算完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.btn_Ok.Enabled             = true;
         this.btn_OpenOutPutPath.Visible = true;
     }
     catch (Exception ex)
     {
         //    MessageBox.Show(ex.Message);
     }
     #endregion
 }
예제 #27
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_ImageInput.Text.Equals(""))
            {
                MessageBox.Show("请输入影像目录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (this.txt_ReferenceImage.Text.Equals(""))
            {
                MessageBox.Show("请选择参考文件总目录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_winrar.Text.Equals(""))
            {
                MessageBox.Show("请选择解压缩文件WinRAR目录!", "提示", 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 界面参数获取
            string sInputDIR     = this.txt_ImageInput.Text.Trim();
            string sReferenceDIR = this.txt_ReferenceImage.Text.Trim();
            string sOuputDIR     = this.txt_ImageOutPath.Text.Trim();
            string sWinrarDIR    = this.txt_winrar.Text.Trim();
            sInputDIR     = StringFormater.GetMarkedDirectory(sInputDIR);
            sReferenceDIR = StringFormater.GetMarkedDirectory(sReferenceDIR);
            sOuputDIR     = StringFormater.GetMarkedDirectory(sOuputDIR);
            sWinrarDIR    = StringFormater.GetMarkedDirectory(sWinrarDIR);
            DirectoryInfo source = new DirectoryInfo(sInputDIR);
            if (!source.Exists)
            {
                MessageBox.Show("输入文件夹不存在:" + sInputDIR, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            source = new DirectoryInfo(sReferenceDIR);
            if (!source.Exists)
            {
                MessageBox.Show("参考文件夹不存在:" + sInputDIR, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            source = new DirectoryInfo(sOuputDIR);
            if (!source.Exists)
            {
                try
                {
                    source.Create();
                }
                catch (Exception)
                {
                    MessageBox.Show("输出文件夹不存在,而且不能创建:" + sOuputDIR, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            source = new DirectoryInfo(sWinrarDIR);
            if (!source.Exists)
            {
                MessageBox.Show("Winrar文件夹不存在:" + sWinrarDIR, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                string sWinrarEXE = StringFormater.GetMarkedDirectory(sWinrarDIR) + "WinRAR.exe";
                if (!System.IO.File.Exists(sWinrarEXE))
                {
                    MessageBox.Show("WinRAR.exe 不存在:" + sWinrarEXE, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\HJPreProSysWinV3_1.pro";
            int iACTFlag    = this.checkBox2.Checked ? 1 : 0;
            int iDeleteFlag = this.checkBox1.Checked ? 1 : 0;
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                //oCom.SetIDLVariable("InputDIR", sInputDIR);
                //oCom.SetIDLVariable("OutPutDIR", sOuputDIR);
                //oCom.SetIDLVariable("WinrarDIR", sWinrarDIR);
                //oCom.SetIDLVariable("ATCFlag", iACTFlag);
                //oCom.SetIDLVariable("DeleteFlag", iDeleteFlag);
                oCom.ExecuteString(".compile '" + sIDLSavPath);
                this.toolStripStatusLabel2.Text = "运行中,请等候";
                this.statusStrip1.Refresh();
                string comstr = "HJPreProSysWinV3_1,'" + sInputDIR + "','" + sOuputDIR + "','" + sWinrarDIR + "','" + sReferenceDIR + "'," + iACTFlag.ToString() + "," + iDeleteFlag.ToString();

                oCom.ExecuteString(comstr);
                //oCom.ExecuteString("HJPreProSysWinV3_1,InputDIR,OutPutDIR,WinrarDIR,ATCFlag,DeleteFlag");
                this.toolStripStatusLabel2.Text = "运行完成";
                this.statusStrip1.Refresh();

                oCom.DestroyObject();
                MessageBox.Show("几何纠正完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled         = true;
                this.btn_OpenOutPut.Visible = true;
                //写配置文件
                string       sCfgPath = System.AppDomain.CurrentDomain.BaseDirectory + "ExeConfig.txt";
                StreamWriter sw       = new StreamWriter(sCfgPath);
                sw.WriteLine(this.txt_ImageInput.Text);
                sw.WriteLine(this.txt_ReferenceImage.Text);
                sw.WriteLine(this.txt_winrar.Text);
                sw.WriteLine(this.txt_ImageOutPath.Text);
                sw.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
        }
예제 #28
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.txt_WatertableInpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入查找表!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_ImageRefer_Inputpath.Text.Equals(""))
            {
                MessageBox.Show("请选择输入作物分布图!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.listViewImage.Items.Count <= 0)
            {
                MessageBox.Show("请选择输入影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            DateTime dtRSData = this.dT_RSData.Value;
            if (dtRSData.Date == System.DateTime.Now.Date)
            {
                DialogResult dr;
                dr = MessageBox.Show("请确认影像过境时间是否是今天!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dr == DialogResult.No)
                {
                    return;
                }
            }
            if (this.cbx_CropType.SelectedValue.ToString().Equals("请选择"))
            {
                MessageBox.Show("请选择作物类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.txt_WaterImageOutPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_ok.Enabled = false;

            #region 界面参数获取
            List <string> list = new List <string>();
            foreach (ListViewItem item in this.listViewImage.Items)
            {
                string s = item.SubItems[0].Text.Trim();
                list.Add(s);
            }
            string[] sFilename             = (string[])list.ToArray();
            string   scbx_CropType         = this.cbx_CropType.SelectedValue.ToString();
            string   sWatertableInpath     = this.txt_WatertableInpath.Text.Trim();
            string   sImageRefer_Inputpath = this.txt_ImageRefer_Inputpath.Text.Trim();
            string   sWaterImageOutPath    = this.txt_WaterImageOutPath.Text.Trim();
            #endregion

            #region 调用IDL程序
            //IDLSav的路径
            //string sIDLSavPath = Application.StartupPath;
            //sIDLSavPath = sIDLSavPath.Substring(0, Application.StartupPath.LastIndexOf("bin"));
            string sIDLSavPath     = FileManage.getApplicatonPath();
            string sIDLSavPath_pro = sIDLSavPath + "IDLSav\\main_water_retrieve_Crop.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置
                oCom.SetIDLVariable("watertableinpath", sWatertableInpath);
                oCom.SetIDLVariable("Image_crop_inputpath", sImageRefer_Inputpath);
                oCom.SetIDLVariable("inputFiles", sFilename);
                oCom.SetIDLVariable("waterimageoutpath", sWaterImageOutPath);
                oCom.SetIDLVariable("CropType", scbx_CropType);
                //编译IDL功能源码
                //string sIDLSavPath_sav = sIDLSavPath + "IDLSav\\prosail_idl.sav";
                //oCom.ExecuteString("restore,\'" + sIDLSavPath_sav + "\'");
                oCom.ExecuteString(".compile '" + sIDLSavPath_pro + "'");
                oCom.ExecuteString("main_water_retrieve_Crop,watertableinpath=watertableinpath,"
                                   + "CropType=CropType,inputFiles=inputFiles,waterimageoutpath=waterimageoutpath,"
                                   + "Image_crop_inputpath=Image_crop_inputpath,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                //MessageBox.Show(objArr.ToString());
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    this.btn_ok.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("冠层水分含量分布图建立完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_ok.Enabled             = true;
                this.btn_OpenOutPutpath.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            #endregion
        }
예제 #29
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
        }
예제 #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
        }