Add tree graph commands
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -14,6 +16,8 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
public FunctionType Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<GraphPoint> Table { get; set; }
|
||||
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
|
||||
public bool Check();
|
||||
public double GetByX(double xValue);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,14 +12,22 @@ namespace StructureHelperCommon.Models.Functions
|
||||
{
|
||||
public class FormulaFunction : IOneVariableFunction
|
||||
{
|
||||
private const string COPY = "copy";
|
||||
public bool IsUser { get; set; }
|
||||
public FunctionType Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get ; set; }
|
||||
public List<GraphPoint> Table { get; set; }
|
||||
public string Formula { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
|
||||
public FormulaFunction()
|
||||
{
|
||||
Type = FunctionType.FormulaFunction;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -30,11 +39,10 @@ namespace StructureHelperCommon.Models.Functions
|
||||
|
||||
//Здесь будет стратегия
|
||||
formulaFunction.Type = Type;
|
||||
formulaFunction.Name = Name;
|
||||
formulaFunction.Name = $"{Name} {COPY}";
|
||||
formulaFunction.Description = Description;
|
||||
formulaFunction.Formula = Formula;
|
||||
formulaFunction.IsUser = true;
|
||||
|
||||
return formulaFunction;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,20 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Functions
|
||||
{
|
||||
public class GraphPoint
|
||||
public class GraphPoint : ICloneable
|
||||
{
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
|
||||
public GraphPoint(double x, double y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
public object Clone()
|
||||
{
|
||||
var clone = new GraphPoint(X,Y);
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ namespace StructureHelperCommon.Models.Functions
|
||||
{
|
||||
public class TableFunction : IOneVariableFunction
|
||||
{
|
||||
private const string COPY = "copy";
|
||||
private string name;
|
||||
|
||||
public bool IsUser { get; set; }
|
||||
public FunctionType Type { get; set; }
|
||||
public string Name
|
||||
@@ -27,8 +29,12 @@ namespace StructureHelperCommon.Models.Functions
|
||||
public List<GraphPoint> Table { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
public TableFunction()
|
||||
{
|
||||
Type = FunctionType.TableFunction;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
@@ -41,9 +47,11 @@ namespace StructureHelperCommon.Models.Functions
|
||||
|
||||
//Здесь будет стратегия
|
||||
tableFunction.Type = Type;
|
||||
tableFunction.Name = Name;
|
||||
tableFunction.Name = $"{Name} {COPY}";
|
||||
tableFunction.Description = Description;
|
||||
tableFunction.Table = Table;
|
||||
var newTable = new List<GraphPoint>();
|
||||
Table.ForEach(x => newTable.Add(x.Clone() as GraphPoint));
|
||||
tableFunction.Table = newTable;
|
||||
tableFunction.IsUser = true;
|
||||
|
||||
return tableFunction;
|
||||
|
||||
Reference in New Issue
Block a user