public NetworkViewForm(string briteFilePath, Type deployType)
        {
            InitializeComponent();

            tb_file_name.Text = briteFilePath;

            m_topo = new NetworkTopology(0, 0);

            m_topo.SetupDrawingControl(draw_panel);

            tb_k.TextChanged += new EventHandler(checkValid);
            tb_n.TextChanged += new EventHandler(checkValid);

            tb_k.KeyPress += new KeyPressEventHandler(checkInputValue);
            tb_n.KeyPress += new KeyPressEventHandler(checkInputValue);

            btn_show.Click += (s, e) =>
            {
                m_topo.ReadBriteFile(tb_file_name.Text);

                int K = int.Parse(tb_k.Text);
                int N = int.Parse(tb_n.Text);

                Deployment deployment = Activator.CreateInstance(deployType, new object[] { 30, 20, 10, K, N }) as Deployment; //new KCutStartWithConsider2KConsiderCoefficient(10, 10, 10, K, N);
                deployment.Deploy(m_topo);

                draw_panel.Invalidate();
            };
        }
示例#2
0
        public NetworkViewForm(string mapFileName, string dbFileName)
        {
            InitializeComponent();

            this.dbFileName = Path.Combine(Environment.CurrentDirectory, "Log", dbFileName);;

            comboBox1.Items.Add(typeof(NoneDeployment).Name);
            comboBox1.Items.Add(typeof(RandomDeployment).Name);
            comboBox1.Items.Add("KCutDeployV1");
            comboBox1.Items.Add("KCutDeployV2");
            //comboBox1.Items.Add(typeof(KCutStartWithCenterNode).Name);
            //comboBox1.Items.Add(typeof(KCutStartWithCenterNodeConsiderCoefficient).Name);
            //comboBox1.Items.Add(typeof(KCutStartWithComparableConsiderCoefficient).Name);
            //comboBox1.Items.Add(typeof(KCutStartWithConsider2KConsiderCoefficient).Name);
            //comboBox1.Items.Add(typeof(KCutStartWithSideNode).Name);
            //comboBox1.Items.Add(typeof(KCutStartWithSideNodeConsiderCoefficient).Name);

            comboBox1.SelectedValue = typeof(NoneDeployment).Name;
            networkTopology         = new NetworkTopology(0, 0);
            networkTopology.ReadBriteFile(mapFileName);

            networkTopology.SetupDrawingControl(panel1);
        }