/// <summary> /// Initializes a new instance of the <see cref="PolyFunctionVMContainer"/> class. /// </summary> /// <param name="polyFunction"> The <see cref="PolyFunctionVM"/>. </param> public PolyFunctionVMContainer(PolyFunctionVM polyFunction) { this.Opacity = polyFunction.Opacity; this.StrokeThickness = polyFunction.StrokeThickness; this.FunctionColor = polyFunction.FunctionColor; this.PolyFunction = polyFunction.Model; }
/// <summary> /// This method adds saved functions to the current lists. /// </summary> /// <param name="c"> The container file. </param> public void AddSavedFunctionsToList(ContainerFileForSerealization c) { while (this.PolyFunctions.Count != 0) { this.PolyFunctions.RemoveAt(0); } while (this.TrigFunctions.Count != 0) { this.TrigFunctions.RemoveAt(0); } foreach (var item in c.TrigFunctions) { var vm = new TrigFunctionVM(item, this.removeCommand); vm.GetPolyline(this.SmallestXValueGrid, this.BigestXValueGrid, this.SmallestYValueGrid, this.BigestYValueGrid); vm.OnTrigFunctionChanged += this.DrawNewPolyLineForTrigFunction; this.TrigFunctions.Add(vm); } foreach (var item in c.PolyFunctions) { var polyFunction = new PolyFunction(item.ParameterList); var vm = new PolyFunctionVM(polyFunction, this.removeCommandPoly); vm.GetPolyline(this.SmallestXValueGrid, this.BigestXValueGrid, this.SmallestYValueGrid, this.BigestYValueGrid); vm.OnPolyFunctionChanged += this.DrawNewPolyLineForPolyFunction; this.PolyFunctions.Add(vm); } }
/// <summary> /// Initializes a new instance of the <see cref="PolyFunctionVM"/> class. /// </summary> /// <param name="polyFunction"> The model of the <see cref="PolyFunction"/>. </param> /// <param name="removeCommand"> The remove command. </param> public PolyFunctionVM(PolyFunction polyFunction, ICommand removeCommand) { this.points = new PointCollection(); this.Model = polyFunction; this.Values = polyFunction.ParameterList; this.removeCommand = removeCommand; this.opacity = 1; this.strokeThickness = 1; this.functionColor = Colors.Red; this.Brush = new SolidColorBrush(); this.Brush.Color = this.functionColor; }
/// <summary> /// Initializes a new instance of the <see cref="PolyFunctionVM"/> class. /// </summary> /// <param name="polyFunctionVMContainer"> The container for the <see cref="PolyFunction"/>. </param> /// <param name="removeCommand"> The remove command. </param> public PolyFunctionVM(PolyFunctionVMContainer polyFunctionVMContainer, ICommand removeCommand) { this.points = new PointCollection(); this.Model = polyFunctionVMContainer.PolyFunction; this.Name = polyFunctionVMContainer.PolyFunction.Name; this.Values = polyFunctionVMContainer.PolyFunction.ParameterList; this.removeCommand = removeCommand; this.opacity = polyFunctionVMContainer.Opacity; this.strokeThickness = polyFunctionVMContainer.StrokeThickness; this.functionColor = polyFunctionVMContainer.FunctionColor; this.Brush = new SolidColorBrush(); this.Brush.Color = this.functionColor; }
private static string CreatePolyExpression( int dimension, ParameterCollection coefficients, List <string> variables, EvaluationContext context) { if (coefficients.Count == 1 && coefficients[0] is PointParameter pp) { var result = PolyFunction.GetExpression( dimension, pp.Values.Items.Select(c => context.Evaluate(c.Image)).ToList(), variables); return(result); } else { var result = PolyFunction.GetExpression( dimension, coefficients.Select(c => context.Evaluate(c.Image)).ToList(), variables); return(result); } }