public void UpdateMarkupLine(Helpers.eMarkupKey key, Point startP, Point endP) { Point presentationStartPoint = new Point(startP.X * _actualWidthRate, startP.Y * _actualHeightRate); Point presentationEndPoint = new Point(endP.X * _actualWidthRate, endP.Y * _actualHeightRate); Dispatcher.Invoke(new ThreadStart(delegate { switch (key) { case Helpers.eMarkupKey.BALL_VECTOR: (_markups[key] as Line).StrokeThickness = 2; (_markups[key] as Line).Stroke = System.Windows.Media.Brushes.Aqua; (_markups[key] as Line).X1 = presentationStartPoint.X; (_markups[key] as Line).Y1 = presentationStartPoint.Y; (_markups[key] as Line).X2 = presentationEndPoint.X; (_markups[key] as Line).Y2 = presentationEndPoint.Y; break; default: return; } Canvas.SetLeft(_markups[key], 0); Canvas.SetTop(_markups[key], 0); })); }
/// <summary> /// On Update markup function /// </summary> /// <param name="key">Markup key</param> /// <param name="center">Circle center point</param> /// <param name="radius">Circle radius</param> public void UpdateMarkupCircle(Helpers.eMarkupKey key, Point center, int radius) { Point presentationCenter = new Point(center.X * _actualWidthRate, center.Y * _actualHeightRate); int presentationRadius = Convert.ToInt32(radius * ((_actualWidthRate + _actualHeightRate) / 2)); Dispatcher.Invoke(new ThreadStart(delegate { switch (key) { case Helpers.eMarkupKey.BALL_CIRCLE_MARK: if (_isDemoMode) { (_markups[key] as Shape).Fill = System.Windows.Media.Brushes.White; } (_markups[key] as Shape).StrokeThickness = 2; (_markups[key] as Shape).Stroke = System.Windows.Media.Brushes.Red; break; case Helpers.eMarkupKey.BUTTOM_LEFT_CALLIBRATION_MARK: case Helpers.eMarkupKey.BUTTOM_RIGHT_CALLIBRATION_MARK: case Helpers.eMarkupKey.TOP_LEFT_CALLIBRATION_MARK: case Helpers.eMarkupKey.TOP_RIGHT_CALLIBRATION_MARK: (_markups[key] as Shape).StrokeThickness = 2; (_markups[key] as Shape).Stroke = System.Windows.Media.Brushes.Green; break; case Helpers.eMarkupKey.BUTTOM_LEFT_CALLIBRATION_TEXT: (_markups[key] as TextBlock).FontSize = 12; (_markups[key] as TextBlock).Text = String.Format("BL:{0}x{1}", Convert.ToInt32(center.X), Convert.ToInt32(center.Y)); (_markups[key] as TextBlock).Foreground = new SolidColorBrush(Color.FromRgb(255, 150, 100)); break; case Helpers.eMarkupKey.BUTTOM_RIGHT_CALLIBRATION_TEXT: (_markups[key] as TextBlock).FontSize = 12; (_markups[key] as TextBlock).Text = String.Format("BR:{0}x{1}", Convert.ToInt32(center.X), Convert.ToInt32(center.Y)); (_markups[key] as TextBlock).Foreground = new SolidColorBrush(Color.FromRgb(255, 150, 100)); break; case Helpers.eMarkupKey.TOP_LEFT_CALLIBRATION_TEXT: (_markups[key] as TextBlock).FontSize = 12; (_markups[key] as TextBlock).Text = String.Format("TL:{0}x{1}", Convert.ToInt32(center.X), Convert.ToInt32(center.Y)); (_markups[key] as TextBlock).Foreground = new SolidColorBrush(Color.FromRgb(255, 150, 100)); break; case Helpers.eMarkupKey.TOP_RIGHT_CALLIBRATION_TEXT: (_markups[key] as TextBlock).FontSize = 12; (_markups[key] as TextBlock).Text = String.Format("TR:{0}x{1}", Convert.ToInt32(center.X), Convert.ToInt32(center.Y)); (_markups[key] as TextBlock).Foreground = new SolidColorBrush(Color.FromRgb(255, 150, 100)); break; default: return; } _markups[key].Width = presentationRadius * 2; _markups[key].Height = presentationRadius * 2; Canvas.SetLeft(_markups[key], presentationCenter.X - presentationRadius); Canvas.SetTop(_markups[key], presentationCenter.Y - presentationRadius); })); }