private void btnScatter_Click(object sender, EventArgs e) { using (frmScatterVarSelector frm = new frmScatterVarSelector()) { frm.StartPosition = FormStartPosition.CenterScreen; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IRasterDataProvider dataProvider = null; bool isNew = false; try { dataProvider = frm.DataProvider; int[] bandNos = new int[] { frm.XBandNo, frm.YBandNo }; isNew = frm.IsNewDataProvider; /*using (*/ frmScatterGraph frm1 = new frmScatterGraph();//) { frm1.StartPosition = FormStartPosition.CenterScreen; frm1.Reset(dataProvider, bandNos[0], bandNos[1], null, frm.FitObj, (idx, tip) => { this.Text = idx.ToString() + "%"; } ); frm1.Show(); frm1.Rerender(); } } finally { //if (isNew) // dataProvider.Dispose(); } } } }
private void button9_Click(object sender, EventArgs e) { using (frmScatterVarSelector frm = new frmScatterVarSelector()) { frm.StartPosition = FormStartPosition.CenterScreen; frm.Apply(GetArrayDataProvider(), null); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IRasterDataProvider dataProvider = null; bool isNew = false; dataProvider = frm.DataProvider; int[] bandNos = new int[] { frm.XBandNo, frm.YBandNo }; isNew = frm.IsNewDataProvider; frmScatterGraph frm1 = new frmScatterGraph(); frm1.StartPosition = FormStartPosition.CenterScreen; //frm1.Reset(dataProvider, bandNos[0], bandNos[1], frm.FitObj, // (idx, tip) => { this.Text = idx.ToString() + "%"; } // ); frm1.Reset(dataProvider, bandNos[0], bandNos[1], null, new XYAxisEndpointValue(0, 14, 0, 60), frm.FitObj, (idx, tip) => { this.Text = idx.ToString() + "%"; } ); frm1.Show(); frm1.Rerender(); } } }
public override void Execute() { //Test(); //return; IRasterDataProvider dataProvider = null; bool isNew = false; int[] bandNos = null; int[] aoi = GetAOI(); using (frmScatterVarSelector frm = new frmScatterVarSelector()) { frm.StartPosition = FormStartPosition.CenterScreen; frm.Apply(GetCurrentDataProvider(), aoi); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dataProvider = frm.DataProvider; bandNos = new int[] { frm.XBandNo, frm.YBandNo }; isNew = frm.IsNewDataProvider; aoi = frm.AOI; } } if (bandNos == null || dataProvider == null) { return; } // IProgressMonitor progress = _smartSession.ProgressMonitorManager.DefaultProgressMonitor; try { progress.Reset("正在准备生成散点图...", 100); progress.Start(false); frmScatterGraph frm1 = new frmScatterGraph(); frm1.Owner = _smartSession.SmartWindowManager.MainForm as Form; frm1.StartPosition = FormStartPosition.CenterScreen; LinearFitObject fitObj = new LinearFitObject(); frm1.Reset(dataProvider, bandNos[0], bandNos[1], aoi, fitObj, (idx, tip) => { progress.Boost(idx, "正在准备生成散点图..."); } ); progress.Finish(); frm1.Show(); frm1.Rerender(); frm1.FormClosed += new FormClosedEventHandler((obj, e) => { if (isNew) { dataProvider.Dispose(); } }); } finally { progress.Finish(); } }