Window function material done

This commit is contained in:
Иван Ивашкин
2025-02-21 15:17:10 +05:00
parent 27d4ca95c8
commit 0a7a696b5f
18 changed files with 218 additions and 48 deletions

View File

@@ -39,6 +39,7 @@
<None Remove="Windows\MainWindow\Delete.png" /> <None Remove="Windows\MainWindow\Delete.png" />
<None Remove="Windows\MainWindow\Edit.png" /> <None Remove="Windows\MainWindow\Edit.png" />
<None Remove="Windows\MainWindow\ElasticMaterial32.png" /> <None Remove="Windows\MainWindow\ElasticMaterial32.png" />
<None Remove="Windows\MainWindow\FunctionMaterial.png" />
<None Remove="Windows\MainWindow\GetY.png" /> <None Remove="Windows\MainWindow\GetY.png" />
<None Remove="Windows\MainWindow\GlassMaterial32.png" /> <None Remove="Windows\MainWindow\GlassMaterial32.png" />
<None Remove="Windows\MainWindow\LimX.png" /> <None Remove="Windows\MainWindow\LimX.png" />
@@ -124,6 +125,7 @@
<Resource Include="Windows\MainWindow\Rebar32.png" /> <Resource Include="Windows\MainWindow\Rebar32.png" />
<Resource Include="Windows\MainWindow\Rectangle32.png" /> <Resource Include="Windows\MainWindow\Rectangle32.png" />
<Resource Include="Windows\MainWindow\RectangleColumn32.png" /> <Resource Include="Windows\MainWindow\RectangleColumn32.png" />
<Resource Include="Windows\MainWindow\FunctionMaterial.png" />
<Resource Include="Windows\MainWindow\RFMaterial32.png" /> <Resource Include="Windows\MainWindow\RFMaterial32.png" />
<Resource Include="Windows\MainWindow\Run.png" /> <Resource Include="Windows\MainWindow\Run.png" />
<Resource Include="Windows\MainWindow\ScaleX.png" /> <Resource Include="Windows\MainWindow\ScaleX.png" />

View File

