Ejemplo n.º 1
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            string smpFtrNm = cmbSampleFeatureClass.Text;

            string[] depStrArr = lstDependent.Items.Cast <string>().ToArray();
            string[] indStrArr = lstIndependent.Items.Cast <string>().ToArray();
            string   outPath   = txtOutputPath.Text;
            double   alpha     = System.Convert.ToDouble(nudAlpha.Value);

            if (smpFtrNm == null || smpFtrNm == "")
            {
                MessageBox.Show("You must select a feature Class or table", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (depStrArr.Length < 2)
            {
                MessageBox.Show("You must select at least 2 dependent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (indStrArr.Length < 1)
            {
                MessageBox.Show("You must select at least 1 independent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (outPath == "" || outPath == null)
            {
                MessageBox.Show("You must select an output Path", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            List <string> lstCat = new List <string>();

            for (int i = 0; i < lstIndependent.Items.Count; i++)
            {
                string s   = lstIndependent.Items[i].ToString();
                IField fld = flds.get_Field(flds.FindField(s));
                if (fld.Type == esriFieldType.esriFieldTypeString)
                {
                    lstCat.Add(s);
                }
            }
            this.Visible = false;
            ITable ftrCls = ftrDic[smpFtrNm];

            Statistics.dataPrepMultivariateLinearRegression mvlr = new Statistics.dataPrepMultivariateLinearRegression(ftrCls, depStrArr, indStrArr, lstCat.ToArray(), chbIntOrigin.Checked);
            mvlr.writeModel(outPath);
            mvlr.getReport(alpha);
            this.Close();
        }
 private void btnExecute_Click(object sender, EventArgs e)
 {
     string smpFtrNm = cmbSampleFeatureClass.Text;
     string[] depStrArr = lstDependent.Items.Cast<string>().ToArray();
     string[] indStrArr = lstIndependent.Items.Cast<string>().ToArray();
     string outPath = txtOutputPath.Text;
     double alpha = System.Convert.ToDouble(nudAlpha.Value);
     if (smpFtrNm == null || smpFtrNm == "")
     {
         MessageBox.Show("You must select a feature Class or table","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
         return;
     }
     if (depStrArr.Length<2)
     {
         MessageBox.Show("You must select at least 2 dependent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (indStrArr.Length < 1)
     {
         MessageBox.Show("You must select at least 1 independent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (outPath==""||outPath==null)
     {
         MessageBox.Show("You must select an output Path", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     List<string> lstCat = new List<string>();
     for (int i = 0; i < lstIndependent.Items.Count; i++)
     {
         string s = lstIndependent.Items[i].ToString();
         IField fld = flds.get_Field(flds.FindField(s));
         if(fld.Type== esriFieldType.esriFieldTypeString)
         {
             lstCat.Add(s);
         }
     }
     this.Visible = false;
     ITable ftrCls = ftrDic[smpFtrNm];
     Statistics.dataPrepMultivariateLinearRegression mvlr = new Statistics.dataPrepMultivariateLinearRegression(ftrCls, depStrArr, indStrArr, lstCat.ToArray(), chbIntOrigin.Checked);
     mvlr.writeModel(outPath);
     mvlr.getReport(alpha);
     this.Close();
 }