Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Vulkaniums newdata = new Vulkaniums();
            raspozn    jb      = new raspozn();

            int[,] pri = newdata.vulkan_priznak();
            int[] id_priz_checked = P_CHB.get_priznak();
            int[] vulk            = new int[id_priz_checked.Length];
            //  string red = "";
            int ki = 0;

            for (int i = 0; i < newdata.col_priznak; i++)
            {
                for (int j = 0; j < id_priz_checked.Length; j++)
                {
                    if (i == id_priz_checked[j])
                    {
                        //    red += i + " znach=" + pri[this.comboBox1.SelectedIndex, i]+"   ";
                        vulk[ki] = pri[this.comboBox1.SelectedIndex, i];
                        ki++;
                    }
                }
            }
            MessageBox.Show(table_v.get_gr()[0] + " " + table_v.get_gr()[1] + " " + table_v.get_gr()[2]);
            richTextBox1.Text = jb.srart(table_v.get_matrix(id_priz_checked), table_v.get_gr(), vulk);
        }
Пример #2
0
        private int[,] create_matrix_v_p()
        {
            int[] id_vulk_checked = V_CHB.get_vulk();
            int[] id_priz_checked = P_CHB.get_priznak();
            int[,] result = new int[V_CHB.col_vulk_checked, P_CHB.col_priz_checked];
            martix_sopostavimosti_vulk  = new int[V_CHB.col_vulk_checked];
            martix_sopostavimosti_prizn = new int[P_CHB.col_priz_checked];
            //MessageBox.Show("col_vulk_checked " + martix_sopostavimosti_vulk.Length + " col_priz_checked " + martix_sopostavimosti_prizn.Length);
            int        count_vul = 0, count_prizn = 0;
            Vulkaniums Vulk_data = new Vulkaniums();
            string     red       = "";

            int[,] mer = Vulk_data.vulkan_priznak();
            for (int i = 0; i < Vulk_data.col_vulkans; i++)
            {
                bool fl = false;
                for (int j = 0; j < V_CHB.col_vulk_checked; j++)
                {
                    if (i == id_vulk_checked[j])
                    {
                        fl = true;
                        break;
                    }
                }
                if (fl == true)
                {
                    count_prizn = 0;
                    martix_sopostavimosti_vulk[count_vul] = i;
                    for (int k = 0; k < Vulk_data.col_priznak; k++)
                    {
                        bool fl_2 = false;
                        for (int j = 0; j < P_CHB.col_priz_checked; j++)
                        {
                            if (k == id_priz_checked[j])
                            {
                                fl_2 = true;
                                break;
                            }
                        }
                        if (fl_2 == true)
                        {
                            martix_sopostavimosti_prizn[count_prizn] = k;
                            result[count_vul, count_prizn]           = mer[i, k];
                            red += mer[i, k];
                            count_prizn++;
                        }
                    }
                    count_vul++;
                }
            }
            return(result);
        }
Пример #3
0
        public priz_for_vulk_table(int num)
        {
            InitializeComponent();
            Vulkaniums newdata = new Vulkaniums();

            int[,] priz = newdata.vulkan_priznak();
            string[] name = newdata.priz_group_mass();
            for (int i = 0; i < newdata.col_priznak; i++)
            {
                dataGridView1.RowCount++;
                dataGridView1.Rows[i].Cells[0].Value = name[i];
                dataGridView1.Rows[i].Cells[1].Value = priz[num, i];
            }
        }
Пример #4
0
        public int[,] get_matrix(int [] priznaki)
        {
            Vulkaniums newdata = new Vulkaniums();
            int        col_need = 0, gr1 = 0, gr2 = 0, gr3 = 0;

            for (int i = 0; i < newdata.col_vulkans; i++)
            {
                if (dataGridView1.Rows[i].Cells[2].Value.ToString() == "1")
                {
                    gr1++;
                }
                if (dataGridView1.Rows[i].Cells[3].Value.ToString() == "1")
                {
                    gr2++;
                }
                if (dataGridView1.Rows[i].Cells[4].Value.ToString() == "1")
                {
                    gr3++;
                }
            }
            col_need      = gr1 + gr2 + gr3;
            gr[0]         = gr1; gr[1] = gr2; gr[2] = gr3;
            int[,] matrix = new int[col_need, priznaki.Length], data = newdata.vulkan_priznak();
            matrix_sootv  = new int[col_need];
            string red = "";
            //1gr
            int K = 0, jk = 0;

            // MessageBox.Show((gr1 + gr2 + gr3) + " ll  " + gr1 + gr2 + gr3);
            for (int i = 0; i < newdata.col_vulkans; i++)
            {
                if (dataGridView1.Rows[i].Cells[2].Value.ToString() == "1")
                {
                    for (int j = 0; j < newdata.col_priznak; j++)
                    {
                        for (int jo = 0; jo < priznaki.Length; jo++)
                        {
                            if (j == priznaki[jo])
                            {
                                matrix[K, jk] = data[i, j];
                                red          += data[i, j] + " ";
                                jk++;
                            }
                        }
                    }
                    matrix_sootv[K] = i;
                    red            += "\n";
                    K++; jk         = 0;
                }
            }
            //gr 2

            for (int i = 0; i < newdata.col_vulkans; i++)
            {
                if (dataGridView1.Rows[i].Cells[3].Value.ToString() == "1")
                {
                    for (int j = 0; j < newdata.col_priznak; j++)
                    {
                        for (int jo = 0; jo < priznaki.Length; jo++)
                        {
                            if (j == priznaki[jo])
                            {
                                matrix[K, jk] = data[i, j];
                                red          += data[i, j] + " ";
                                jk++;
                            }
                        }
                    }
                    matrix_sootv[K] = i;
                    red            += "\n";
                    K++; jk         = 0;
                }
            }
            //gr 3
            for (int i = 0; i < newdata.col_vulkans; i++)
            {
                if (dataGridView1.Rows[i].Cells[4].Value.ToString() == "1")
                {
                    for (int j = 0; j < newdata.col_priznak; j++)
                    {
                        for (int jo = 0; jo < priznaki.Length; jo++)
                        {
                            if (j == priznaki[jo])
                            {
                                matrix[K, jk] = data[i, j];
                                red          += data[i, j] + " ";
                                jk++;
                            }
                        }
                    }
                    matrix_sootv[K] = i;
                    red            += "\n";
                    K++; jk         = 0;
                }
            }
            MessageBox.Show(red);
            return(matrix);
        }