/// <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(); } } } }
public void CreatePyramid(List <string> rasterFiles) { frmWaitDialog frmWait = new frmWaitDialog("正在创建金字塔" + "......", "提示信息"); IGeoProcessorResult geoProcessorResult = null; try { frmWait.Owner = EnviVars.instance.MainForm; frmWait.TopMost = false; //if (this._geoProcessor == null) //{ // this._geoProcessor = new Geoprocessor(); // this._geoProcessor.OverwriteOutput = true; //} //Geoprocessor m_gp = new Geoprocessor() { OverwriteOutput = true }; string sMsg = string.Empty; if (rasterFiles.Count == 1) { BuildPyramids buildPyramids = new BuildPyramids(); buildPyramids.in_raster_dataset = rasterFiles[0]; buildPyramids.resample_technique = "NEAREST"; buildPyramids.compression_type = "DEFAULT"; buildPyramids.compression_quality = 75; //geoProcessorResult = this.m_gp.Execute(buildPyramids, null) as IGeoProcessorResult; geoProcessorResult = m_gp.Execute(buildPyramids, null) as IGeoProcessorResult; } else { BatchBuildPyramids batchBuildPyramids = new BatchBuildPyramids(); batchBuildPyramids.Input_Raster_Datasets = string.Join(";", rasterFiles); batchBuildPyramids.Pyramid_resampling_technique = "NEAREST"; batchBuildPyramids.Pyramid_compression_type = "DEFAULT"; batchBuildPyramids.Compression_quality = 75; //geoProcessorResult = this.m_gp.Execute(batchBuildPyramids, null) as IGeoProcessorResult; geoProcessorResult = m_gp.Execute(batchBuildPyramids, null) as IGeoProcessorResult; } if (geoProcessorResult.Status != esriJobStatus.esriJobSucceeded) { //sMsg += GetGPMessages(this.m_gp); sMsg += GetGPMessages(m_gp); BLL.Log.WriteLog(typeof(MapAPI), sMsg); } //logger.Log(LogLevel.Info, EventType.UserManagement, this.Text, null); } catch (Exception ex) { //logger.Log(LogLevel.Error, EventType.UserManagement, this.Text, ex); BLL.Log.WriteLog(typeof(MapAPI), ex); } finally { frmWait.Close(); } }
public void listRasters(Geoprocessor GP) { // List all TIFF files in the workspace and build pyramids. GP.SetEnvironmentValue("workspace", @"C:\Corey\Ccm\results"); IGpEnumList rasters = GP.ListRasters("*", "TIFF"); string raster = rasters.Next(); // Intialize the BuildPyramids tool. BuildPyramids pyramids = new BuildPyramids(); while (raster != "") { // Set input raster dataset. pyramids.in_raster_dataset = raster; GP.Execute(pyramids, null); raster = rasters.Next(); } }