public Ellipse FileFindVertexByEllipse(Petzold.Media2D.ArrowLine line, int vertex) { Ellipse ellipse = new Ellipse(); foreach (var t in VertexesList) { string[] strs = line.Tag.ToString().Split(';'); if (vertex == 1) { if (strs[0] == t.ellipse.Tag.ToString()) { ellipse = t.ellipse; return(ellipse); } } if (vertex == 2) { if (strs[1] == t.ellipse.Tag.ToString()) { ellipse = t.ellipse; return(ellipse); } } } return(ellipse); }
public void UpdateCorrections(List <UserCorrection> shifts) { lock (Helpers.locker) { shifts_count = shifts.Count; UpdateText(null, null); Dispatcher.Invoke(new Action(() => { foreach (var arrow in arrows) { Canvas.Children.Remove(arrow); } arrows.Clear(); foreach (var shift in shifts) { color_calculator.AdjustColorBoundaries(shift.Coordinates); } foreach (var shift in shifts) { var arrow = new Petzold.Media2D.ArrowLine(); InitArrowWithUserCorrection(shift, arrow); Canvas.Children.Add(arrow); arrows.Add(arrow); } })); } }
public void LineEdgeMouseClick(object sender, MouseButtonEventArgs e) { //StringActionUndo(); Petzold.Media2D.ArrowLine line = new Petzold.Media2D.ArrowLine(); line = (Petzold.Media2D.ArrowLine)sender; if (DeleteingEdgeEnabled) { MainWindow_.InfoCurr.Clear(); RemoveEdge(line); DeleteingEdgeEnabled = false; MyCursors.DefaultCursor(); } if (IsOriented) { foreach (var edge in EdgesList) { if (edge.line == line) { GraphVertex StartV = edge.StartVertex; GraphVertex EndV = edge.EndVertex; ConnectVertex(EndV, StartV); RemoveEdge(line); break; } } } }
public void ReadEdge(Petzold.Media2D.ArrowLine line, TextBox textBox, GraphVertex v1, GraphVertex v2) { textBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(ChangeEdgeWeight); textBox.KeyUp += new KeyEventHandler(KeyEnterClickTextBox); textBox.MouseEnter += new MouseEventHandler(IsMouseOnTextBox); textBox.MouseDoubleClick += new MouseButtonEventHandler(TextBoxVertexDoubleClick); textBox.MouseMove += new MouseEventHandler(MouseMoveOnTextBox); GraphEdge tempEdge = new GraphEdge(line, textBox, Convert.ToDouble(textBox.Text), v1, v2); foreach (var t in VertexesList) { if (t.ellipse == v1.ellipse) { t.lines.Add(tempEdge); } if (t.ellipse == v2.ellipse) { t.lines.Add(tempEdge); } } tempEdge.line.MouseLeftButtonUp += new MouseButtonEventHandler(LineEdgeMouseClick); GraphPlain.Children.Add(tempEdge.line); GraphPlain.Children.Add(textBox); EdgesList.Add(tempEdge); }
private void InitArrowWithUserCorrection(UserCorrection shift, Petzold.Media2D.ArrowLine arrow) { arrow.X1 = shift.Coordinates[0]; arrow.Y1 = shift.Coordinates[1]; arrow.X2 = shift.Coordinates[0] + shift.Shift.X; arrow.Y2 = shift.Coordinates[1] + shift.Shift.Y; if (arrow == current_arrow) { arrow.Stroke = Brushes.Green; } else { arrow.Stroke = Options.Instance.calibration_mode.additional_dimensions_configuration.Equals(AdditionalDimensionsConfguration.Disabled) ? Brushes.Red : new SolidColorBrush(color_calculator.GetColor(shift.Coordinates)); } arrow.StrokeThickness = 3; }
public TextBox SearchEdgeTextBox(List <object> file, Petzold.Media2D.ArrowLine line) { TextBox TB = new TextBox(); foreach (var t in file) { if (t is TextBox) { if (line.Tag.ToString() == ((TextBox)t).Tag.ToString()) { TB = (TextBox)t; return(TB); } } } return(null); }
private void Update(object sender, EventArgs e) { Dispatcher.BeginInvoke(new Action(() => { lock (Helpers.locker) { foreach (var arrow in arrows) { Canvas.Children.Remove(arrow); } arrows.Clear(); foreach (var shift in ShiftsStorage.Instance.Shifts) { var arrow = new Petzold.Media2D.ArrowLine(); arrow.X1 = shift.Position.X; arrow.Y1 = shift.Position.Y; arrow.X2 = shift.Position.X + shift.Shift.X; arrow.Y2 = shift.Position.Y + shift.Shift.Y; arrow.Stroke = Options.Instance.calibration_mode.multidimension_calibration_type == MultidimensionCalibrationType.None ? Brushes.Red : new SolidColorBrush(shift.Position.GetColor()); arrow.StrokeThickness = 3; Canvas.Children.Add(arrow); arrows.Add(arrow); } Description.Text = "CALIBRATIONS COUNT: " + ShiftsStorage.Instance.Shifts.Count + "/" + Options.Instance.calibration_mode.max_zones_count + " \n" + "HIDE CALIBRATION VIEW: " + Helpers.GetKeyString(Options.Instance.key_bindings[Key.Modifier], Options.Instance.key_bindings.is_modifier_e0).ToUpper() + "+" + Options.Instance.key_bindings[Key.ShowCalibrationView] + "\n" + "YOU CAN RESET CALIBRATIONS FROM THE TRAY ICON MENU"; } })); }
private void RemoveEdge(Petzold.Media2D.ArrowLine line) { foreach (var edge in EdgesList) { if (edge.line == line) { GraphPlain.Children.Remove(line); GraphPlain.Children.Remove(edge.textBox); EdgesList.Remove(edge); foreach (var vert in VertexesList) { foreach (var edges in vert.lines) { if (edges.line == line) { vert.lines.Remove(edges); break; } } } break; } } }