Exemplo n.º 1
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            string smpFtrNm = cmbSampleFeatureClass.Text;
            string depStr   = cmbDepedent.Text;
            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 (depStr == "" || depStr == null)
            {
                MessageBox.Show("You must select a dependent 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> lstInd = new List <string>();
            List <string> lstCat = new List <string>();

            for (int i = 0; i < lstIndependent.Items.Count; i++)
            {
                string s = lstIndependent.Items[i].ToString();
                lstInd.Add(s);
                IField fld = flds.get_Field(flds.FindField(s));
                if (fld.Type == esriFieldType.esriFieldTypeString)
                {
                    lstCat.Add(s);
                }
            }
            if (lstInd.Count < 1)
            {
                MessageBox.Show("You must select at least one independent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.Visible = false;
            ITable ftrCls = ftrDic[smpFtrNm];

            string[] depArr = { depStr };
            Statistics.dataPrepLinearReg lr = new Statistics.dataPrepLinearReg(ftrCls, depArr, lstInd.ToArray(), lstCat.ToArray(), chbIntOrigin.Checked);
            lr.writeModel(outPath);
            lr.getReport(alpha);
            this.Close();
        }
 private void btnExecute_Click(object sender, EventArgs e)
 {
     string smpFtrNm = cmbSampleFeatureClass.Text;
     string depStr = cmbDepedent.Text;
     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 (depStr==""||depStr==null)
     {
         MessageBox.Show("You must select a dependent 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> lstInd = new List<string>();
     List<string> lstCat = new List<string>();
     for (int i = 0; i < lstIndependent.Items.Count; i++)
     {
         string s = lstIndependent.Items[i].ToString();
         lstInd.Add(s);
         IField fld = flds.get_Field(flds.FindField(s));
         if(fld.Type== esriFieldType.esriFieldTypeString)
         {
             lstCat.Add(s);
         }
     }
     if (lstInd.Count < 1)
     {
         MessageBox.Show("You must select at least one independent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     this.Visible = false;
     ITable ftrCls = ftrDic[smpFtrNm];
     string[] depArr = {depStr};
     Statistics.dataPrepLinearReg lr = new Statistics.dataPrepLinearReg(ftrCls, depArr, lstInd.ToArray(), lstCat.ToArray(), chbIntOrigin.Checked);
     lr.writeModel(outPath);
     lr.getReport(alpha);
     this.Close();
 }