コード例 #1
0
        private void siBOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cmbInRaster.Text.TrimEnd()))
            {
                XtraMessageBox.Show("输入文件不能为空!");
                return;
            }
            else if (cBEBlue.SelectedIndex < 0)
            {
                XtraMessageBox.Show("请选择蓝光波段!");
                return;
            }
            else if (cBERed.SelectedIndex < 0)
            {
                XtraMessageBox.Show("请选择红光波段!");
                return;
            }
            else if (cBENIRed.SelectedIndex < 0)
            {
                XtraMessageBox.Show("请选择近红外波段!");
                return;
            }
            else if (string.IsNullOrEmpty(txtOut.Text.TrimEnd()))
            {
                XtraMessageBox.Show("输出文件不能为空!");
                return;
            }
            else
            {
                frmWaitDialog frmWait = new frmWaitDialog("提示", "正在计算......");
                try
                {
                    frmWait.Owner   = this;
                    frmWait.TopMost = false;
                    VegetationIndex.Calculate(VegIndex.EVI, cmbInRaster.Text.TrimEnd(), txtOut.Text.TrimEnd()
                                              , cBERed.SelectedIndex, cBENIRed.SelectedIndex, cBEBlue.SelectedIndex);

                    if (DialogResult.OK == XtraMessageBox.Show("计算完毕,是否加载结果文件?", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                    {
                        MAP.AddRasterFileToMap(txtOut.Text.TrimEnd());
                    }

                    this.Close();
                }

                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    Log.WriteLog(typeof(frmEVI), ex);
                }
                finally
                {
                    frmWait.Close();
                }
            }
        }