@@ -118,41 +118,7 @@ namespace StructureHelper.Windows.MainGraph
} }
public GraphViewModel() public GraphViewModel()
{ {
Functions = null; Functions = ProgramSetting.Functions;
if (ProgramSetting.Functions is null)
{
//Пример 1
Functions = new ObservableCollection<IOneVariableFunction>();
var f1 = new TableFunction();
f1.Name = "Табличная системная функция";
f1.Table = new List<GraphPoint>()
{
new GraphPoint(1, 1),
new GraphPoint(2, 2),
new GraphPoint(3, 3),
new GraphPoint(4, 4),
new GraphPoint(5, 5),
new GraphPoint(6, 6),
};
f1.IsUser = false;
f1.Description = "Описание табличной системной функции";
//Пример 2
var f2 = new FormulaFunction();
f2.Name = "Формульная системная функция";
f2.Formula = "x^2";
f2.Step = 100;
f2.MinArg = 1;
f2.MaxArg = 1000;
f2.IsUser = false;
f2.Description = "Описание формульной системной функции";
Functions.Add(f1);
Functions.Add(f2);
}
else
{
Functions = ProgramSetting.Functions;
}
} }
private void AddTable() private void AddTable()
{ {
@@ -242,10 +208,6 @@ namespace StructureHelper.Windows.MainGraph
{ {
return; return;
} }
//var testFunction = Database.GetFunctionTree();
//var treeGraphVM = new TreeGraphViewModel(testFunction);
var treeGraphVM = new TreeGraphViewModel(SelectedFuntion); var treeGraphVM = new TreeGraphViewModel(SelectedFuntion);
var treeGraph = new TreeGraphView(); var treeGraph = new TreeGraphView();
treeGraph.DataContext = treeGraphVM; treeGraph.DataContext = treeGraphVM;

View File

@@ -161,7 +161,7 @@
<Image Source="/Windows/MainWindow/GlassMaterial32.png"/> <Image Source="/Windows/MainWindow/GlassMaterial32.png"/>
</Button> </Button>
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Function}" ToolTip="Add Glass Fiber Material"> <Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Function}" ToolTip="Add Glass Fiber Material">
<Image Source="/Windows/MainWindow/Run.png"/> <Image Source="/Windows/MainWindow/FunctionMaterial.png"/>
</Button> </Button>
<Button Style="{StaticResource ToolButton}" Command="{Binding EditMaterialsCommand}" ToolTip="Show Materials"> <Button Style="{StaticResource ToolButton}" Command="{Binding EditMaterialsCommand}" ToolTip="Show Materials">
<Image Source="/Windows/MainWindow/Materials32.png"/> <Image Source="/Windows/MainWindow/Materials32.png"/>

View File

@@ -77,7 +77,6 @@ namespace StructureHelper.Windows.MainWindow
public ICommand LeftButtonDown { get; } public ICommand LeftButtonDown { get; }
public ICommand LeftButtonUp { get; } public ICommand LeftButtonUp { get; }
public ICommand MovePrimitiveToGravityCenterCommand { get; } public ICommand MovePrimitiveToGravityCenterCommand { get; }
public ICommand ClearSelection { get; } public ICommand ClearSelection { get; }
public ICommand OpenMaterialCatalog { get; } public ICommand OpenMaterialCatalog { get; }
public ICommand OpenMaterialCatalogWithSelection { get; } public ICommand OpenMaterialCatalogWithSelection { get; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -23,7 +23,7 @@
Grid.Row="0" Grid.Row="0"
Grid.Column="0" Grid.Column="0"
Margin="5" Margin="5"
ItemsSource="{Binding FirstGeneration}"> ItemsSource="{Binding Tree}">
<TreeView.ItemContainerStyle> <TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}"> <Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" /> <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />

View File

@@ -22,7 +22,7 @@ namespace StructureHelper.Windows.TreeGraph
private LineSeries lineSeries; private LineSeries lineSeries;
private SeriesCollection seriesCollection; private SeriesCollection seriesCollection;
private List<string> labels; private List<string> labels;
readonly ObservableCollection<TreeViewItemViewModel> _firstGeneration; readonly ObservableCollection<TreeViewItemViewModel> _tree;
readonly TreeViewItemViewModel _rootFunction; readonly TreeViewItemViewModel _rootFunction;
readonly ICommand _searchCommand; readonly ICommand _searchCommand;
private RelayCommand _getYCommand; private RelayCommand _getYCommand;
@@ -76,9 +76,9 @@ namespace StructureHelper.Windows.TreeGraph
get => _treeGraphView_win; get => _treeGraphView_win;
set => _treeGraphView_win = value; set => _treeGraphView_win = value;
} }
public ObservableCollection<TreeViewItemViewModel> FirstGeneration public ObservableCollection<TreeViewItemViewModel> Tree
{ {
get => _firstGeneration; get => _tree;
} }
public GraphVisualProps VisualProps { get; } = new GraphVisualProps(); public GraphVisualProps VisualProps { get; } = new GraphVisualProps();
public ICommand GetYCommand public ICommand GetYCommand
@@ -105,7 +105,7 @@ namespace StructureHelper.Windows.TreeGraph
{ {
_rootFunction = new TreeViewItemViewModel(rootFunction, this); _rootFunction = new TreeViewItemViewModel(rootFunction, this);
_firstGeneration = new ObservableCollection<TreeViewItemViewModel> _tree = new ObservableCollection<TreeViewItemViewModel>
( (
new ObservableCollection<TreeViewItemViewModel>() new ObservableCollection<TreeViewItemViewModel>()
{ {

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Enums
{
public enum FunctionPurpose
{
StressStrain,
FireProtection
}
}

View File

@@ -19,6 +19,7 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
public bool IsUser { get; set; } public bool IsUser { get; set; }
public string Group { get; set; } public string Group { get; set; }
public FunctionType Type { get; set; } public FunctionType Type { get; set; }
public FunctionPurpose FunctionPurpose { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
public List<GraphPoint> Table { get; set; } public List<GraphPoint> Table { get; set; }

View File

@@ -20,6 +20,7 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
public bool IsUser { get; set; } public bool IsUser { get; set; }
public string Group { get; set; } public string Group { get; set; }
public FunctionType Type { get; set; } public FunctionType Type { get; set; }
public FunctionPurpose FunctionPurpose { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
public double MinArg { get; set; } public double MinArg { get; set; }
@@ -27,6 +28,7 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
public Color Color { get; set; } public Color Color { get; set; }
public string Trace { get; set; } public string Trace { 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 GraphSettings GetGraphSettings(); public GraphSettings GetGraphSettings();

View File

@@ -2,6 +2,7 @@
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Codes; using StructureHelperCommon.Models.Codes;
using StructureHelperCommon.Models.Codes.Factories; using StructureHelperCommon.Models.Codes.Factories;
using StructureHelperCommon.Models.Functions;
using StructureHelperCommon.Models.Materials; using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries; using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperCommon.Models.Projects; using StructureHelperCommon.Models.Projects;
@@ -41,7 +42,8 @@ namespace StructureHelperCommon.Infrastructures.Settings
public static LimitStatesList LimitStatesList => new LimitStatesList(); public static LimitStatesList LimitStatesList => new LimitStatesList();
public static CalcTermList CalcTermList => new CalcTermList(); public static CalcTermList CalcTermList => new CalcTermList();
public static List<ICodeEntity> CodesList public static List<ICodeEntity> CodesList
{ get {
get
{ {
codesList ??= CodeFactory codesList ??= CodeFactory
.GetCodeEntities() .GetCodeEntities()
@@ -92,6 +94,33 @@ namespace StructureHelperCommon.Infrastructures.Settings
SubVersionNumber = 0 SubVersionNumber = 0
}; };
} }
public static ObservableCollection<IOneVariableFunction> Functions { get; set; } public static ObservableCollection<IOneVariableFunction> Functions { get; set; } = new ObservableCollection<IOneVariableFunction>
{
new TableFunction()
{
Name = "Табличная системная функция",
Table = new List<GraphPoint>()
{
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 FormulaFunction()
{
Name = "Формульная системная функция",
Formula = "x^2",
Step = 100,
MinArg = 1,
MaxArg = 1000,
IsUser = false,
Description = "Пример описания",
}
};
} }
} }

View File

@@ -27,6 +27,7 @@ namespace StructureHelperCommon.Models.Functions
public const string GROUP_TYPE_2 = "User function"; public const string GROUP_TYPE_2 = "User function";
public bool IsUser { get; set; } public bool IsUser { get; set; }
public FunctionType Type { get; set; } public FunctionType Type { get; set; }
public FunctionPurpose FunctionPurpose { get; set; }
public string Group { get; set; } public string Group { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get ; set; } public string Description { get ; set; }

View File

@@ -24,6 +24,7 @@ namespace StructureHelperCommon.Models.Functions
public bool IsUser { get; set; } public bool IsUser { get; set; }
public FunctionType Type { get; set; } public FunctionType Type { get; set; }
public FunctionPurpose FunctionPurpose { get; set; }
public string Group { get; set; } public string Group { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<ItemGroup>
<Compile Update="Windows\FunctionSelectionView.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="Windows\FunctionSelectionView.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,23 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Functions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Windows
{
public class FunctionSelectionVM
{
public string SHORT_TERM { get; } = "Short Term";
public string LONG_TERM { get; } = "Long Term";
public string ULS { get; } = "Ultimate Limit State (ULS)";
public string SLS { get; } = "Serviceability Limit State (SLS)";
public string SPECIAL { get; } = "Special Limit State";
public string CREATE_MATERIAL { get; } = "Create Function Material";
public ObservableCollection<IOneVariableFunction> Functions { get; set; } = ProgramSetting.Functions;
}
}

View File

@@ -0,0 +1,86 @@
<Window x:Class="StructureHelperCommon.Windows.FunctionSelectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelperCommon.Windows"
mc:Ignorable="d"
Title="FunctionMaterial" Height="250" Width="860">
<!--Window.DataContext>
<local:FunctionSelectionVM/>
</Window.DataContext-->
<Window.Resources>
<Style x:Key="BoarderPropertyStyle" TargetType="Border">
<Setter Property="Background" Value="LightYellow"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="2"/>
</Style>
<Style x:Key="BoarderValueStyle" TargetType="Border">
<Setter Property="Background" Value="AliceBlue"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="2"/>
</Style>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="Background" Value="LightYellow"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="FuncComboBox" TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding Functions}"/>
<Setter Property="DisplayMemberPath" Value="Name"/>
<Setter Property="Margin" Value="10"/>
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="220"/>
<ColumnDefinition Width="220"/>
<ColumnDefinition Width="220"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Border Grid.Column="0" Grid.Row="0"/>
<Border Grid.Column="0" Grid.Row="1" Style="{StaticResource BoarderPropertyStyle}"/>
<Border Grid.Column="0" Grid.Row="2" Style="{StaticResource BoarderPropertyStyle}"/>
<Border Grid.Column="1" Grid.Row="0" Style="{StaticResource BoarderPropertyStyle}"/>
<Border Grid.Column="1" Grid.Row="1" Style="{StaticResource BoarderValueStyle}"/>
<Border Grid.Column="1" Grid.Row="2" Style="{StaticResource BoarderValueStyle}"/>
<Border Grid.Column="2" Grid.Row="0" Style="{StaticResource BoarderPropertyStyle}"/>
<Border Grid.Column="2" Grid.Row="1" Style="{StaticResource BoarderValueStyle}"/>
<Border Grid.Column="2" Grid.Row="2" Style="{StaticResource BoarderValueStyle}"/>
<Border Grid.Column="3" Grid.Row="0" Style="{StaticResource BoarderPropertyStyle}"/>
<Border Grid.Column="3" Grid.Row="1" Style="{StaticResource BoarderValueStyle}"/>
<Border Grid.Column="3" Grid.Row="2" Style="{StaticResource BoarderValueStyle}"/>
<TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding SHORT_TERM}" Style="{StaticResource TextBlockStyle}"/>
<TextBlock Grid.Column="0" Grid.Row="2" Text="{Binding LONG_TERM}" Style="{StaticResource TextBlockStyle}"/>
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding ULS}" Style="{StaticResource TextBlockStyle}"/>
<TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding SLS}" Style="{StaticResource TextBlockStyle}"/>
<TextBlock Grid.Column="3" Grid.Row="0" Text="{Binding SPECIAL}" Style="{StaticResource TextBlockStyle}"/>
<ComboBox Style="{StaticResource FuncComboBox}"
Grid.Column="1" Grid.Row="1"/>
<ComboBox Style="{StaticResource FuncComboBox}"
Grid.Column="1" Grid.Row="2"/>
<ComboBox Style="{StaticResource FuncComboBox}"
Grid.Column="2" Grid.Row="1"/>
<ComboBox Style="{StaticResource FuncComboBox}"
Grid.Column="2" Grid.Row="2"/>
<ComboBox Style="{StaticResource FuncComboBox}"
Grid.Column="3" Grid.Row="1"/>
<ComboBox Style="{StaticResource FuncComboBox}"
Grid.Column="3" Grid.Row="2"/>
<Button Grid.Column="3"
Grid.Row="3"
Margin="10"
Content="{Binding CREATE_MATERIAL}"/>
</Grid>
</Window>

View File

@@ -0,0 +1,33 @@
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 StructureHelperCommon.Windows
{
/// <summary>
/// Interaction logic for FunctionSelection.xaml
/// </summary>
public partial class FunctionSelectionView : Window
{
private FunctionSelectionVM viewModel;
public FunctionSelectionView(FunctionSelectionVM viewModel)
{
this.viewModel = viewModel;
DataContext = this.viewModel;
InitializeComponent();
}
public FunctionSelectionView() : this(new FunctionSelectionVM())
{
}
}
}

View File

@@ -5,6 +5,7 @@ using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Codes; using StructureHelperCommon.Models.Codes;
using StructureHelperCommon.Models.Materials.Libraries; using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperCommon.Windows;
using System; using System;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Collections.Generic; using System.Collections.Generic;
@@ -107,6 +108,8 @@ namespace StructureHelperLogics.Models.Materials
} }
private static IHeadMaterial GetFunction() private static IHeadMaterial GetFunction()
{ {
var functionSelectionView = new FunctionSelectionView();
functionSelectionView.ShowDialog();
var material = new HeadMaterial(); var material = new HeadMaterial();
material.HelperMaterial = new FunctionMaterial() { Modulus = 2e11d, CompressiveStrength = 4e8d, TensileStrength = 4e8d }; material.HelperMaterial = new FunctionMaterial() { Modulus = 2e11d, CompressiveStrength = 4e8d, TensileStrength = 4e8d };
return material; return material;