Пример #1
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            string smpFtrNm = cmbSampleFeatureClass.Text;
            string outP     = txtOutputPath.Text;

            if (smpFtrNm == null || smpFtrNm == "")
            {
                MessageBox.Show("You must select a feature Class", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (outP == null || outP == "")
            {
                MessageBox.Show("You must select an output model path", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                Statistics.ModelHelper.runProgressBar("Running PCA");
                List <string> lstInd = new List <string>();
                for (int i = 0; i < lstIndependent.Items.Count; i++)
                {
                    string s = lstIndependent.Items[i].ToString();
                    lstInd.Add(s);
                }
                Statistics.dataPrepPrincipleComponents varCov = null;
                if (ftrDic.ContainsKey(smpFtrNm))
                {
                    ITable ftrCls = ftrDic[smpFtrNm];
                    if (lstInd.Count < 1)
                    {
                        MessageBox.Show("You must select at least one variable field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    this.Visible = false;
                    varCov       = new Statistics.dataPrepPrincipleComponents(ftrCls, lstInd.ToArray());
                }
                else
                {
                    IRaster rs = rstDic[smpFtrNm];
                    this.Visible = false;
                    varCov       = new Statistics.dataPrepPrincipleComponents(rs);
                }
                varCov.writeModel(outP);
                varCov.getReport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                Statistics.ModelHelper.closeProgressBar();
                this.Close();
            }
        }
 public void Bind(object pArgument)
 {
     if (pArgument is pcaArguments)
     {
         pcaArguments arg = (pcaArguments)pArgument;
         inrsBandsCoef = arg.InRasterCoefficients;
         outrs = arg.OutRaster;
         pca = arg.PCA;
         myFunctionHelper.Bind(outrs);
         myFunctionHelperCoef.Bind(inrsBandsCoef);
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype = myRasterInfo.PixelType;
         myValidFlag = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: pcaFunctionArguments");
     }
 }
Пример #3
0
 public void Bind(object pArgument)
 {
     if (pArgument is pcaArguments)
     {
         pcaArguments arg = (pcaArguments)pArgument;
         inrsBandsCoef = arg.InRasterCoefficients;
         outrs         = arg.OutRaster;
         pca           = arg.PCA;
         myFunctionHelper.Bind(outrs);
         myFunctionHelperCoef.Bind(inrsBandsCoef);
         myRasterInfo = myFunctionHelper.RasterInfo;
         myPixeltype  = myRasterInfo.PixelType;
         myValidFlag  = true;
     }
     else
     {
         throw new System.Exception("Incorrect arguments object. Expected: pcaFunctionArguments");
     }
 }