private void btnOK_Click(object sender, EventArgs e) { frmWaitDialog frmWait = new frmWaitDialog("正在汇总...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; SampleSummary summary = new SampleSummary(_pSampleLayer, _pSurveyLayer, cmbFieldVillage.Text, cmbFieldID.Text, cmbFieldCropType.Text, cmbCropName.Text, cmbFieldArea.Text, txtOut.Text); string msg = ""; if (!summary.Summary(out msg)) { XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (DialogResult.OK == XtraMessageBox.Show("汇总完成!", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { //MapAPI.AddShpFileToMap(txtOut.Text); BLL.EnviVars.instance.MapControl.Refresh(); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } finally { frmWait.Close(); XtraMessageBox.Show("汇总完成!"); _pMapControl.Refresh(); _pTOCControl.Update(); } }
private void siBOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cBEResult.Text.Trim())) { MessageBox.Show("错误信息:n输入分类结果的值:是必需的"); } else { frmWaitDialog frmWait = new frmWaitDialog("正在统计...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; DataTable table = new DataTable(); StatisticsResult acc = new StatisticsResult(); if (acc.Statistics(cBEResult.Text, out table)) { frmWait.Close(); frmStatisticsTable frm = new frmStatisticsTable(table); frm.ShowDialog(); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Log.WriteLog(typeof(frmStatisticsResult), ex); } finally { frmWait.Close(); //this.Close(); } } }
private void btnOK_Click(object sender, EventArgs e) { frmWaitDialog frmWait = new frmWaitDialog("正在分析样本...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; List <string> list = new List <string>(); foreach (CheckedListBoxItem item in this.chkListParam.CheckedItems) { list.Add(item.ToString()); } DataTable result = sample.Execute(list); if (result == null) { XtraMessageBox.Show("执行样本分析失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { frmSampleAnalystResult frm = new frmSampleAnalystResult(result); frm.ShowDialog(); } } catch (Exception ex) { Log.WriteLog(typeof(frmSampleAnaly), ex); } finally { frmWait.Close(); this.Close(); } }
/// <summary> /// Handles the Click event of the btnOK control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> private void btnOK_Click(object sender, EventArgs e) { if (this.m_rasterFiles != null && this.m_rasterFiles.Count != 0) { Regex regex = new Regex("^(0|[1-9]\\d|100)$"); string text = this.spinEditQuality.Text.Trim(); if (!regex.IsMatch(text)) { XtraMessageBox.Show(frmCreatePyramid.MSG01, "提示信息", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk); } else { //Logger logger = new Logger(); frmWaitDialog frmWait = new frmWaitDialog("正在创建金字塔" + "......", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; if (this._geoProcessor == null) { this._geoProcessor = new Geoprocessor(); this._geoProcessor.OverwriteOutput = true; } if (this.m_rasterFiles.Count == 1) { BuildPyramids buildPyramids = new BuildPyramids(); buildPyramids.in_raster_dataset = this.m_rasterFiles[0]; buildPyramids.resample_technique = this.comboBoxEditReSample.Text; buildPyramids.compression_type = this.comboBoxEditZip.Text; buildPyramids.compression_quality = Convert.ToInt32(text); this._geoProcessor.Execute(buildPyramids, null); } else { BatchBuildPyramids batchBuildPyramids = new BatchBuildPyramids(); batchBuildPyramids.Input_Raster_Datasets = string.Join(";", this.m_rasterFiles); batchBuildPyramids.Pyramid_resampling_technique = this.comboBoxEditReSample.Text; batchBuildPyramids.Pyramid_compression_type = this.comboBoxEditZip.Text; batchBuildPyramids.Compression_quality = Convert.ToInt32(text); this._geoProcessor.Execute(batchBuildPyramids, null); } //logger.Log(LogLevel.Info, EventType.UserManagement, this.Text, null); base.DialogResult = System.Windows.Forms.DialogResult.OK; base.Close(); } catch (Exception ex) { //logger.Log(LogLevel.Error, EventType.UserManagement, this.Text, ex); BLL.Log.WriteLog(typeof(frmCreatePyramid), ex); base.DialogResult = System.Windows.Forms.DialogResult.Cancel; } finally { frmWait.Close(); } } } }
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(); } } }
private void btnOK_Click(object sender, EventArgs e) { if (!File.Exists(cmbIn.Text.TrimEnd())) { XtraMessageBox.Show("输入文件不存在!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } frmWaitDialog frmWait = new frmWaitDialog("正在分割...", "提示信息"); //string segImage = Path.Combine(ConstDef.PATH_TEMP, DateTime.Now.ToFileTime().ToString() + ".tif"); string segImg = txtOut.Text.TrimEnd(); string vectorFile = segImg.Substring(0, segImg.LastIndexOf(".")) + ".shp"; try { frmWait.Owner = this; frmWait.TopMost = false; string cmd = ConstDef.IDL_FUN_SEGMENTONLY + ",'" + cmbIn.Text.TrimEnd() + "'," + spinSegment.Value.ToString() + "," + spinMerge.Value.ToString() + "," + spinKernel.Value.ToString() + ",'" + segImg + "','" + vectorFile + "'"; EnviVars.instance.IdlModel.Execute(cmd); if (XtraMessageBox.Show("分割完成,是否加载?", "提示信息", MessageBoxButtons.OKCancel) == DialogResult.OK) { MAP.AddShpFileToMap(vectorFile); } this.Close(); } catch (Exception ex) { //此处调用成功并写出结果后仍会抛出异常。 Log.WriteLog(typeof(frmSegmentation), ex); if (File.Exists(segImg)) { FileInfo fInfo = new FileInfo(segImg); if (fInfo.Length / (1024 * 1024) > 1) { if (XtraMessageBox.Show("分割完成,是否加载?", "提示信息", MessageBoxButtons.OKCancel) == DialogResult.OK) { MAP.AddShpFileToMap(vectorFile); } this.Close(); } } else { XtraMessageBox.Show("分割失败:\r\n" + ex.Message, "提示信息"); } //XtraMessageBox.Show(ex.Message); } finally { frmWait.Close(); } }
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(); } }
// //执行 // 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(); } }
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(); } }
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(); } } }
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(); } } }
private void btnOK_Click(object sender, EventArgs e) { frmWaitDialog frmWait = new frmWaitDialog("正在验证...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; Verification verify = new Verification(cmbClassFile.Text.TrimEnd(), txtSample.Text.TrimEnd(), txtOut.Text.TrimEnd()); verify.Verify(); frmWait.Close(); //show result frmVerifyResult frm = new frmVerifyResult(txtOut.Text.TrimEnd()); frm.TopMost = true; frm.ShowDialog(); } catch (Exception ex) { //此处调用成功并写出结果后仍会抛出异常。 Log.WriteLog(typeof(frmSegmentation), ex); if (File.Exists(txtOut.Text.TrimEnd())) { frmWait.Close(); //show result frmVerifyResult frm = new frmVerifyResult(txtOut.Text.TrimEnd()); frm.TopMost = true; frm.ShowDialog(); } else { XtraMessageBox.Show("执行验证失败:" + ex.Message); } } finally { frmWait.Close(); } }
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(); } }
// OK private void siB_Ok_Click(object sender, EventArgs e) { frmWaitDialog frmWait = new frmWaitDialog("正在生成...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; SampleAduit Aduit = new SampleAduit(); if (cBEMethod.Text == "分层比率估计") { if (Aduit.RatioPreprocessing(cBSamplePopu.Text, cBESample.Text, cBESamSurvey.Text, cBEPopuLayer.Text, cBESamLayer.Text, cBEPopuBasis.Text, cBESamCunName.Text, cBExport.Text, cBESamBasis.Text)) { MessageBox.Show("估算成功!"); ExportData.report = cBExport.Text; } } else { if (Aduit.ProbabilityProcessing(cBSamplePopu.Text, cBESample.Text, cBEPopuBasis.Text, cBEPopuLayer.Text, cBESamLayer.Text, cBESamBasis.Text, cBESamSurvey.Text, cBESamCunName.Text, cBExport.Text)) { MessageBox.Show("估算成功!"); ExportData.report = cBExport.Text; } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Log.WriteLog(typeof(frmSampleSimulation), ex); } finally { frmWait.Close(); this.Close(); } }
public bool SaveAs(bool bSetRepresentationType = false, rstRepresentationType representationType = rstRepresentationType.DT_ATHEMATIC, bool bUseMessagebox = true) { object editValue = this.m_checkedCmbBand.EditValue; bool result; if (editValue == null) { XtraMessageBox.Show("请设置输出波段!", "提示信息", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk); result = false; } else if (string.IsNullOrEmpty(this.m_sOutputPath)) { XtraMessageBox.Show("请选择文件输出路径!", "提示信息", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk); result = false; } else { FileInfo fileInfo = new FileInfo(this.m_sOutputPath); if (fileInfo.Exists) { if (XtraMessageBox.Show("此文件已存在,是否覆盖?", "提示信息", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Asterisk) != System.Windows.Forms.DialogResult.OK) { result = false; return(result); } fileInfo.Delete(); } IRaster raster = this.m_raster; string[] array = editValue.ToString().Split(new char[] { ',' }); if (array.Length != this.m_bandList.Count) { IRaster raster2 = ((this.m_raster as IRaster2).RasterDataset as IRasterDataset3).CreateRaster(); IRasterProps rasterProps = raster2 as IRasterProps; rasterProps.Width = (this.m_raster as IRasterProps).Width; rasterProps.Height = (this.m_raster as IRasterProps).Height; IRasterBandCollection rasterBandCollection = raster2 as IRasterBandCollection; IRasterBandCollection rasterBandCollection2 = (this.m_raster as IRaster2).RasterDataset as IRasterBandCollection; for (int i = 0; i < rasterBandCollection2.Count; i++) { IRasterBand rasterBand = rasterBandCollection2.Item(i); string[] array2 = array; for (int j = 0; j < array2.Length; j++) { string text = array2[j]; if (text.Trim() == rasterBand.Bandname) { rasterBandCollection.AppendBand(rasterBand); break; } } } raster = raster2; } this.SetResamplingMethod(raster, this.m_cmbResamplingType); this.SetPixelType(raster, this.m_cmbPixelType); if (bSetRepresentationType) { this.SetRepresentationType(raster, representationType); } frmWaitDialog frmWait = new frmWaitDialog("正在输出......", "提示信息"); IWorkspace workspace = null; string text2 = "输出成功!"; //Logger logger = new Logger(); try { frmWait.Owner = this.m_frm; frmWait.TopMost = false; string text3 = this.m_cmbOutputType.Text; ISaveAs2 saveAs = raster as ISaveAs2; if (!saveAs.CanSaveAs(text3)) { XtraMessageBox.Show("不支持指定像素类型或文件格式的输出!", "提示信息", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk); result = false; } else { IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactoryClass(); workspace = workspaceFactory.OpenFromFile(Path.GetDirectoryName(this.m_sOutputPath), 0); IDataset o = saveAs.SaveAs(Path.GetFileName(this.m_sOutputPath), workspace, text3); if (o != null) { Marshal.ReleaseComObject(o); } result = true; } } catch (Exception ex) { text2 = "输出失败!"; result = false; } finally { if (workspace != null) { Marshal.ReleaseComObject(workspace); } frmWait.Close(); if (bUseMessagebox) { XtraMessageBox.Show(text2, "提示信息", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk); } } } return(result); }
private void btnOK_Click(object sender, EventArgs e) { if (this.xtraTabControl1.SelectedTabPageIndex == 0) { SampleFrame sampleFrame = new SampleFrame(); frmWaitDialog frmWait = new frmWaitDialog("正在处理...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; string msg = string.Empty; if (chkArea.Checked) { SampleData.hasArea = true; SampleData.areaField = cmbAreaField.Text; SampleData.firstUnit = this.cmbUnit.Text.TrimEnd(); SampleData.farmLand = this.cmbCrop.Text.TrimEnd(); SampleData.ASCDL = cmbASCDL.Text; SampleData.targetCrop = this.cmbDestination.SelectedIndex; frmWait.Caption = "参数检查..."; if (!sampleFrame.ChkData(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "计算分类面积..."; if (!sampleFrame.CalClassArea(SampleData.firstUnit, SampleData.ASCDL, SampleData.targetCrop, out msg)) { XtraMessageBox.Show(msg); return; } } else { SampleData.hasArea = false; SampleData.areaField = string.Empty; SampleData.firstUnit = this.cmbUnit.Text.TrimEnd(); SampleData.farmLand = this.cmbCrop.Text.TrimEnd(); SampleData.ASCDL = cmbASCDL.Text; SampleData.targetCrop = this.cmbDestination.SelectedIndex; frmWait.Caption = "参数检查..."; if (!sampleFrame.ChkData(out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "计算耕地面积..."; if (!sampleFrame.CalLandArea(SampleData.firstUnit, SampleData.farmLand, out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "计算分类面积..."; if (!sampleFrame.CalClassArea(SampleData.firstUnit, SampleData.ASCDL, SampleData.targetCrop, out msg)) { XtraMessageBox.Show(msg); return; } } if (DialogResult.OK == XtraMessageBox.Show("处理完毕.", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)) { MapAPI.AddShpFileToMap(SampleData.firstUnit); MapAPI.AddShpFileToMap(SampleData.farmLand); MapAPI.AddRasterFileToMap(SampleData.ASCDL); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { frmWait.Close(); } } }
private void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbInShp.Text)) { XtraMessageBox.Show("土壤矢量为空!"); return; } else if (string.IsNullOrEmpty(this.cmbSoilType.Text)) { XtraMessageBox.Show("土壤类型为空!"); return; } else if (string.IsNullOrEmpty(this.cmbSoilArea.Text)) { XtraMessageBox.Show("土壤面积为空!"); return; } else if (string.IsNullOrEmpty(this.cmbSoilThick.Text)) { XtraMessageBox.Show("土壤厚度为空!"); return; } else if (string.IsNullOrEmpty(this.cmbSoilWeight.Text)) { XtraMessageBox.Show("土壤容重为空!"); return; } else if (string.IsNullOrEmpty(this.cmbOrganics.Text)) { XtraMessageBox.Show("有机物含量为空!"); return; } else if (string.IsNullOrEmpty(this.cmbGravel.Text)) { XtraMessageBox.Show("砾石含量为空!"); return; } else if (string.IsNullOrEmpty(this.txtOutCarbon.Text)) { XtraMessageBox.Show("输出文件为空!"); return; } else { frmWaitDialog frmWait = new frmWaitDialog("正在处理...", "提示信息"); frmWait.Owner = this; frmWait.TopMost = false; try { SoilCarbon soil = new SoilCarbon(this.cmbInShp.Text, cmbSoilType.Text, cmbSoilArea.Text, cmbSoilThick.Text, cmbSoilWeight.Text, cmbOrganics.Text, cmbGravel.Text, txtOutCarbon.Text); if (soil.Cal_Storage()) { XtraMessageBox.Show("计算完毕!"); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } finally { frmWait.Close(); } } }
private void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbLandCover.Text)) { XtraMessageBox.Show("土地覆盖文件为空!"); } else if (string.IsNullOrEmpty(cmbPixel.Text)) { XtraMessageBox.Show("森林像元值为空!"); } else if (string.IsNullOrEmpty(txtExpression.Text)) { XtraMessageBox.Show("反演模型为空!"); } else if (string.IsNullOrEmpty(txtOutBiology.Text)) { XtraMessageBox.Show("森林生物量为空!"); } else if (string.IsNullOrEmpty(txtOutCarbonDensity.Text)) { XtraMessageBox.Show("森林碳密度为空!"); } else if (string.IsNullOrEmpty(txtOutCarbon.Text)) { XtraMessageBox.Show("森林碳储量为空!"); } else { VegetationCarbon fc = new VegetationCarbon(this.cmbLandCover.Text, int.Parse(this.cmbPixel.Text), _Index, this.txtExpression.Text.TrimEnd(), Convert.ToDouble(this.spinCarbonIndex.Value), this.txtOutBiology.Text, this.txtOutCarbonDensity.Text, this.txtOutCarbon.Text); frmWaitDialog frmWait = new frmWaitDialog("正在处理...", "提示信息"); frmWait.Owner = this; frmWait.TopMost = false; frmWait.Caption = "计算生物量..."; if (fc.Cal_Biomass()) { frmWait.Caption = "计算碳密度..."; if (fc.Cal_carbonDensity()) { frmWait.Caption = "计算植被面积..."; if (fc.Cal_forestCoverBlock()) { frmWait.Caption = "计算碳储量..."; if (fc.Cal_carbonStorageBlock()) { //isDone = true; frmWait.Caption = "计算完毕!"; try { GFS.BLL.MapAPI.AddRasterFileToMap(txtOutBiology.Text); GFS.BLL.MapAPI.AddRasterFileToMap(txtOutCarbonDensity.Text); } catch (Exception ex) { XtraMessageBox.Show("加载计算结果失败!/r/n" + ex.Message); } frmWait.Close(); } } } } } }
private void btnOK_Click(object sender, EventArgs e) { frmWaitDialog frmWait = new frmWaitDialog("GF3分类...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; ClassificationBLL.GF3Classification gf3Class = new ClassificationBLL.GF3Classification(_GF3Polarity, _GF1, _pixelROI, _segmentROI, _class); frmWait.Caption = "参数检查..."; string msg = ""; if (!gf3Class.ChkPara(out msg)) { XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } frmWait.Caption = "极化特征区域统计..."; if (!gf3Class.ZonalPolarity(out msg)) { XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } frmWait.Caption = "图斑尺度分类..."; Application.DoEvents(); if (!gf3Class.SVMFeature(out msg)) { XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } frmWait.Caption = "像元尺度分类..."; Application.DoEvents(); if (!gf3Class.SVMPixel(out msg)) { XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } frmWait.Caption = "计算图斑信息熵..."; Application.DoEvents(); if (!gf3Class.Entropy()) { XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } frmWait.Caption = "混合图斑修正..."; Application.DoEvents(); if (!gf3Class.ClassMerge()) { XtraMessageBox.Show(msg, "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } BLL.ProductMeta meta = new ProductMeta(_class, "GF3", "", "图斑像元综合分类", "作物识别结果"); meta.WriteGeoMeta(); BLL.ProductQuickView view = new BLL.ProductQuickView(_class); view.Create(); if (DialogResult.OK == XtraMessageBox.Show("分类完毕!是否加载结果?", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { MapAPI.AddRasterFileToMap(_class); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } finally { frmWait.Close(); } }
private void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbForestBiology.Text)) { XtraMessageBox.Show("森林生物量为空!"); return; } else if (string.IsNullOrEmpty(cmbForestDensity.Text)) { XtraMessageBox.Show("森林碳密度为空!"); return; } else if (string.IsNullOrEmpty(cmbShrubBiology.Text)) { XtraMessageBox.Show("灌丛生物量为空!"); return; } else if (string.IsNullOrEmpty(cmbShrubDensity.Text)) { XtraMessageBox.Show("灌丛碳密度为空!"); return; } else if (string.IsNullOrEmpty(cmbGrassBiology.Text)) { XtraMessageBox.Show("草地生物量为空!"); return; } else if (string.IsNullOrEmpty(cmbGrassDensity.Text)) { XtraMessageBox.Show("草地碳密度为空!"); return; } else if (string.IsNullOrEmpty(txtOutBiology.Text)) { XtraMessageBox.Show("总生物量为空!"); return; } else if (string.IsNullOrEmpty(txtOutCarbonDensity.Text)) { XtraMessageBox.Show("总碳密度为空!"); return; } else if (string.IsNullOrEmpty(txtOutCarbon.Text)) { XtraMessageBox.Show("总碳储量为空!"); return; } else { frmWaitDialog frmWait = new frmWaitDialog("正在处理...", "提示信息"); frmWait.Owner = this; frmWait.TopMost = false; try { List <string> biomass = new List <string>() { this.cmbForestBiology.Text, this.cmbShrubBiology.Text, this.cmbGrassBiology.Text }; List <string> density = new List <string>() { this.cmbForestDensity.Text, this.cmbGrassDensity.Text, this.cmbGrassDensity.Text }; List <double> storage = new List <double>() { double.Parse(this.spinForestCarbon.Value.ToString()), double.Parse(this.spinShrubCarbon.Value.ToString()), double.Parse(this.spinGrassCarbon.Value.ToString()) }; VegCarbonSum sum = new VegCarbonSum(biomass, density, storage, this.txtOutBiology.Text, this.txtOutCarbonDensity.Text, this.txtOutCarbon.Text); frmWait.Caption = "计算总生物量..."; if (!(sum.CalBiomass())) { } frmWait.Caption = "计算总碳密度..."; if (!(sum.CalDensity())) { } frmWait.Caption = "计算总碳储量..."; if (!(sum.CalStorage())) { } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } finally { frmWait.Close(); } } }
private void btnOK_Click(object sender, EventArgs e) { string msg = string.Empty; frmWaitDialog frmWait = new frmWaitDialog("正在执行...", "提示信息"); try { frmWait.Owner = this; frmWait.TopMost = false; string fishNet = string.Empty; string firstUnit = this.cmbFirstUnit.Text; if (chkNewNet.Checked) { SampleData.firstSample = cmbFirstUnit.Text; SampleData.villageField = cmbVillage.Text; SampleData.layerField = cmbLayer.Text; SampleData.farmLand = cmbCultivation.Text; SampleData.ASCDL = cmbASCDL.Text; SampleData.targetCrop = cmbCrop.SelectedIndex; if (!SampleSelection.ChkData(out msg)) { XtraMessageBox.Show(msg); return; } //一级单元范围内创建渔网 frmWait.Caption = "创建二级抽样单元..."; fishNet = System.IO.Path.Combine(ConstDef.PATH_TEMP, DateTime.Now.ToFileTime().ToString() + ".shp"); int width = int.Parse(spinLength.EditValue.ToString()); int height = int.Parse(this.spinWidth.EditValue.ToString()); if (!EnviVars.instance.GpExecutor.CreateFishNet(firstUnit, width, height, fishNet, out msg)) { XtraMessageBox.Show(msg); return; } } else { SampleData.firstSample = cmbFirstUnit.Text; SampleData.villageField = cmbVillage.Text; SampleData.layerField = cmbLayer.Text; SampleData.farmLand = cmbCultivation.Text; SampleData.ASCDL = cmbASCDL.Text; SampleData.targetCrop = cmbCrop.SelectedIndex; if (!SampleSelection.ChkData(out msg)) { XtraMessageBox.Show(msg); return; } if (string.IsNullOrEmpty(cmbSecondUint.Text)) { XtraMessageBox.Show("二级抽样单元为空!"); return; } fishNet = cmbSecondUint.Text; } //抽选样本 frmWait.Caption = "抽选样本..."; SamplePara para = new SamplePara(); para.isNum = chkSampleNum.Checked; para.sampleNum = int.Parse(this.spinSampleNum.EditValue.ToString()); para.sampleRate = double.Parse(this.spinPercent.EditValue.ToString()) / 100; SampleSelection.Sampling(firstUnit, cmbVillage.Text, cmbLayer.Text, fishNet, cmbCultivation.Text, para, txtOut.Text); SampleFrame sampleFrame = new SampleFrame(); frmWait.Caption = "计算耕地面积..."; if (!SampleSelection.CalLandArea(txtOut.Text, SampleData.farmLand, out msg)) { XtraMessageBox.Show(msg); return; } frmWait.Caption = "计算分类面积..."; if (!sampleFrame.CalClassArea(txtOut.Text, SampleData.ASCDL, SampleData.targetCrop, out msg)) { XtraMessageBox.Show(msg); return; } BLL.ProductMeta meta = new ProductMeta(txtOut.Text.TrimEnd(), "", "", "二级样方", "抽样和面积推算结果"); meta.WriteShpMeta(); BLL.ProductQuickView view = new BLL.ProductQuickView(txtOut.Text.TrimEnd()); view.Create(); System.Windows.Forms.DialogResult dialogResult = XtraMessageBox.Show("抽样完成,是否加载结果?", "提示信息", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { MapAPI.AddShpFileToMap(txtOut.Text); this.Close(); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); Log.WriteLog(typeof(frmSymbolSelector), ex); } finally { frmWait.Close(); } }
private void siBOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cBESave.Text.Trim())) { MessageBox.Show("错误信息:\n输出结果的值:是必需的"); } else { frmWaitDialog frmWait = new frmWaitDialog("正在生成...", "提示信息"); try { DataTable ExtandTable = new DataTable(); SampleSimulation Sim = new SampleSimulation(); int sampleSum = SamplingSum - sampleNum; //第一次抽样,剩余的样本总量 int sampleExtandNum = 0; //扩充的样本量 //每次抽样得到的样本 sampleTable = SampleZones[gridView1.FocusedRowHandle]; if (string.IsNullOrEmpty(tEExtend.Text.Trim()) && string.IsNullOrEmpty(tEScale.Text.Trim())) { ExtandTable = sampleTable; } else { if (cEExtend.Checked == true) { sampleExtandNum = Convert.ToInt32(tEExtend.Text); } else { sampleExtandNum = Convert.ToInt32(sampleSum * (Convert.ToDouble(tEScale.Text) / 100)); } if (0 > sampleExtandNum || sampleExtandNum > sampleSum) { MessageBox.Show("输入的扩充样本量超出范围,请重新输入!"); return; } else if (sampleExtandNum == 0) { ExtandTable = sampleTable; } else { ExtandTable = Sim.ExtendSample(sampleSumTable, sampleTable, sampleExtandNum, cBELayer.Text, cBEBasis.Text); } } if (ExtandTable != null) { if (Sim.CreateShpFile(cBFile.Text, ExtandTable, cBESave.Text)) { BLL.ProductMeta meta = new ProductMeta(cBESave.Text.TrimEnd(), "", "", "一级样本村", "抽样和面积推算结果"); meta.WriteShpMeta(); BLL.ProductQuickView view = new BLL.ProductQuickView(cBESave.Text.TrimEnd()); view.Create(); System.Windows.Forms.DialogResult dialogResult = XtraMessageBox.Show("保存样本成功,是否加载结果?", "提示信息", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { //添加结果到主地图视图 IFeatureClass pFC = EngineAPI.OpenFeatureClass(cBESave.Text); if (pFC != null) { IFeatureLayer pFLyr = new FeatureLayerClass(); pFLyr.FeatureClass = pFC; pFLyr.Name = (pFC as IDataset).Name; MapAPI.UniqueValueRender(pFLyr, "KC"); EnviVars.instance.MapControl.AddLayer(pFLyr); } } } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Log.WriteLog(typeof(frmSampleSimulation), ex); } finally { frmWait.Close(); this.Close(); } } }