diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user
index bd8bbec..8342004 100644
--- a/StructureHelper/StructureHelper.csproj.user
+++ b/StructureHelper/StructureHelper.csproj.user
@@ -93,6 +93,9 @@
Code
+
+ Code
+
Code
@@ -209,6 +212,9 @@
Designer
+
+ Designer
+
Designer
diff --git a/StructureHelper/Windows/MainGraph/FormulaView.xaml b/StructureHelper/Windows/MainGraph/FormulaView.xaml
index 4fadf4b..878d67a 100644
--- a/StructureHelper/Windows/MainGraph/FormulaView.xaml
+++ b/StructureHelper/Windows/MainGraph/FormulaView.xaml
@@ -1,13 +1,23 @@
+ Title="FormulaFunction" Height="640" Width="400">
+
+
+
+
+
+
+
@@ -17,6 +27,7 @@
+
@@ -134,6 +145,20 @@
+
+
+
+
+
+
+
+
@@ -144,7 +169,7 @@
VerticalAlignment="Center"/>
-
+
@@ -173,7 +198,7 @@
-
diff --git a/StructureHelper/Windows/MainGraph/FormulaViewModel.cs b/StructureHelper/Windows/MainGraph/FormulaViewModel.cs
index 8d85811..3582c24 100644
--- a/StructureHelper/Windows/MainGraph/FormulaViewModel.cs
+++ b/StructureHelper/Windows/MainGraph/FormulaViewModel.cs
@@ -1,5 +1,6 @@
using StructureHelper.Infrastructure;
+using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Functions;
using StructureHelperCommon.Services.ColorServices;
@@ -103,6 +104,15 @@ namespace StructureHelper.Windows.MainGraph
name = value;
}
}
+ private FunctionPurpose functionPurpose;
+ public FunctionPurpose FunctionPurpose
+ {
+ get => functionPurpose;
+ set
+ {
+ functionPurpose = value;
+ }
+ }
private string description;
public string Description
{
@@ -148,6 +158,7 @@ namespace StructureHelper.Windows.MainGraph
Formula = formulaFunction.Formula;
Step = formulaFunction.Step;
Name = Function.Name;
+ FunctionPurpose = Function.FunctionPurpose;
Description = Function.Description;
LeftBound = Function.MinArg;
RightBound = Function.MaxArg;
@@ -173,6 +184,7 @@ namespace StructureHelper.Windows.MainGraph
Function.Color = Color;
Function.MinArg = LeftBound;
Function.MaxArg = RightBound;
+ Function.FunctionPurpose = FunctionPurpose;
var window = parameter as Window;
if (LeftBound > RightBound)
{
diff --git a/StructureHelper/Windows/MainGraph/TableView.xaml b/StructureHelper/Windows/MainGraph/TableView.xaml
index 58d5565..96a0a66 100644
--- a/StructureHelper/Windows/MainGraph/TableView.xaml
+++ b/StructureHelper/Windows/MainGraph/TableView.xaml
@@ -1,16 +1,26 @@
+
+
+
+
+
+
+
@@ -19,6 +29,7 @@
+
@@ -96,6 +107,20 @@
+
+
+
+
+
+
+
+
@@ -106,7 +131,7 @@
VerticalAlignment="Center"/>
-
+
@@ -135,7 +160,7 @@
-
diff --git a/StructureHelper/Windows/MainGraph/TableViewModel.cs b/StructureHelper/Windows/MainGraph/TableViewModel.cs
index 09d5883..e41dc46 100644
--- a/StructureHelper/Windows/MainGraph/TableViewModel.cs
+++ b/StructureHelper/Windows/MainGraph/TableViewModel.cs
@@ -1,4 +1,5 @@
using StructureHelper.Infrastructure;
+using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Functions;
using StructureHelperCommon.Models.Shapes;
@@ -79,6 +80,15 @@ namespace StructureHelper.Windows.MainGraph
name = value;
}
}
+ private FunctionPurpose functionPurpose;
+ public FunctionPurpose FunctionPurpose
+ {
+ get => functionPurpose;
+ set
+ {
+ functionPurpose = value;
+ }
+ }
private string description;
public string Description
{
@@ -114,6 +124,7 @@ namespace StructureHelper.Windows.MainGraph
Function = tableFunction;
Table = new ObservableCollection((Function as TableFunction).Table);
Name = Function.Name;
+ FunctionPurpose = Function.FunctionPurpose;
Description = Function.Description;
Color = Function.Color;
}
@@ -134,6 +145,7 @@ namespace StructureHelper.Windows.MainGraph
Function.IsUser = true;
(Function as TableFunction).Table = Table.OrderBy(x => x.X).ToList();
Function.Color = Color;
+ Function.FunctionPurpose = FunctionPurpose;
var window = parameter as Window;
window.DialogResult = true;
window.Close();
diff --git a/StructureHelper/Windows/TreeGraph/RenameView.xaml b/StructureHelper/Windows/TreeGraph/RenameView.xaml
new file mode 100644
index 0000000..e09447c
--- /dev/null
+++ b/StructureHelper/Windows/TreeGraph/RenameView.xaml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StructureHelper/Windows/TreeGraph/RenameView.xaml.cs b/StructureHelper/Windows/TreeGraph/RenameView.xaml.cs
new file mode 100644
index 0000000..cc6b649
--- /dev/null
+++ b/StructureHelper/Windows/TreeGraph/RenameView.xaml.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.TreeGraph
+{
+ ///
+ /// Interaction logic for RenameView.xaml
+ ///
+ public partial class RenameView : Window
+ {
+ public RenameView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/StructureHelper/Windows/TreeGraph/RenameViewModel.cs b/StructureHelper/Windows/TreeGraph/RenameViewModel.cs
new file mode 100644
index 0000000..274e023
--- /dev/null
+++ b/StructureHelper/Windows/TreeGraph/RenameViewModel.cs
@@ -0,0 +1,42 @@
+using StructureHelper.Infrastructure;
+using StructureHelperCommon.Infrastructures.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+
+namespace StructureHelper.Windows.TreeGraph
+{
+ public class RenameViewModel : ViewModelBase
+ {
+
+ private RelayCommand saveCommand;
+ public ICommand SaveCommand
+ {
+ get => saveCommand ??= new RelayCommand(o => Save(o));
+ }
+ private string functionName;
+ public string FunctionName
+ {
+ get => functionName;
+ set
+ {
+ functionName = value;
+ OnPropertyChanged(nameof(FunctionName));
+ }
+ }
+ public RenameViewModel(TreeViewItemViewModel item)
+ {
+ FunctionName = item.Name;
+ }
+ private void Save(object parameter)
+ {
+ var window = parameter as Window;
+ window.DialogResult = true;
+ window.Close();
+ }
+ }
+}
diff --git a/StructureHelper/Windows/TreeGraph/TreeGraphView.xaml b/StructureHelper/Windows/TreeGraph/TreeGraphView.xaml
index 38b46b3..7fa4f13 100644
--- a/StructureHelper/Windows/TreeGraph/TreeGraphView.xaml
+++ b/StructureHelper/Windows/TreeGraph/TreeGraphView.xaml
@@ -7,7 +7,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.TreeGraph"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:TreeGraphViewModel}"
- Title="StructureHelper" Height="700"
+ Title="StructureHelper" Height="750"
Width="1000" MinHeight="400" MinWidth="600">
@@ -18,6 +18,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StructureHelper/Windows/TreeGraph/TreeGraphViewModel.cs b/StructureHelper/Windows/TreeGraph/TreeGraphViewModel.cs
index b4482ad..bfa1aea 100644
--- a/StructureHelper/Windows/TreeGraph/TreeGraphViewModel.cs
+++ b/StructureHelper/Windows/TreeGraph/TreeGraphViewModel.cs
@@ -14,6 +14,8 @@ using System.Windows.Input;
using StructureHelperCommon.Models.Functions.Decorator;
using System.Windows.Media;
using StructureHelper.Windows.Graphs;
+using System.Windows.Controls;
+
namespace StructureHelper.Windows.TreeGraph
{
@@ -23,15 +25,18 @@ namespace StructureHelper.Windows.TreeGraph
private SeriesCollection seriesCollection;
private List labels;
readonly ObservableCollection _tree;
- readonly TreeViewItemViewModel _rootFunction;
+ readonly TreeViewItemViewModel _root;
readonly ICommand _searchCommand;
private RelayCommand _getYCommand;
private RelayCommand _scaleCommand;
private RelayCommand _limCommand;
private RelayCommand _deleteCommand;
+ private RelayCommand _treeCommand;
+ private RelayCommand _renameCommand;
private RelayCommand _saveCommand;
private TreeGraphView _treeGraphView_win;
private IOneVariableFunction selectedFunction;
+ private IOneVariableFunction rootFunction;
public IOneVariableFunction SelectedFuntion
{
get
@@ -44,6 +49,18 @@ namespace StructureHelper.Windows.TreeGraph
OnPropertyChanged(nameof(SelectedFuntion));
}
}
+ public IOneVariableFunction RootFunction
+ {
+ get
+ {
+ return rootFunction;
+ }
+ set
+ {
+ rootFunction = value;
+ OnPropertyChanged(nameof(RootFunction));
+ }
+ }
public SeriesCollection SeriesCollection
{
get => seriesCollection;
@@ -97,19 +114,27 @@ namespace StructureHelper.Windows.TreeGraph
{
get => _deleteCommand ??= new RelayCommand(o => Delete());
}
+ public ICommand TreeCommand
+ {
+ get => _treeCommand ??= new RelayCommand(o => NewTree());
+ }
+ public ICommand RenameCommand
+ {
+ get => _renameCommand ??= new RelayCommand(o => Rename(o));
+ }
public ICommand SaveCommand
{
get => _saveCommand ??= new RelayCommand(o => Save());
}
public TreeGraphViewModel(IOneVariableFunction rootFunction)
{
- _rootFunction = new TreeViewItemViewModel(rootFunction, this);
-
+ RootFunction = rootFunction;
+ _root = new TreeViewItemViewModel(rootFunction, this);
_tree = new ObservableCollection
(
new ObservableCollection()
{
- _rootFunction,
+ _root,
}
);
}
@@ -218,6 +243,39 @@ namespace StructureHelper.Windows.TreeGraph
}
selectedTreeViewItemParent.Children.Remove(selectedTreeViewItem);
}
+ private void Rename(object parameter)
+ {
+ var selectedTreeViewItem = TreeGraphView_win.FunctionTreeView.SelectedItem as TreeViewItemViewModel;
+ if (selectedTreeViewItem is null)
+ {
+ return;
+ }
+ var selectedTreeViewItemParent = selectedTreeViewItem.Parent;
+ if (selectedTreeViewItemParent is null)
+ {
+ return;
+ }
+ var renameViewModel = new RenameViewModel(selectedTreeViewItem);
+ var renameView = new RenameView();
+ renameView.DataContext = renameViewModel;
+ if (renameView.ShowDialog() == true)
+ {
+ selectedTreeViewItem.Name = renameViewModel.FunctionName;
+ }
+ }
+ private void NewTree()
+ {
+ if (SelectedFuntion is null)
+ {
+ return;
+ }
+ var treeGraphVM = new TreeGraphViewModel(SelectedFuntion);
+ var treeGraph = new TreeGraphView();
+ treeGraph.DataContext = treeGraphVM;
+ treeGraphVM.TreeGraphView_win = treeGraph;
+ treeGraph.ShowDialog();
+ //Сохранить поддерево
+ }
public void DrawGraph()
{
var labels = new List();
@@ -240,6 +298,12 @@ namespace StructureHelper.Windows.TreeGraph
public void Save()
{
+
+
+ }
+ private List GetFunctionChildern(TreeViewItemViewModel item)
+ {
+ return null;
}
}
}
diff --git a/StructureHelper/Windows/TreeGraph/TreeViewItemViewModel.cs b/StructureHelper/Windows/TreeGraph/TreeViewItemViewModel.cs
index d028f8d..f527197 100644
--- a/StructureHelper/Windows/TreeGraph/TreeViewItemViewModel.cs
+++ b/StructureHelper/Windows/TreeGraph/TreeViewItemViewModel.cs
@@ -46,6 +46,11 @@ namespace StructureHelper.Windows.TreeGraph
public string Name
{
get { return _function.Name; }
+ set
+ {
+ _function.Name = value;
+ OnPropertyChanged(nameof(Name));
+ }
}
public bool IsExpanded
{
@@ -71,6 +76,7 @@ namespace StructureHelper.Windows.TreeGraph
{
_isSelected = value;
_treeGraphViewModel.DrawGraph();
+ _treeGraphViewModel.Save();
OnPropertyChanged(nameof(IsSelected));
}
}
diff --git a/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs b/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs
index 01f7ce6..d22aabc 100644
--- a/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs
+++ b/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs
@@ -96,9 +96,26 @@ namespace StructureHelperCommon.Infrastructures.Settings
}
public static ObservableCollection Functions { get; set; } = new ObservableCollection
{
+ new TableFunction()
+ {
+ Name = "Not StressStrain",
+ FunctionPurpose = FunctionPurpose.FireProtection,
+ Table = new List()
+ {
+ new GraphPoint(1, 1),
+ new GraphPoint(2, 2),
+ new GraphPoint(3, 3),
+ new GraphPoint(4, 4),
+ new GraphPoint(5, 5),
+ new GraphPoint(6, 6),
+ },
+ IsUser = false,
+ Description = "Пример описания",
+ },
new TableFunction()
{
Name = "Табличная системная функция",
+ FunctionPurpose = FunctionPurpose.StressStrain,
Table = new List()
{
new GraphPoint(1, 1),
@@ -114,6 +131,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
new FormulaFunction()
{
Name = "Формульная системная функция",
+ FunctionPurpose = FunctionPurpose.StressStrain,
Formula = "x^2",
Step = 100,
MinArg = 1,
diff --git a/StructureHelperCommon/Models/Functions/FormulaFunction.cs b/StructureHelperCommon/Models/Functions/FormulaFunction.cs
index 5a73beb..0c2b1bf 100644
--- a/StructureHelperCommon/Models/Functions/FormulaFunction.cs
+++ b/StructureHelperCommon/Models/Functions/FormulaFunction.cs
@@ -95,6 +95,7 @@ namespace StructureHelperCommon.Models.Functions
formulaFunction.Step = Step;
formulaFunction.MinArg = MinArg;
formulaFunction.MaxArg = MaxArg;
+ formulaFunction.FunctionPurpose = FunctionPurpose;
return formulaFunction;
}
diff --git a/StructureHelperCommon/Models/Functions/TableFunction.cs b/StructureHelperCommon/Models/Functions/TableFunction.cs
index 633b176..0be3560 100644
--- a/StructureHelperCommon/Models/Functions/TableFunction.cs
+++ b/StructureHelperCommon/Models/Functions/TableFunction.cs
@@ -68,6 +68,7 @@ namespace StructureHelperCommon.Models.Functions
tableFunction.Table = newTable;
tableFunction.IsUser = true;
tableFunction.Group = GROUP_TYPE_2;
+ tableFunction.FunctionPurpose = FunctionPurpose;
return tableFunction;
}
diff --git a/StructureHelperCommon/Windows/FunctionSelectionVM.cs b/StructureHelperCommon/Windows/FunctionSelectionVM.cs
index 52655da..f9d6fa3 100644
--- a/StructureHelperCommon/Windows/FunctionSelectionVM.cs
+++ b/StructureHelperCommon/Windows/FunctionSelectionVM.cs
@@ -27,7 +27,7 @@ namespace StructureHelperCommon.Windows
public string SPECIAL { get; } = "Special Limit State";
public string CREATE_MATERIAL { get; } = "Create Function Material";
private const string ERROR_TEXT_1 = "Not all material states have functions ";
- public ObservableCollection Functions { get; set; } = ProgramSetting.Functions;
+ public ObservableCollection Functions { get; set; }
public IOneVariableFunction Func_ST_ULS { get; set; }
public IOneVariableFunction Func_ST_SLS { get; set; }
public IOneVariableFunction Func_ST_Special { get; set; }
@@ -35,6 +35,11 @@ namespace StructureHelperCommon.Windows
public IOneVariableFunction Func_LT_SLS { get; set; }
public IOneVariableFunction Func_LT_Special { get; set; }
public FunctionStorage FunctionStorage { get; set; } = new();
+ public FunctionSelectionVM()
+ {
+ var listFunctions = ProgramSetting.Functions.Where(x => x.FunctionPurpose == Infrastructures.Enums.FunctionPurpose.StressStrain).ToList();
+ Functions = new ObservableCollection();
+ }
private void CreateFunctionMaterial(object parameter)
{
var window = parameter as Window;