public void Delete_Line(Schematix.FSM.My_Line line) { DialogResult res = MessageBox.Show("Are you sure want to delete " + line.name + "?", "Delete Line?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { RemoveFigure(line); } }
public LineProperties(Schematix.FSM.My_Line line, Schematix.FSM.Constructor_Core core) { InitializeComponent(); this.line = line; this.core = core; textBoxName.Text = line.name; numericUpDownPriority.Value = line.priority; richTextBoxCondition.Text = line.condition; richTextBoxAction.Text = line.Action; Schematix.FSM.Constructor_Core.SetColorText(labelColor, line.color); comboBoxStyle.Items.Clear(); comboBoxStyle.Items.Add(Schematix.FSM.My_Line.DrawningStyle.DrawningBezier); comboBoxStyle.Items.Add(Schematix.FSM.My_Line.DrawningStyle.DrawningCurve); comboBoxStyle.SelectedItem = line.DrawStyle; }
/// <summary> /// Создание нового перехода /// </summary> public void CreateNewLine() { if (Lock == true) { MessageBox.Show("You must create figure " + SelectedFigure.name + " before.", "Fatal Error :)", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (graph.States.Count == 0) { MessageBox.Show("Нет ни одного состояния", "Fatal Error :)", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } graph.UnselectAllFigures(); Schematix.FSM.My_Line line = new Schematix.FSM.My_Line(true, this); SelectedFigure = line; line.Core = this; graph.AddFigure(line); }
public Point GetCommonPoint(Schematix.FSM.My_State state, Schematix.FSM.My_Line line, bool angle /*true - angle1 else - angle2*/) { Point p = state.CenterPoint; Point line_angle; if (angle == true) { line_angle = line.Angle1; } else { line_angle = line.Angle2; } if (ArrowPaint == true) { Rectangle rect = state.rect; //Найдем уравнение прямой //y = k*x+b double K = (double)(state.CenterPoint.Y - line_angle.Y) / (double)(state.CenterPoint.X - line_angle.X); //данные для еллипса double a = (double)(rect.Width / 2); if (a < 10) { return(state.CenterPoint); } double b = (double)(rect.Height / 2); //x^2/a^2 + y^2/b^2 = 1; if (line_angle.Y > state.CenterPoint.Y) { double x = (b * b) / (K * K + ((b * b) / (a * a))); x = Math.Sqrt(x); if (line_angle.X < state.CenterPoint.X) { x = -x; } double y = (b / a) * Math.Sqrt(a * a - x * x); y += state.CenterPoint.Y; x += state.CenterPoint.X; p.X = (int)x; p.Y = (int)y; return(p); } else { double x = (b * b) / (K * K + ((b * b) / (a * a))); x = Math.Sqrt(x); if (line_angle.X < state.CenterPoint.X) { x = -x; } double y = -(b / a) * Math.Sqrt(a * a - x * x); y += state.CenterPoint.Y; x += state.CenterPoint.X; p.X = (int)x; p.Y = (int)y; return(p); } } return(p); }