private void btnOK_Click(object sender, EventArgs e) { BLL.frmWaitDialog frmWait = new BLL.frmWaitDialog("参数检查...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; string msg = ""; SampleBLL.SpatialError spError = new SampleBLL.SpatialError(_classFile, _classValue, 45, txtOut.Text); if (!spError.ChkParam(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "误差空间表达..."; if (spError.Execute(out msg)) { BLL.ProductMeta meta = new BLL.ProductMeta(txtOut.Text.TrimEnd(), "", "", "误差空间表达", "误差空间表达"); meta.WriteGeoMeta(); BLL.ProductQuickView view = new BLL.ProductQuickView(txtOut.Text.TrimEnd()); view.Create(); if (DialogResult.OK == XtraMessageBox.Show("执行成功!是否加载结果?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { BLL.MapAPI.AddRasterFileToMap(txtOut.Text); } } else { XtraMessageBox.Show(msg); return; } } catch (Exception ex) { BLL.Log.WriteLog(typeof(frmSpatialError), ex); XtraMessageBox.Show(ex.Message); } finally { frmWait.Close(); } }
private void btnOK_Click(object sender, EventArgs e) { string msg = ""; BLL.frmWaitDialog frmWait = new BLL.frmWaitDialog("高光谱分类...", "提示信息"); try { ClassificationBLL.HyperSpeClassification hyperClass = new ClassificationBLL.HyperSpeClassification(_Hyper, _ROI, _Result); frmWait.Caption = "参数检查..."; Application.DoEvents(); if (!hyperClass.ChkPara(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "数据降维..."; Application.DoEvents(); if (!hyperClass.BandReduce(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "svm分类..."; Application.DoEvents(); if (!hyperClass.SVM(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "信息熵计算..."; Application.DoEvents(); if (!hyperClass.Entropy(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "阈值计算..."; Application.DoEvents(); if (!hyperClass.CalEntropyMean(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "纯净像元提取..."; Application.DoEvents(); if (!hyperClass.ExtractPurePixel(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "混合像元分解..."; Application.DoEvents(); if (!hyperClass.MergePixel(out msg)) { if (!msg.StartsWith("对 COM 组件的调用返回了错误")) { XtraMessageBox.Show(msg); return; } } BLL.ProductMeta meta = new BLL.ProductMeta(txtOut.Text.TrimEnd(), "GF5", "", "高光谱分类", "作物识别结果"); meta.WriteGeoMeta(); BLL.ProductQuickView view = new BLL.ProductQuickView(txtOut.Text.TrimEnd()); view.Create(); if (DialogResult.OK == XtraMessageBox.Show("分类完毕,是否加载结果?", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { BLL.MapAPI.AddRasterFileToMap(_Result); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); return; } finally { frmWait.Close(); } }