private void DoStat(IRasterDataProvider dataProvider, int[] bandNos, int[] aoi) { Dictionary <int, RasterQuickStatResult> results; IProgressMonitor progress = _smartSession.ProgressMonitorManager.DefaultProgressMonitor; try { progress.Reset("正在执行直方图统计...", 100); progress.Start(false); IRasterQuickStatTool stat = new RasterQuickStatTool(); results = stat.Compute(dataProvider, aoi, bandNos, (idx, tip) => { progress.Boost(idx, "正在执行直方图统计..."); }); } finally { progress.Finish(); } /*using (*/ frmRasterQuickStat frm = new frmRasterQuickStat();//) { frm.Owner = _smartSession.SmartWindowManager.MainForm as Form; frm.StartPosition = FormStartPosition.CenterScreen; frm.Apply(dataProvider.fileName, results); frm.Show(); } }
public object[] GetStretcher(IRasterDataProvider dataProvider, int[] bandNos, float percent) { int[] bNos = bandNos.Distinct().ToArray(); Dictionary <int, RasterQuickStatResult> results; IProgressMonitor progress = _smartSession.ProgressMonitorManager.DefaultProgressMonitor; try { progress.Reset("正在执行直方图统计...", 100); progress.Start(false); IRasterQuickStatTool stat = new RasterQuickStatTool(); results = stat.Compute(dataProvider, null, bNos, (idx, tip) => { progress.Boost(idx, "正在执行直方图统计..."); }); } finally { progress.Finish(); } RasterQuickStatResult[] rts = new RasterQuickStatResult[bandNos.Length]; for (int i = 0; i < bandNos.Length; i++) { rts[i] = results[bandNos[i]]; } // object[] stretchers = GetStretcher(dataProvider.DataType, rts, percent); return(stretchers); }
public object PercentXStretcher(int bandNo, float percent) { Dictionary <int, RasterQuickStatResult> results; IRasterQuickStatTool stat = new RasterQuickStatTool(); results = stat.Compute(this, null, new int[] { bandNo }, null); RasterQuickStatResult rst = results[bandNo]; // object[] stretchers = GetStretcher(this.DataType, new RasterQuickStatResult[] { rst }, percent); return(stretchers[0]); }
private void button7_Click(object sender, EventArgs e) { using (IRasterDataProvider prd = GeoDataDriver.Open(txtFileName.Text) as IRasterDataProvider) { IRasterQuickStatTool stat = new RasterQuickStatTool(); Dictionary <int, RasterQuickStatResult> results = stat.Compute(prd, null, new int[] { 1, 2, 3, 4, 5 }, (idx, tip) => { Text = tip + ":" + idx.ToString() + "%"; }); DisplayStatResult(prd.fileName, results); } }
private void DoStat(IRasterDataProvider dataProvider, int[] bandNos) { IRasterQuickStatTool stat = new RasterQuickStatTool(); Dictionary <int, RasterQuickStatResult> results = stat.Compute(dataProvider, null, bandNos, (idx, tip) => { Text = tip + ":" + idx.ToString() + "%"; }); using (frmRasterQuickStat frm = new frmRasterQuickStat()) { frm.StartPosition = FormStartPosition.CenterScreen; frm.Apply(dataProvider.fileName, results); frm.ShowDialog(); } }