private void btnExcute_Click(object sender, EventArgs e)
        {
            string popStr = txtPop.Text;
            string sampStr = txtSamp.Text;
            string strataField = cmbStrata.Text;
            if (strataField == null) strataField = "";
            string outModel = txtOutput.Text;
            string[] explanitoryVariables = null;

            if (popStr == "" || popStr == null)
            {
                MessageBox.Show("You must select a population table!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (sampStr == "" || sampStr == null)
            {
                MessageBox.Show("You must select a sample table!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (outModel == "" || outModel == null)
            {
                MessageBox.Show("You must select a output Model!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (lstIndependent.Items.Count <= 0)
            {
                MessageBox.Show("You must select at least one explanatory variables!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                explanitoryVariables = lstIndependent.Items.Cast<string>().ToArray();
            }
            //check for variables;
            this.Visible = false;
            this.Refresh();
            try
            {
                esriUtil.Statistics.ModelHelper.runProgressBar("KS test");
                ITable sample1 = ftrDic[popStr];
                ITable sample2 = ftrDic[sampStr];
                esriUtil.Statistics.dataPrepCompareSamples ksTest = new Statistics.dataPrepCompareSamples(sample1, sample2, explanitoryVariables, strataField);
                ksTest.writeModel(outModel);
                ksTest.getReport();
                //DialogResult mR = MessageBox.Show("Do you want to adjust your sample?", "Adjust Sample", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                //if (mR == System.Windows.Forms.DialogResult.Yes)
                //{
                    //featureUtil fU = new featureUtil();
                    //fU.selectKSFeaturesToSample(sample2, sample1, outModel, strataField);
                //}

            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                esriUtil.Statistics.ModelHelper.closeProgressBar();
                this.Close();
            }
        }
Пример #2
0
        private void btnExcute_Click(object sender, EventArgs e)
        {
            string popStr      = txtPop.Text;
            string sampStr     = txtSamp.Text;
            string strataField = cmbStrata.Text;

            if (strataField == null)
            {
                strataField = "";
            }
            string outModel = txtOutput.Text;

            string[] explanitoryVariables = null;

            if (popStr == "" || popStr == null)
            {
                MessageBox.Show("You must select a population table!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (sampStr == "" || sampStr == null)
            {
                MessageBox.Show("You must select a sample table!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (outModel == "" || outModel == null)
            {
                MessageBox.Show("You must select a output Model!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (lstIndependent.Items.Count <= 0)
            {
                MessageBox.Show("You must select at least one explanatory variables!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                explanitoryVariables = lstIndependent.Items.Cast <string>().ToArray();
            }
            //check for variables;
            this.Visible = false;
            this.Refresh();
            try
            {
                esriUtil.Statistics.ModelHelper.runProgressBar("KS test");
                ITable sample1 = ftrDic[popStr];
                ITable sample2 = ftrDic[sampStr];
                esriUtil.Statistics.dataPrepCompareSamples ksTest = new Statistics.dataPrepCompareSamples(sample1, sample2, explanitoryVariables, strataField);
                ksTest.writeModel(outModel);
                ksTest.getReport();
                //DialogResult mR = MessageBox.Show("Do you want to adjust your sample?", "Adjust Sample", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                //if (mR == System.Windows.Forms.DialogResult.Yes)
                //{
                //featureUtil fU = new featureUtil();
                //fU.selectKSFeaturesToSample(sample2, sample1, outModel, strataField);
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                esriUtil.Statistics.ModelHelper.closeProgressBar();
                this.Close();
            }
        }