Ejemplo n.º 1
0
 public void Bind(object pArgument)
 {
     if (pArgument is glmFunctionArguments)
     {
         glmFunctionArguments arg = (glmFunctionArguments)pArgument;
         inrsBandsCoef = arg.InRasterCoefficients;
         glm           = arg.GlmModel;
         outrs         = arg.OutRaster;
         myFunctionHelper.Bind(outrs);
         myFunctionHelperCoef.Bind(inrsBandsCoef);
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype  = myRasterInfo.PixelType;
         myValidFlag  = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: regressionFunctionArguments");
     }
 }
 public void Bind(object pArgument)
 {
     if (pArgument is glmFunctionArguments)
     {
         glmFunctionArguments arg = (glmFunctionArguments)pArgument;
         inrsBandsCoef = arg.InRasterCoefficients;
         glm = arg.GlmModel;
         outrs = arg.OutRaster;
         myFunctionHelper.Bind(outrs);
         myFunctionHelperCoef.Bind(inrsBandsCoef);
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype = myRasterInfo.PixelType;
         myValidFlag = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: regressionFunctionArguments");
     }
 }
 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);
     string uLinkStr = cmbLink.Text;
     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 (uLinkStr == "" || uLinkStr == null)
     {
         MessageBox.Show("You must select a link from the link combo box", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if(!cmbLink.Items.Contains(uLinkStr))
     {
         MessageBox.Show("You must select a link from the link combo box", "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;
     }
     Statistics.dataPrepGlm.LinkFunction uLink = (Statistics.dataPrepGlm.LinkFunction)Enum.Parse(typeof(Statistics.dataPrepGlm.LinkFunction), uLinkStr);
     this.Visible = false;
     ITable ftrCls = ftrDic[smpFtrNm];
     string[] depArr = { depStr };
     Statistics.dataPrepGlm glm = new Statistics.dataPrepGlm(ftrCls, depArr, lstInd.ToArray(), lstCat.ToArray());
     glm.Link = uLink;
     glm.writeModel(outPath);
     glm.getReport(alpha);
     this.Close();
 }
Ejemplo n.º 4
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);
            string uLinkStr = cmbLink.Text;

            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 (uLinkStr == "" || uLinkStr == null)
            {
                MessageBox.Show("You must select a link from the link combo box", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!cmbLink.Items.Contains(uLinkStr))
            {
                MessageBox.Show("You must select a link from the link combo box", "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;
            }
            Statistics.dataPrepGlm.LinkFunction uLink = (Statistics.dataPrepGlm.LinkFunction)Enum.Parse(typeof(Statistics.dataPrepGlm.LinkFunction), uLinkStr);
            this.Visible = false;
            ITable ftrCls = ftrDic[smpFtrNm];

            string[] depArr            = { depStr };
            Statistics.dataPrepGlm glm = new Statistics.dataPrepGlm(ftrCls, depArr, lstInd.ToArray(), lstCat.ToArray());
            glm.Link = uLink;
            glm.writeModel(outPath);
            glm.getReport(alpha);
            this.Close();
        }