Function bounds done, add other decorators
This commit is contained in:
@@ -131,8 +131,6 @@ namespace StructureHelper.Windows.Graphs
|
|||||||
VisualProps = new();
|
VisualProps = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void DrawSeries()
|
private void DrawSeries()
|
||||||
{
|
{
|
||||||
SetLines();
|
SetLines();
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
<TextBlock Grid.Column="0"
|
<TextBlock Grid.Column="0"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Text="{Binding X_or_Y_text}"
|
Text="{Binding X}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right"/>
|
HorizontalAlignment="Right"/>
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
Margin="5"/>
|
Margin="5"/>
|
||||||
<TextBlock Grid.Column="0"
|
<TextBlock Grid.Column="0"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Text="{Binding X_or_Y_text}"
|
Text="{Binding X}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right"/>
|
HorizontalAlignment="Right"/>
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
@@ -153,7 +153,10 @@
|
|||||||
Margin="5"
|
Margin="5"
|
||||||
Text="Color:"
|
Text="Color:"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
<ComboBox Grid.Row="1" Text="{Binding Description}" Margin="5"/>
|
<ComboBox Grid.Row="1"
|
||||||
|
Margin="5"
|
||||||
|
ItemsSource="{Binding Colors}"
|
||||||
|
SelectedItem="{Binding CurrentColor}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Grid.Row="7" Margin="5" Content="Save"
|
<Button Grid.Row="7" Margin="5" Content="Save"
|
||||||
Command="{Binding SaveCommand}"
|
Command="{Binding SaveCommand}"
|
||||||
|
|||||||
@@ -11,30 +11,61 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.MainGraph
|
namespace StructureHelper.Windows.MainGraph
|
||||||
{
|
{
|
||||||
public class FormulaViewModel : ViewModelBase
|
public class FormulaViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
private const string ERROR_BOUNDS = "The left bound must be less than the right bound";
|
||||||
private const string DEFAULT_NAME = "Put function name here...";
|
private const string DEFAULT_NAME = "Put function name here...";
|
||||||
private const string DEFAULT_DESCRIPTION = "Put function description here...";
|
private const string DEFAULT_DESCRIPTION = "Put function description here...";
|
||||||
private const string DEFAULT_FORMULA = "x^2";
|
private const string DEFAULT_FORMULA = "x^2";
|
||||||
private const double DEFAULT_LEFT_BOUND = 0;
|
private const double DEFAULT_LEFT_BOUND = 0;
|
||||||
private const double DEFAULT_RIGHT_BOUND = 1000;
|
private const double DEFAULT_RIGHT_BOUND = 1000;
|
||||||
private const int DEFAULT_STEP = 100;
|
private const int DEFAULT_STEP = 100;
|
||||||
|
public char GREATER { get; } = '\u2265';
|
||||||
|
public char LESS { get; } = '\u2264';
|
||||||
|
public char X { get; } = 'x';
|
||||||
private RelayCommand saveCommand;
|
private RelayCommand saveCommand;
|
||||||
|
public int Step { get; set; }
|
||||||
|
private double leftBound;
|
||||||
|
public double LeftBound
|
||||||
|
{
|
||||||
|
get => leftBound;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
leftBound = value;
|
||||||
|
LimitText = $"x\u2208[{value};{RightBound}]";
|
||||||
|
OnPropertyChanged(nameof(LeftBound));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private double rightBound;
|
||||||
|
public double RightBound
|
||||||
|
{
|
||||||
|
get => rightBound;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
rightBound = value;
|
||||||
|
LimitText = $"x\u2208[{LeftBound};{value}]";
|
||||||
|
OnPropertyChanged(nameof(RightBound));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Color CurrentColor { get; set; }
|
||||||
|
public ObservableCollection<Color> Colors { get; set; }
|
||||||
public ICommand SaveCommand
|
public ICommand SaveCommand
|
||||||
{
|
{
|
||||||
get => saveCommand ??= new RelayCommand(o => Save(o));
|
get => saveCommand ??= new RelayCommand(o => Save(o));
|
||||||
}
|
}
|
||||||
private string formula;
|
private string formula;
|
||||||
|
|
||||||
public string Formula
|
public string Formula
|
||||||
{
|
{
|
||||||
get => formula;
|
get => formula;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
formula = value;
|
formula = value;
|
||||||
|
FormulaText = $"y(x)={Formula}";
|
||||||
|
OnPropertyChanged(nameof(Formula));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string formulaText = "y(x)=";
|
private string formulaText = "y(x)=";
|
||||||
@@ -43,8 +74,8 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
get => formulaText;
|
get => formulaText;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
formulaText = $"y(x)={Formula}";
|
formulaText = value;
|
||||||
OnPropertyChanged(nameof(Formula));
|
OnPropertyChanged(nameof(FormulaText));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private IOneVariableFunction function;
|
private IOneVariableFunction function;
|
||||||
@@ -74,17 +105,36 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
description = value;
|
description = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private string limitText;
|
||||||
|
public string LimitText
|
||||||
|
{
|
||||||
|
get => limitText;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
limitText = value;
|
||||||
|
OnPropertyChanged(nameof(LimitText));
|
||||||
|
}
|
||||||
|
}
|
||||||
public FormulaViewModel()
|
public FormulaViewModel()
|
||||||
{
|
{
|
||||||
Name = DEFAULT_NAME;
|
Name = DEFAULT_NAME;
|
||||||
Description = DEFAULT_DESCRIPTION;
|
Description = DEFAULT_DESCRIPTION;
|
||||||
|
Step = DEFAULT_STEP;
|
||||||
|
LeftBound = DEFAULT_LEFT_BOUND;
|
||||||
|
RightBound = DEFAULT_RIGHT_BOUND;
|
||||||
|
LimitText = $"x\u2208[{LeftBound};{RightBound}]";
|
||||||
|
CurrentColor = Brushes.AliceBlue.Color;
|
||||||
}
|
}
|
||||||
public FormulaViewModel(FormulaFunction formulaFunction)
|
public FormulaViewModel(FormulaFunction formulaFunction)
|
||||||
{
|
{
|
||||||
Function = formulaFunction;
|
Function = formulaFunction;
|
||||||
Formula = formulaFunction.Formula;
|
Formula = formulaFunction.Formula;
|
||||||
|
Step = formulaFunction.Step;
|
||||||
Name = Function.Name;
|
Name = Function.Name;
|
||||||
Description = Function.Description;
|
Description = Function.Description;
|
||||||
|
LeftBound = Function.MinArg;
|
||||||
|
RightBound = Function.MaxArg;
|
||||||
|
CurrentColor = Function.Color;
|
||||||
}
|
}
|
||||||
private void Save(object parameter)
|
private void Save(object parameter)
|
||||||
{
|
{
|
||||||
@@ -97,6 +147,11 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
Function.IsUser = true;
|
Function.IsUser = true;
|
||||||
(Function as FormulaFunction).Formula = Formula;
|
(Function as FormulaFunction).Formula = Formula;
|
||||||
var window = parameter as Window;
|
var window = parameter as Window;
|
||||||
|
if (LeftBound > RightBound)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{ERROR_BOUNDS}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
window.DialogResult = true;
|
window.DialogResult = true;
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using System.Collections.Generic;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.MainGraph
|
namespace StructureHelper.Windows.MainGraph
|
||||||
{
|
{
|
||||||
@@ -222,6 +223,8 @@ namespace StructureHelper.Windows.MainGraph
|
|||||||
chartValues.Add(Math.Round(graphPoint.Y));
|
chartValues.Add(Math.Round(graphPoint.Y));
|
||||||
}
|
}
|
||||||
lineSeries.Values = chartValues;
|
lineSeries.Values = chartValues;
|
||||||
|
lineSeries.Stroke = Brushes.Blue;
|
||||||
|
lineSeries.Fill = Brushes.Transparent;
|
||||||
Labels = labels;
|
Labels = labels;
|
||||||
seriesCollection.Add(lineSeries);
|
seriesCollection.Add(lineSeries);
|
||||||
SeriesCollection = seriesCollection;
|
SeriesCollection = seriesCollection;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
public char LEFT_BOUND { get; } = '[';
|
public char LEFT_BOUND { get; } = '[';
|
||||||
public char RIGHT_BOUND { get; } = ']';
|
public char RIGHT_BOUND { get; } = ']';
|
||||||
public char SEMICOLON { get; } = ';';
|
public char SEMICOLON { get; } = ';';
|
||||||
|
private const string ERROR_BOUNDS = "The left bound must be less than the right bound";
|
||||||
private const string X = "x";
|
private const string X = "x";
|
||||||
private const string Y = "y";
|
private const string Y = "y";
|
||||||
private string x_or_y_text;
|
private string x_or_y_text;
|
||||||
@@ -79,6 +80,11 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
private void Save(object parameter)
|
private void Save(object parameter)
|
||||||
{
|
{
|
||||||
var window = parameter as Window;
|
var window = parameter as Window;
|
||||||
|
if (LeftBound > RightBound)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{ERROR_BOUNDS}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
window.DialogResult = true;
|
window.DialogResult = true;
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
Width="1000" MinHeight="400" MinWidth="600">
|
Width="1000" MinHeight="400" MinWidth="600">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="350"/>
|
<ColumnDefinition Width="300"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -49,7 +49,6 @@
|
|||||||
<ColumnDefinition Width="50"/>
|
<ColumnDefinition Width="50"/>
|
||||||
<ColumnDefinition Width="50"/>
|
<ColumnDefinition Width="50"/>
|
||||||
<ColumnDefinition Width="50"/>
|
<ColumnDefinition Width="50"/>
|
||||||
<ColumnDefinition Width="50"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
@@ -73,9 +72,6 @@
|
|||||||
Background="DodgerBlue"
|
Background="DodgerBlue"
|
||||||
Command="{Binding LimitCommand}"
|
Command="{Binding LimitCommand}"
|
||||||
CommandParameter="y"/>
|
CommandParameter="y"/>
|
||||||
<Button Grid.Column="5" Margin="5" Content="Edit"
|
|
||||||
Background="LightYellow"
|
|
||||||
Command="{Binding EditCommand}"/>
|
|
||||||
<Button Grid.Column="6" Margin="5" Content="Delete"
|
<Button Grid.Column="6" Margin="5" Content="Delete"
|
||||||
Background="LightPink"
|
Background="LightPink"
|
||||||
Command="{Binding DeleteCommand}"/>
|
Command="{Binding DeleteCommand}"/>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using StructureHelperCommon.Models.Functions.Decorator;
|
using StructureHelperCommon.Models.Functions.Decorator;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.TreeGraph
|
namespace StructureHelper.Windows.TreeGraph
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,6 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
private RelayCommand _getYCommand;
|
private RelayCommand _getYCommand;
|
||||||
private RelayCommand _scaleCommand;
|
private RelayCommand _scaleCommand;
|
||||||
private RelayCommand _limCommand;
|
private RelayCommand _limCommand;
|
||||||
private RelayCommand _editCommand;
|
|
||||||
private RelayCommand _deleteCommand;
|
private RelayCommand _deleteCommand;
|
||||||
private TreeGraphView _treeGraphView_win;
|
private TreeGraphView _treeGraphView_win;
|
||||||
private IOneVariableFunction selectedFunction;
|
private IOneVariableFunction selectedFunction;
|
||||||
@@ -80,10 +80,6 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
{
|
{
|
||||||
get => _limCommand ??= new RelayCommand(o => Limit(o));
|
get => _limCommand ??= new RelayCommand(o => Limit(o));
|
||||||
}
|
}
|
||||||
public ICommand EditCommand
|
|
||||||
{
|
|
||||||
get => _editCommand ??= new RelayCommand(o => Edit());
|
|
||||||
}
|
|
||||||
public ICommand DeleteCommand
|
public ICommand DeleteCommand
|
||||||
{
|
{
|
||||||
get => _deleteCommand ??= new RelayCommand(o => Delete());
|
get => _deleteCommand ??= new RelayCommand(o => Delete());
|
||||||
@@ -121,22 +117,31 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ScaleViewModel vm = null;
|
ScaleViewModel vm = null;
|
||||||
|
var v = new ScaleView();
|
||||||
var type = parameter as string;
|
var type = parameter as string;
|
||||||
if (type.Equals("x"))
|
if (type.Equals("x"))
|
||||||
{
|
{
|
||||||
vm = new ScaleViewModel(true);
|
vm = new ScaleViewModel(true);
|
||||||
var v = new ScaleView();
|
|
||||||
v.DataContext = vm;
|
v.DataContext = vm;
|
||||||
if (v.ShowDialog() == true)
|
if (v.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
SelectedFuntion = new ScaleXDecorator(SelectedFuntion, vm.ScaleFactor);
|
SelectedFuntion = new ScaleXDecorator(SelectedFuntion, vm.ScaleFactor);
|
||||||
var child = new TreeViewItemViewModel(SelectedFuntion, selectedTreeViewItem, this);
|
var child = new TreeViewItemViewModel(SelectedFuntion, selectedTreeViewItem, this);
|
||||||
selectedTreeViewItem.Children.Add(child);
|
selectedTreeViewItem.Children.Add(child);
|
||||||
|
selectedTreeViewItem.IsExpanded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type.Equals("y"))
|
else if (type.Equals("y"))
|
||||||
{
|
{
|
||||||
vm = new ScaleViewModel(false);
|
vm = new ScaleViewModel(false);
|
||||||
|
v.DataContext = vm;
|
||||||
|
if (v.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
SelectedFuntion = new ScaleYDecorator(SelectedFuntion, vm.ScaleFactor);
|
||||||
|
var child = new TreeViewItemViewModel(SelectedFuntion, selectedTreeViewItem, this);
|
||||||
|
selectedTreeViewItem.Children.Add(child);
|
||||||
|
selectedTreeViewItem.IsExpanded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -151,26 +156,36 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LimViewModel vm = null;
|
LimViewModel vm = null;
|
||||||
|
var v = new LimView();
|
||||||
var type = parameter as string;
|
var type = parameter as string;
|
||||||
if (type.Equals("x"))
|
if (type.Equals("x"))
|
||||||
{
|
{
|
||||||
vm = new LimViewModel(true);
|
vm = new LimViewModel(true);
|
||||||
|
v.DataContext = vm;
|
||||||
|
if (v.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
SelectedFuntion = new LimXDecorator(SelectedFuntion, vm.LeftBound, vm.RightBound);
|
||||||
|
var child = new TreeViewItemViewModel(SelectedFuntion, selectedTreeViewItem, this);
|
||||||
|
selectedTreeViewItem.Children.Add(child);
|
||||||
|
selectedTreeViewItem.IsExpanded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type.Equals("y"))
|
else if (type.Equals("y"))
|
||||||
{
|
{
|
||||||
vm = new LimViewModel(false);
|
vm = new LimViewModel(false);
|
||||||
|
v.DataContext = vm;
|
||||||
|
if (v.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
SelectedFuntion = new LimYDecorator(SelectedFuntion, vm.LeftBound, vm.RightBound);
|
||||||
|
var child = new TreeViewItemViewModel(SelectedFuntion, selectedTreeViewItem, this);
|
||||||
|
selectedTreeViewItem.Children.Add(child);
|
||||||
|
selectedTreeViewItem.IsExpanded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var v = new LimView();
|
|
||||||
v.DataContext = vm;
|
|
||||||
v.ShowDialog();
|
|
||||||
}
|
|
||||||
private void Edit()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void Delete()
|
private void Delete()
|
||||||
{
|
{
|
||||||
@@ -204,6 +219,8 @@ namespace StructureHelper.Windows.TreeGraph
|
|||||||
chartValues.Add(Math.Round(graphPoint.Y));
|
chartValues.Add(Math.Round(graphPoint.Y));
|
||||||
}
|
}
|
||||||
lineSeries.Values = chartValues;
|
lineSeries.Values = chartValues;
|
||||||
|
lineSeries.Stroke = Brushes.Blue;
|
||||||
|
lineSeries.Fill = Brushes.Transparent;
|
||||||
Labels = labels;
|
Labels = labels;
|
||||||
seriesCollection.Add(lineSeries);
|
seriesCollection.Add(lineSeries);
|
||||||
SeriesCollection = seriesCollection;
|
SeriesCollection = seriesCollection;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using LiveCharts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Functions;
|
using StructureHelperCommon.Models.Functions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -26,6 +28,8 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
public Guid Id => throw new NotImplementedException();
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public Color Color { get; set; }
|
||||||
|
|
||||||
public FunctionDecorator(IOneVariableFunction function)
|
public FunctionDecorator(IOneVariableFunction function)
|
||||||
{
|
{
|
||||||
this.function = function;
|
this.function = function;
|
||||||
@@ -42,5 +46,9 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
{
|
{
|
||||||
return function.GetByX(xValue);
|
return function.GetByX(xValue);
|
||||||
}
|
}
|
||||||
|
public virtual SeriesCollection GetSeriesCollection()
|
||||||
|
{
|
||||||
|
return function.GetSeriesCollection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using LiveCharts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models.Functions;
|
using StructureHelperCommon.Models.Functions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,6 +8,7 @@ using System.ComponentModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
{
|
{
|
||||||
@@ -22,8 +24,10 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
public List<GraphPoint> Table { get; set; }
|
public List<GraphPoint> Table { get; set; }
|
||||||
public double MinArg { get; set; }
|
public double MinArg { get; set; }
|
||||||
public double MaxArg { get; set; }
|
public double MaxArg { get; set; }
|
||||||
|
public Color Color { get; set; }
|
||||||
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
|
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
|
||||||
public bool Check();
|
public bool Check();
|
||||||
public double GetByX(double xValue);
|
public double GetByX(double xValue);
|
||||||
|
public SeriesCollection GetSeriesCollection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using LiveCharts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -13,6 +14,7 @@ namespace StructureHelperCommon.Models.Functions.Decorator
|
|||||||
private double rightBound;
|
private double rightBound;
|
||||||
public LimXDecorator(IOneVariableFunction function, double leftBound, double rightBound) : base(function)
|
public LimXDecorator(IOneVariableFunction function, double leftBound, double rightBound) : base(function)
|
||||||
{
|
{
|
||||||
|
Name = $"x\u2208[{leftBound};{rightBound}]";
|
||||||
this.leftBound = leftBound;
|
this.leftBound = leftBound;
|
||||||
this.rightBound = rightBound;
|
this.rightBound = rightBound;
|
||||||
}
|
}
|
||||||
@@ -28,5 +30,9 @@ namespace StructureHelperCommon.Models.Functions.Decorator
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
public override SeriesCollection GetSeriesCollection()
|
||||||
|
{
|
||||||
|
return base.GetSeriesCollection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using LiveCharts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Functions.Decorator
|
||||||
|
{
|
||||||
|
public class LimYDecorator : FunctionDecorator
|
||||||
|
{
|
||||||
|
private double leftBound;
|
||||||
|
private double rightBound;
|
||||||
|
public LimYDecorator(IOneVariableFunction function, double leftBound, double rightBound) : base(function)
|
||||||
|
{
|
||||||
|
Name = $"y\u2208[{leftBound};{rightBound}]";
|
||||||
|
this.leftBound = leftBound;
|
||||||
|
this.rightBound = rightBound;
|
||||||
|
}
|
||||||
|
public override bool Check()
|
||||||
|
{
|
||||||
|
return base.Check();
|
||||||
|
}
|
||||||
|
public override double GetByX(double xValue)
|
||||||
|
{
|
||||||
|
var y = base.GetByX(xValue);
|
||||||
|
if (y > leftBound && y < rightBound)
|
||||||
|
{
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public override SeriesCollection GetSeriesCollection()
|
||||||
|
{
|
||||||
|
return base.GetSeriesCollection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using LiveCharts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -13,7 +14,7 @@ namespace StructureHelperCommon.Models.Functions.Decorator
|
|||||||
public ScaleXDecorator(IOneVariableFunction function, double factor) : base(function)
|
public ScaleXDecorator(IOneVariableFunction function, double factor) : base(function)
|
||||||
{
|
{
|
||||||
this.factor = factor;
|
this.factor = factor;
|
||||||
Name = $"{function.Name}, y=f({factor}x)";
|
Name = $"y=f({factor}x)";
|
||||||
}
|
}
|
||||||
public override bool Check()
|
public override bool Check()
|
||||||
{
|
{
|
||||||
@@ -23,5 +24,9 @@ namespace StructureHelperCommon.Models.Functions.Decorator
|
|||||||
{
|
{
|
||||||
return base.GetByX(factor * xValue);
|
return base.GetByX(factor * xValue);
|
||||||
}
|
}
|
||||||
|
public override SeriesCollection GetSeriesCollection()
|
||||||
|
{
|
||||||
|
return base.GetSeriesCollection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using LiveCharts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Functions.Decorator
|
||||||
|
{
|
||||||
|
public class ScaleYDecorator : FunctionDecorator
|
||||||
|
{
|
||||||
|
private double factor;
|
||||||
|
public ScaleYDecorator(IOneVariableFunction function, double factor) : base(function)
|
||||||
|
{
|
||||||
|
this.factor = factor;
|
||||||
|
Name = $"y={factor}f(x)";
|
||||||
|
}
|
||||||
|
public override bool Check()
|
||||||
|
{
|
||||||
|
return base.Check();
|
||||||
|
}
|
||||||
|
public override double GetByX(double xValue)
|
||||||
|
{
|
||||||
|
return factor * base.GetByX(xValue);
|
||||||
|
}
|
||||||
|
public override SeriesCollection GetSeriesCollection()
|
||||||
|
{
|
||||||
|
return base.GetSeriesCollection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
using Microsoft.VisualBasic.ApplicationServices;
|
using LiveCharts;
|
||||||
|
using Microsoft.VisualBasic.ApplicationServices;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -42,6 +44,7 @@ namespace StructureHelperCommon.Models.Functions
|
|||||||
public double MinArg { get; set; }
|
public double MinArg { get; set; }
|
||||||
public double MaxArg { get; set; }
|
public double MaxArg { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public Color Color { get; set; }
|
||||||
|
|
||||||
public FormulaFunction(bool isUser = false)
|
public FormulaFunction(bool isUser = false)
|
||||||
{
|
{
|
||||||
@@ -86,7 +89,7 @@ namespace StructureHelperCommon.Models.Functions
|
|||||||
yValue = Math.Round(Math.Pow(xValue, 2), 2); //Временное тестовой выражение квадратичной параболы, будет разбор выражения
|
yValue = Math.Round(Math.Pow(xValue, 2), 2); //Временное тестовой выражение квадратичной параболы, будет разбор выражения
|
||||||
return yValue;
|
return yValue;
|
||||||
}
|
}
|
||||||
public List<GraphPoint> CalculateTable()
|
private List<GraphPoint> CalculateTable()
|
||||||
{
|
{
|
||||||
var table = new List<GraphPoint>();
|
var table = new List<GraphPoint>();
|
||||||
var stepLenght = Math.Abs(MaxArg - MinArg) / Step;
|
var stepLenght = Math.Abs(MaxArg - MinArg) / Step;
|
||||||
@@ -97,5 +100,9 @@ namespace StructureHelperCommon.Models.Functions
|
|||||||
}
|
}
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
public SeriesCollection GetSeriesCollection()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using LiveCharts;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -30,6 +32,7 @@ namespace StructureHelperCommon.Models.Functions
|
|||||||
public double MinArg { get; set; }
|
public double MinArg { get; set; }
|
||||||
public double MaxArg { get; set; }
|
public double MaxArg { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public Color Color { get; set; }
|
||||||
|
|
||||||
public TableFunction(bool isUser = false)
|
public TableFunction(bool isUser = false)
|
||||||
{
|
{
|
||||||
@@ -71,7 +74,12 @@ namespace StructureHelperCommon.Models.Functions
|
|||||||
{
|
{
|
||||||
//Реализовать взятие значения из таблицы и интерполяцию по таблице
|
//Реализовать взятие значения из таблицы и интерполяцию по таблице
|
||||||
|
|
||||||
return 100;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeriesCollection GetSeriesCollection()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="LiveCharts.Wpf" Version="0.9.7" />
|
||||||
<PackageReference Include="NLog" Version="5.3.3" />
|
<PackageReference Include="NLog" Version="5.3.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user