コード例 #2
0
ファイル: frmNeuralNet.cs プロジェクト: rs-sdust/GFStatistics
        private void btnOK_Click(object sender, EventArgs e)
        {
            frmWaitDialog frmWait = new frmWaitDialog("正在分类...", "提示信息");

            try
            {
                frmWait.Owner   = this;
                frmWait.TopMost = false;
                NeuralNet ooC = new NeuralNet(cmbInRaster.Text, txtROI.Text, actFun,
                                              float.Parse(spinContribution.EditValue.ToString()), float.Parse(spinTraingRate.EditValue.ToString()),
                                              float.Parse(spinMomentum.EditValue.ToString()), float.Parse(spinCriteria.EditValue.ToString()),
                                              hiddenLyr, maxSweep, minActThres, txtOut.Text);
                ooC.Execute();
                BLL.ProductMeta meta = new ProductMeta(txtOut.Text.TrimEnd(), "", "", "面向对象识别", "作物识别结果");
                meta.WriteGeoMeta();
                BLL.ProductQuickView view = new BLL.ProductQuickView(txtOut.Text.TrimEnd());
                view.Create();
                if (XtraMessageBox.Show("分类完成,是否加载?", "提示信息", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    MAP.AddRasterFileToMap(txtOut.Text.TrimEnd());
                }
                this.Close();
            }
            catch (Exception ex)
            {
                //此处调用成功并写出结果后仍会抛出异常。
                Log.WriteLog(typeof(frmSegmentation), ex);
                if (File.Exists(txtOut.Text.TrimEnd()))
                {
                    FileInfo fInfo = new FileInfo(txtOut.Text.TrimEnd());
                    if (fInfo.Length / (1024 * 1024) > 1)
                    {
                        BLL.ProductMeta meta = new ProductMeta(txtOut.Text.TrimEnd(), "", "", "中分宽幅影像分类结果", "作物识别结果");
                        meta.WriteGeoMeta();
                        BLL.ProductQuickView view = new BLL.ProductQuickView(txtOut.Text.TrimEnd());
                        view.Create();
                        if (XtraMessageBox.Show("分类完成,是否加载?", "提示信息", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            MAP.AddRasterFileToMap(txtOut.Text.TrimEnd());
                        }
                        this.Close();
                    }
                }
                else
                {
                    XtraMessageBox.Show("分类失败:\r\n" + ex.Message, "提示信息");
                }
            }
            finally
            {
                frmWait.Close();
            }
        }
コード例 #3
0
        //
        //执行
        //
        private void btnRun_Click(object sender, EventArgs e)
        {
            frmWaitDialog frmWait = new frmWaitDialog("正在分类...", "提示信息");

            try
            {
                frmWait.Owner   = this;
                frmWait.TopMost = false;
                //获取组合的条件运算公式,若检查失败,提示并返回
                RasterMapAlgebraOp op  = new RasterMapAlgebraOp(Canvas.instance.decisionTree.GetLayer(0).nodeList[0], DecisionTree.variableTable);
                string             msg = "";
                if (!op.CheckExp(Canvas.instance.decisionTree.GetLayer(0).nodeList[0], out msg))
                {
                    XtraMessageBox.Show(msg);
                    return;
                }
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.Title  = "保存结果文件";
                dialog.Filter = "tiff(*.tif)|*.tif|All files(*.*)|*.*";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    op.Execute(dialog.FileName);
                }
                //元数据
                if (_treeFile.Contains("gf4.tree"))
                {
                    BLL.ProductMeta meta = new ProductMeta(dialog.FileName, "GF4", "", "长时间序列识别结果", "作物识别结果");
                    meta.WriteGeoMeta();
                }
                else
                {
                    BLL.ProductMeta meta = new ProductMeta(dialog.FileName, "", "", "决策树识别结果", "作物识别结果");
                    meta.WriteGeoMeta();
                }
                //快视图
                BLL.ProductQuickView view = new BLL.ProductQuickView(dialog.FileName);
                view.Create();

                if (DialogResult.OK == XtraMessageBox.Show("分类完毕,是否加分类载结果?", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                {
                    MAP.AddRasterFileToMap(dialog.FileName);
                }
                //this.Close();
            }
            catch (Exception ex)
            { XtraMessageBox.Show("分类失败:" + ex.Message); }
            finally
            {
                frmWait.Close();
            }
        }
コード例 #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            frmWaitDialog frmWait = new frmWaitDialog("正在分类...", "提示信息");

            try
            {
                frmWait.Owner   = this;
                frmWait.TopMost = false;
                MaximumLikeHood ooC = new MaximumLikeHood(cmbInRaster.Text, txtROI.Text, txtOut.Text);
                ooC.Execute();
                BLL.ProductMeta meta = new ProductMeta(txtOut.Text.TrimEnd(), "", "", "面向对象识别", "作物识别结果");
                meta.WriteGeoMeta();
                BLL.ProductQuickView view = new BLL.ProductQuickView(txtOut.Text.TrimEnd());
                view.Create();
                if (XtraMessageBox.Show("分类完成,是否加载?", "提示信息", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    MAP.AddRasterFileToMap(txtOut.Text.TrimEnd());
                }
                this.Close();
            }
            catch (Exception ex)
            {
                //此处调用成功并写出结果后IDL仍会抛出异常。通过判断输出文件确定是否成功
                Log.WriteLog(typeof(frmSegmentation), ex);
                if (File.Exists(txtOut.Text.TrimEnd()))
                {
                    BLL.ProductMeta meta = new ProductMeta(txtOut.Text.TrimEnd(), "", "", "面向对象识别", "作物识别结果");
                    meta.WriteGeoMeta();
                    BLL.ProductQuickView view = new BLL.ProductQuickView(txtOut.Text.TrimEnd());
                    view.Create();
                    FileInfo fInfo = new FileInfo(txtOut.Text.TrimEnd());
                    if (fInfo.Length / (1024 * 1024) > 1)
                    {
                        if (XtraMessageBox.Show("分类完成,是否加载?", "提示信息", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            MAP.AddRasterFileToMap(txtOut.Text.TrimEnd());
                        }
                        this.Close();
                    }
                }
                else
                {
                    XtraMessageBox.Show("分类失败:\r\n" + ex.Message, "提示信息");
                }
            }
            finally
            {
                frmWait.Close();
            }
        }
コード例 #5
0
 private void siBOK_Click(object sender, EventArgs e)
 {
     if (listDataSet.Items.Count <= 0 || string.IsNullOrEmpty(txtOut.Text.Trim()))
     {
         MessageBox.Show("错误信息:\n栅格图像的值:是必需的\n输出结果的值:是必需的");
     }
     else
     {
         frmWaitDialog frmWait = new frmWaitDialog("正在拼接...", "提示信息");
         try
         {
             frmWait.Owner   = this;
             frmWait.TopMost = false;
             //获取文件列表字符串以;分割
             string   fileList = GetFileList();
             FileInfo fileInfo = new FileInfo(txtOut.Text);
             string   msg      = string.Empty;
             if (EnviVars.instance.GpExecutor.Mosaic(fileList, fileInfo.DirectoryName, fileInfo.Name, this.cmbPixelType.Text, out msg, this._bandCount))
             {
                 System.Windows.Forms.DialogResult dialogResult = XtraMessageBox.Show("拼接成功,是否加载结果?", "提示信息", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk);
                 if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                 {
                     //添加结果到主地图视图
                     MAP.AddRasterFileToMap(txtOut.Text);
                 }
                 else
                 {
                     XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         catch (Exception ex)
         {
             XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             Log.WriteLog(typeof(frmClipRaster), ex);
         }
         finally
         {
             frmWait.Close();
             this.Close();
         }
     }
 }
コード例 #6
0
 private void siBOK_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(cBEreaster.Text.TrimEnd()) || string.IsNullOrEmpty(cBEvector.Text.TrimEnd()) || string.IsNullOrEmpty(txtOut.Text.TrimEnd()))
     {
         MessageBox.Show("错误信息:\n栅格图像的值:是必需的\n矢量数据的值:是必需的\n输出结果的值:是必需的");
     }
     else
     {
         string        msg     = string.Empty;
         frmWaitDialog frmWait = new frmWaitDialog("正在裁剪...", "提示信息");
         try
         {
             frmWait.Owner   = this;
             frmWait.TopMost = false;
             if (EnviVars.instance.GpExecutor.ExtractByMask(cBEreaster.Text.TrimEnd(), cBEvector.Text.TrimEnd(), txtOut.Text.TrimEnd(), out msg))
             {
                 System.Windows.Forms.DialogResult dialogResult = XtraMessageBox.Show("裁剪成功,是否加载结果?", "提示信息", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk);
                 if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                 {
                     MAP.AddRasterFileToMap(txtOut.Text);
                 }
             }
             else
             {
                 XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         catch (Exception ex)
         {
             XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             Log.WriteLog(typeof(frmClipRaster), ex);
         }
         finally
         {
             frmWait.Close();
             this.Close();
         }
     }
 }
コード例 #7
0
ファイル: frmRecode.cs プロジェクト: rs-sdust/GFStatistics
        private void siBOK_Click(object sender, EventArgs e)
        {
            frmWaitDialog frmWait = new frmWaitDialog("正在重编码...", "提示信息");

            try
            {
                frmWait.Owner   = this;
                frmWait.TopMost = false;
                string reMap = GetReMap();
                if (reMap == string.Empty)
                {
                    return;
                }
                string msg = "";
                if (!EnviVars.instance.GpExecutor.Reclassify(cBEIn.Text.TrimEnd(), txtOut.Text.TrimEnd(), reMap, out msg))
                {
                    XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    System.Windows.Forms.DialogResult dialogResult = XtraMessageBox.Show("重编码完毕,是否加载结果?", "提示信息", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk);
                    if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                    {
                        MAP.AddRasterFileToMap(txtOut.Text);
                    }
                }
                this.Close();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Log.WriteLog(typeof(frmRecode), ex);
            }
            finally
            {
                frmWait.Close();
            }
        }