public void AddFunction(IEnumerable <Point> points, Color color, string description) { if (!squaresFunctions.ContainsKey(description) && !functions.ContainsKey(description)) { Polyline polyline = new Polyline(); polyline.Stroke = new SolidColorBrush(color); polyline.StrokeThickness = CalculateThickness(0.005, R2.Width, R2.Height); PointCollection pColl = new PointCollection(points); polyline.Points = pColl; var nwFour = new Four(polyline.Points.Min(p => p.X), polyline.Points.Max(p => p.Y), polyline.Points.Min(p => p.Y), polyline.Points.Max(p => p.Y)); squaresFunctions.Add(description, nwFour); RecalculateSquare(); GoToCenter(); DrowCoordinates(); R2.Children.Add(polyline); Label lbl = new Label(); lbl.Content = description; lbl.Foreground = new SolidColorBrush(color); Descriptions.Children.Add(lbl); functions.Add(description, new Tuple <Polyline, Label>(polyline, lbl)); } }
public void AddFunction(IEnumerable<Point> points, Color color, string description) { if(!squaresFunctions.ContainsKey(description) && !functions.ContainsKey(description)) { Polyline polyline = new Polyline(); polyline.Stroke = new SolidColorBrush(color); polyline.StrokeThickness = CalculateThickness(0.005, R2.Width, R2.Height); PointCollection pColl = new PointCollection(points); polyline.Points = pColl; var nwFour = new Four(polyline.Points.Min(p => p.X), polyline.Points.Max(p => p.Y), polyline.Points.Min(p => p.Y), polyline.Points.Max(p => p.Y)); squaresFunctions.Add(description, nwFour); RecalculateSquare(); GoToCenter(); DrowCoordinates(); R2.Children.Add(polyline); Label lbl = new Label(); lbl.Content = description; lbl.Foreground = new SolidColorBrush(color); Descriptions.Children.Add(lbl); functions.Add(description, new Tuple<Polyline, Label>(polyline, lbl)); } }