public TrajectoryFunctionsForm(TrajectoryFunctions trajectoryFunctionsX, TrajectoryFunctions trajectoryFunctionsY, TrajectoryFunctions trajectoryFunctionsZ) { InitializeComponent(); InitCombobox(); if (trajectoryFunctionsX != null) { comboBoxFuncX.SelectedItem = ((List <ComboboxDataSourceTrajectory>)(comboBoxFuncX.DataSource)).Where(x => x.Text == trajectoryFunctionsX.nameFunc).FirstOrDefault(); textBoxCoeffX.Text = Convert.ToString(trajectoryFunctionsX.Coeff); textBoxStepX.Text = Convert.ToString(trajectoryFunctionsX.step); textBoxMinX.Text = Convert.ToString(trajectoryFunctionsX.min); textBoxMaxX.Text = Convert.ToString(trajectoryFunctionsX.max); textBoxStartValX.Text = Convert.ToString(trajectoryFunctionsX.startVal); checkBoxMinMaxValX.Checked = trajectoryFunctionsX.reversMove; } if (trajectoryFunctionsY != null) { comboBoxFuncY.SelectedItem = ((List <ComboboxDataSourceTrajectory>)(comboBoxFuncY.DataSource)).Where(x => x.Text == trajectoryFunctionsY.nameFunc).FirstOrDefault(); textBoxCoeffY.Text = Convert.ToString(trajectoryFunctionsY.Coeff); textBoxStepY.Text = Convert.ToString(trajectoryFunctionsY.step); textBoxMinY.Text = Convert.ToString(trajectoryFunctionsY.min); textBoxMaxY.Text = Convert.ToString(trajectoryFunctionsY.max); textBoxStartValY.Text = Convert.ToString(trajectoryFunctionsY.startVal); checkBoxMinMaxValY.Checked = trajectoryFunctionsY.reversMove; } if (trajectoryFunctionsZ != null) { comboBoxFuncZ.SelectedItem = ((List <ComboboxDataSourceTrajectory>)(comboBoxFuncZ.DataSource)).Where(x => x.Text == trajectoryFunctionsZ.nameFunc).FirstOrDefault(); textBoxCoeffZ.Text = Convert.ToString(trajectoryFunctionsZ.Coeff); textBoxStepZ.Text = Convert.ToString(trajectoryFunctionsZ.step); textBoxMinZ.Text = Convert.ToString(trajectoryFunctionsZ.min); textBoxMaxZ.Text = Convert.ToString(trajectoryFunctionsZ.max); textBoxStartValZ.Text = Convert.ToString(trajectoryFunctionsZ.startVal); checkBoxMinMaxValZ.Checked = trajectoryFunctionsZ.reversMove; } }
private void buttonOk_Click(object sender, EventArgs e) { ComboboxDataSourceTrajectory selectItemX = (ComboboxDataSourceTrajectory)comboBoxFuncX.SelectedItem; TrajectoryFunctions locTrajectoryFunctionsX = new TrajectoryFunctions(float.Parse(textBoxCoeffX.Text), selectItemX.mathFunc, float.Parse(textBoxStepX.Text), float.Parse(textBoxMinX.Text), float.Parse(textBoxMaxX.Text), float.Parse(textBoxStartValX.Text), selectItemX.Text, checkBoxMinMaxValX.Checked); if (!locTrajectoryFunctionsX.ValidateTrajectoryFunc()) { MessageBox.Show("Неккоректно заданная траектория для X"); return; } trajectoryFunctionsX = locTrajectoryFunctionsX; ComboboxDataSourceTrajectory selectItemY = (ComboboxDataSourceTrajectory)comboBoxFuncY.SelectedItem; TrajectoryFunctions locTrajectoryFunctionsY = new TrajectoryFunctions(float.Parse(textBoxCoeffY.Text), selectItemY.mathFunc, float.Parse(textBoxStepY.Text), float.Parse(textBoxMinY.Text), float.Parse(textBoxMaxY.Text), float.Parse(textBoxStartValY.Text), selectItemY.Text, checkBoxMinMaxValY.Checked); if (!locTrajectoryFunctionsY.ValidateTrajectoryFunc()) { MessageBox.Show("Неккоректно заданная траектория для Y"); return; } trajectoryFunctionsY = locTrajectoryFunctionsY; ComboboxDataSourceTrajectory selectItemZ = (ComboboxDataSourceTrajectory)comboBoxFuncZ.SelectedItem; TrajectoryFunctions locTrajectoryFunctionsZ = new TrajectoryFunctions(float.Parse(textBoxCoeffZ.Text), selectItemZ.mathFunc, float.Parse(textBoxStepZ.Text), float.Parse(textBoxMinZ.Text), float.Parse(textBoxMaxZ.Text), float.Parse(textBoxStartValZ.Text), selectItemZ.Text, checkBoxMinMaxValZ.Checked); if (!locTrajectoryFunctionsZ.ValidateTrajectoryFunc()) { MessageBox.Show("Неккоректно заданная траектория для X"); return; } trajectoryFunctionsZ = locTrajectoryFunctionsZ; }
public TrajctoryRenderObject(TrajectoryFunctions locTrajectoryFunctionsX, TrajectoryFunctions locTrajectoryFunctionsY, TrajectoryFunctions locTrajectoryFunctionsZ, TargetTrajectory locTarget, Vector4 vectorTarget) { useTrajectory = true; trajectoryFunctionsX = locTrajectoryFunctionsX; trajectoryFunctionsY = locTrajectoryFunctionsY; trajectoryFunctionsZ = locTrajectoryFunctionsZ; target = locTarget; if (locTarget == TargetTrajectory.Object) { colorObject = vectorTarget; } else { point = vectorTarget; } }