Exemplo n.º 1
0
 public static SortedBasinsFrm CreateInstance(List <SortedBasinsParas> list)
 {
     if (frm == null || frm.IsDisposed)
     {
         frm = new SortedBasinsFrm(list);
     }
     return(frm);
 }
Exemplo n.º 2
0
 public static SortedBasinsFrm CreateInstance(double[] scores, string[] names)
 {
     if (frm == null || frm.IsDisposed)
     {
         frm = new SortedBasinsFrm(scores, names);
     }
     return(frm);
 }
Exemplo n.º 3
0
 public static SortedBasinsFrm CreateInstance()
 {
     if (frm == null || frm.IsDisposed)
     {
         frm = new SortedBasinsFrm();
     }
     return(frm);
 }
Exemplo n.º 4
0
        private void btn_Sort_Click(object sender, EventArgs e)
        {
            double[] arr_Scores  = null;
            string[] arr_TgtName = null;
            //SortedBasinsFrm sBf = new SortedBasinsFrm();
            int counterFlag = 0;

            //***********************************************************//
            PublicValues.GeoParas    = "";
            PublicValues.EngParas    = "";
            PublicValues.EcoParas    = "";
            PublicValues.ArrGeoParas = new string[lstBx_Selected_GeoPara.Items.Count];
            //***********************************************************//

            foreach (string str in lstBx_Selected_GeoPara.Items)
            {
                PublicValues.ArrGeoParas[counterFlag] = str;
                counterFlag++;
                if (counterFlag != lstBx_Selected_GeoPara.Items.Count)
                {
                    PublicValues.GeoParas += str + ",";
                }
                else
                {
                    PublicValues.GeoParas += str + ";";
                }
            }
            //将所有参数对应的权重值赋值给对应的参数,并形成一个字典变量,以供后面绘图时调用
            //此目的是为了绘制柱状图时,所用参数对应 相应的权重值
            PublicValues.DicGeoP_W = new Dictionary <string, double>();
            PublicValues.DicEngP_W = new Dictionary <string, double>();
            //PublicValues.DicEcoP_W = new Dictionary<string, double>();
            for (int i = 0; i < geoParasAll.Length; i++)
            {
                PublicValues.DicGeoP_W.Add(geoParasAll[i], (double)PublicValues.ArrGeoWgt[i]);
                if (i < engParasAll.Length)
                {
                    PublicValues.DicEngP_W.Add(engParasAll[i], (double)PublicValues.ArrEngWgt[i]);
                }
                //if (i < ecoParasAll.Length)
                //{
                //    PublicValues.DicEcoP_W.Add(ecoParasAll[i], (double)PublicValues.ArrEcoWgt[i]);
                //}
            }


            counterFlag = 0;
            PublicValues.ArrEngParas = new string[lstBx_Selected_EngPara.Items.Count];
            foreach (string str in lstBx_Selected_EngPara.Items)
            {
                PublicValues.ArrEngParas[counterFlag] = str;
                counterFlag++;
                if (counterFlag != lstBx_Selected_EngPara.Items.Count)
                {
                    PublicValues.EngParas += str + ",";
                }
                else
                {
                    PublicValues.EngParas += str + ";";
                }
            }

            //***********************************************************//



            if (chkFlag)
            {
                List <SortedBasinsParas> lst_SBP = BlockGrade(lst_Bsn);
                int counter = lst_SBP.Count;
                arr_Scores  = new double[counter];
                arr_TgtName = new string[counter];
                lst_SBP.Sort((x, y) => x.para_TotalScores.CompareTo(y.para_TotalScores));
                foreach (SortedBasinsParas sBp in lst_SBP)
                {
                    sBp.para_Rank = counter;
                    counter--;
                }
                lst_SBP.Sort((x, y) => x.para_Rank.CompareTo(y.para_Rank));
                arr_Scores  = lst_SBP.Select(x => x.para_TotalScores).ToArray();
                arr_TgtName = lst_SBP.Select(x => x.para_Tgt).ToArray();
                SortedBasinsFrm sBf = SortedBasinsFrm.CreateInstance(arr_Scores, arr_TgtName);
                sBf.dgv_Bsn_Sorted.DataSource = DataSourceToDataTable.GetListToDataTable(lst_SBP);
                sBf.Show();
                btn_GenerateReport.Enabled = true;
            }
            else
            {
                MessageBox.Show("尚未进行参数矩阵的检验计算操作,所有参数的权重值为 0 .", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }