public FormForInfoSingleCellPopInit_Simulator(cPoint3D WorldDim, cListVariables ListVariablesInput, FormForSimuGenerator Parent, cListAgents CellPopulation) { InitializeComponent(); if (CellPopulation == null) { this.comboBoxCellType.Text = "Regular"; this.ListVariables = ListVariablesInput; this.textBoxName.Text = "Population_" + Parent.MyPanelForParamCellPopulations.listViewForCellPopulations.Items.Count; } else { this.comboBoxCellType.Text = CellPopulation[0].Type.Name; this.textBoxName.Text = CellPopulation.Name; ListVariables = CellPopulation.AssociatedVariables; } this.WorldDim = WorldDim; this.Parent = Parent; this.v_CellNumber = ListVariables.FindVariable("v_CellNumber"); this.v_InitPosX = ListVariables.FindVariable("v_InitPosX"); this.v_InitPosY = ListVariables.FindVariable("v_InitPosY"); this.v_InitPosZ = ListVariables.FindVariable("v_InitPosZ"); this.v_InitPosType = ListVariables.FindVariable("v_InitPosType"); this.v_InitVolType = ListVariables.FindVariable("v_InitVolType"); this.v_InitVol = ListVariables.FindVariable("v_InitVol"); if (v_InitVolType.Cst_Value == 0) { this.radioButtonVolumeRandom.Checked = false; this.radioButtonVolumeFixed.Checked = true; } else if (v_InitVolType.Cst_Value == 10) { this.radioButtonVolumeRandom.Checked = true; this.radioButtonVolumeFixed.Checked = false; } if (v_InitPosType.Cst_Value == 0) { this.radioButtonPosWorldCenter.Checked = true; this.radioButtonPosRandom.Checked = false; this.radioButtonPosManual.Checked = false; } else if (v_InitPosType.Cst_Value == 1) { this.radioButtonPosWorldCenter.Checked = false; this.radioButtonPosRandom.Checked = true; this.radioButtonPosManual.Checked = false; } else { this.radioButtonPosWorldCenter.Checked = false; this.radioButtonPosRandom.Checked = false; this.radioButtonPosManual.Checked = true; } this.numericUpDownInitialCellNumber.Value = (decimal)v_CellNumber.Cst_Value; this.numericUpDownManualX.Value = (decimal)v_InitPosX.Cst_Value; this.numericUpDownManualY.Value = (decimal)v_InitPosY.Cst_Value; this.numericUpDownManualZ.Value = (decimal)v_InitPosZ.Cst_Value; this.numericUpDownInitialVolumeManual.Value = (decimal)v_InitVol.Cst_Value; if (v_InitVol.IsConstant) { this.radioButtonVolumeFixed.Checked = true; this.radioButtonVolumeRandom.Checked = false; } else { this.radioButtonVolumeFixed.Checked = false; this.radioButtonVolumeRandom.Checked = true; } this.comboBoxCellType.Items.Clear(); foreach (cCellType item in Parent.ListCellTypes) this.comboBoxCellType.Items.Add(item.Name); }
private void buttonOK_Click(object sender, EventArgs e) { CellPopulation = new cListAgents(this.textBoxName.Text); string CellType = comboBoxCellType.Text; cCellCycle ClassicCellCycle = new cCellCycle(); // default cell cycle cPoint3D InitialPos = null; if (radioButtonPosWorldCenter.Checked) InitialPos = new cPoint3D(this.WorldDim.X / 2, this.WorldDim.Y / 2, this.WorldDim.Z / 2); for (int i = 0; i < (int)numericUpDownInitialCellNumber.Value; i++) { if (radioButtonPosManual.Checked) { InitialPos = new cPoint3D((double)numericUpDownManualX.Value, (double)numericUpDownManualY.Value, (double)numericUpDownManualZ.Value); } else if (radioButtonPosRandom.Checked) { InitialPos = new cPoint3D(RND.NextDouble() * this.WorldDim.X, RND.NextDouble() * this.WorldDim.Y, RND.NextDouble() * this.WorldDim.Z); } cCellType CurrentCellType = Parent.ListCellTypes.FindType(CellType); if (CurrentCellType == null) continue; cAgent NewCell = new cAgent(Parent.ListCellTypes.FindType(CellType), InitialPos, RND.NextDouble() /** ClassicCellCycle.ListProba.Count*/); //new cCell( // InitialPos, // 2, // RND.NextDouble() * ClassicCellCycle.ListProba.Count); CellPopulation.Add(NewCell); } List<cClassForVariable> ListToReturn = new List<cClassForVariable>(); this.v_CellNumber.Cst_Value = (double)numericUpDownInitialCellNumber.Value; ListToReturn.Add(this.v_CellNumber); this.v_InitPosX.Cst_Value = (double)numericUpDownManualX.Value; ListToReturn.Add(this.v_InitPosX); this.v_InitPosY.Cst_Value = (double)numericUpDownManualY.Value; ListToReturn.Add(this.v_InitPosY); this.v_InitPosZ.Cst_Value = (double)numericUpDownManualZ.Value; ListToReturn.Add(this.v_InitPosZ); if (this.radioButtonVolumeFixed.Checked) this.v_InitVol.IsConstant = true; else this.v_InitVol.IsConstant = false; this.v_InitVol.Cst_Value = (double)numericUpDownInitialVolumeManual.Value; ListToReturn.Add(this.v_InitVol); ListToReturn.Add(this.v_InitPosType); ListToReturn.Add(this.v_InitVolType); this.ListVariables = new cListVariables(ListToReturn); }