Material diagram window was changed

This commit is contained in:
Evgeny Redikultsev
2023-11-20 21:54:19 +05:00
parent 68b03bdf01
commit 4a8cf2d42a
27 changed files with 105 additions and 103 deletions

View File

@@ -17,6 +17,7 @@
<ResourceDictionary Source="Infrastructure/UI/Resources/ITemEditPanels.xaml"/>
<ResourceDictionary Source="Infrastructure/UI/Resources/ForceTemplates.xaml"/>
<ResourceDictionary Source="Infrastructure/UI/Resources/IconDictionary.xaml"/>
<ResourceDictionary Source="Infrastructure/UI/Resources/GraphsTemplates.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@@ -0,0 +1,19 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DataTemplate x:Key="LineVisualProperties">
<GroupBox Header="Line properties">
<StackPanel>
<TextBlock Text="Line smoothness" Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal">
<Slider x:Name="slider" Width="195" Minimum="0" Maximum="{Binding MaxLineSmoothness}" Value="{Binding LineSmoothness}"/>
<TextBox Width="40" Text="{Binding LineSmoothness,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel>
<TextBlock Text="Stroke thickness" Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal">
<Slider x:Name="StrokeSlider" Width="195" Minimum="0" Maximum="{Binding MaxStrokeSize}" Value="{Binding StrokeSize}"/>
<TextBox Width="40" Text="{Binding StrokeSize,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel>
</StackPanel>
</GroupBox>
</DataTemplate>
</ResourceDictionary>

View File

@@ -82,6 +82,7 @@
<Folder Include="Infrastructure\UI\DataContexts\Logics\" />
<Folder Include="Resources\" />
<Folder Include="Windows\UserControls\MultiplyTuples\" />
<Folder Include="Windows\ViewModels\Graphs\" />
</ItemGroup>
<ItemGroup>

View File

@@ -33,7 +33,7 @@
<Compile Update="Windows\MainWindow\Materials\HeadMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml.cs">
<Compile Update="Windows\Graphs\MaterialDiagramView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs">
@@ -47,6 +47,9 @@
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Infrastructure\UI\Resources\GraphsTemplates.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Infrastructure\UI\Resources\IconDictionary.xaml">
<SubType>Designer</SubType>
</Page>
@@ -77,7 +80,7 @@
<Page Update="Windows\MainWindow\Materials\HeadMaterialView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml">
<Page Update="Windows\Graphs\MaterialDiagramView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml">

View File

@@ -3,12 +3,11 @@
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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:local="clr-namespace:StructureHelper.Windows.Graphs"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Graphs"
d:DataContext="{d:DesignInstance vm:GraphViewModel}"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
d:DataContext="{d:DesignInstance local:GraphViewModel}"
mc:Ignorable="d"
Title="Graph" Height="450" Width="800" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen">
Title="Graph" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
<DockPanel>
<!--<ToolBarTray DockPanel.Dock="Top">
<ToolBar>
@@ -27,8 +26,13 @@
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<StackPanel>
<GroupBox Header="X-axis values">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition/>
<RowDefinition Height="120"/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="X-axis values">
<StackPanel>
<ComboBox ItemsSource="{Binding XItems.Collection}" SelectedItem="{Binding XItems.SelectedItem}">
<ComboBox.ItemTemplate>
@@ -52,28 +56,18 @@
</StackPanel>
</GroupBox>
<GroupBox Header="Y-axis values">
<StackPanel>
<GroupBox Grid.Row="1" Header="Y-axis values">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding YItems}"/>
<CheckBox Margin="5" Content="Invert Values" IsChecked="{Binding InvertYValues}"/>
</StackPanel>
<CheckBox Grid.Row="1" Margin="5" Content="Invert Values" IsChecked="{Binding InvertYValues}"/>
</Grid>
</GroupBox>
<GroupBox Header="Line properties" DataContext="{Binding VisualProps}">
<StackPanel>
<TextBlock Text="Line smoothness" Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal">
<Slider x:Name="slider" Width="195" Minimum="0" Maximum="{Binding MaxLineSmoothness}" Value="{Binding LineSmoothness}"/>
<TextBox Width="40" Text="{Binding LineSmoothness,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel>
<TextBlock Text="Stroke thickness" Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal">
<Slider x:Name="StrokeSlider" Width="195" Minimum="0" Maximum="{Binding MaxStrokeSize}" Value="{Binding StrokeSize}"/>
<TextBox Width="40" Text="{Binding StrokeSize,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel>
</StackPanel>
</GroupBox>
</StackPanel>
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource ResourceKey=LineVisualProperties}" Content="{Binding VisualProps}"/>
</Grid>
<StackPanel Grid.Row="1">
<Button Margin="3" Content="Draw Lines" ToolTip="Draw Lines" Command="{Binding RedrawLinesCommand}"/>
</StackPanel>

View File

@@ -1,5 +1,4 @@
using LiveCharts.Wpf;
using StructureHelper.Windows.ViewModels.Graphs;
using StructureHelperCommon.Models.Parameters;
using System;
using System.Collections.Generic;

View File

@@ -1,10 +1,9 @@
using LiveCharts;
using LiveCharts.Configurations;
using LiveCharts.Definitions.Charts;
using LiveCharts.Wpf;
using LiveCharts.Wpf.Charts.Base;
using StructureHelper.Infrastructure;
using StructureHelper.Services.Exports;
using StructureHelper.Windows.ViewModels;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ColorServices;
@@ -12,15 +11,13 @@ using StructureHelperLogics.NdmCalculations.Analyses;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace StructureHelper.Windows.ViewModels.Graphs
namespace StructureHelper.Windows.Graphs
{
public class GraphViewModel : ViewModelBase
{
@@ -184,7 +181,7 @@ namespace StructureHelper.Windows.ViewModels.Graphs
double diagramValue = yValues[i] * yFactor;
var x = xValues[i] * xFactor;
var y = yValues[i] * yFactor;
var point = new Point2D() { X = x, Y = y};
var point = new Point2D() { X = x, Y = y };
chartValues.Add(point);
labels.Add(x);
localLabels.Add(x);

View File

@@ -1,11 +1,7 @@
using StructureHelper.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.Graphs
namespace StructureHelper.Windows.Graphs
{
public class GraphVisualProps : ViewModelBase
{
@@ -38,7 +34,7 @@ namespace StructureHelper.Windows.ViewModels.Graphs
}
}
public double MaxLineSmoothness { get;}
public double MaxLineSmoothness { get; }
public double MaxStrokeSize { get; }
public GraphVisualProps()

View File

@@ -3,10 +3,9 @@
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:StructureHelper.Windows.MainWindow.Materials"
xmlns:local="clr-namespace:StructureHelper.Windows.Graphs"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Materials"
d:DataContext="{d:DesignInstance vm:MaterialDiagramViewModel}"
d:DataContext="{d:DesignInstance local:MaterialDiagramViewModel}"
mc:Ignorable="d"
Title="Material Diagram" Height="450" Width="800" WindowStartupLocation="CenterScreen">
<Grid>
@@ -17,6 +16,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="120"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto">
@@ -52,9 +52,12 @@
</Grid>
</StackPanel>
</ScrollViewer>
<Button Grid.Row="1" Margin="3" Content="Draw Lines" ToolTip="Draw lines" Command="{Binding RedrawLinesCommand}"/>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource ResourceKey=LineVisualProperties}" Content="{Binding VisualProps}"/>
<StackPanel Grid.Row="2" Orientation="Horizontal">
<Button Margin="3" Content="Draw Lines" ToolTip="Draw lines" Command="{Binding RedrawLinesCommand}"/>
</StackPanel>
</Grid>
<lvc:CartesianChart Grid.Column="1" Series="{Binding SeriesCollection}" LegendLocation="Bottom" >
<lvc:CartesianChart Grid.Column="1" Series="{Binding SeriesCollection}" LegendLocation="Bottom" Zoom="Xy">
<lvc:CartesianChart.AxisY>
<lvc:Axis Title="Stress"></lvc:Axis>
</lvc:CartesianChart.AxisY>

View File

@@ -14,7 +14,7 @@ using System.Windows.Shapes;
using LiveCharts;
using LiveCharts.Wpf;
using StructureHelper.Models.Materials;
using StructureHelper.Windows.ViewModels.Materials;
using StructureHelper.Windows.Graphs;
using StructureHelperLogics.Models.Materials;
namespace StructureHelper.Windows.MainWindow.Materials

View File

@@ -3,19 +3,15 @@ using LiveCharts.Wpf;
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.UI.Converters.Units;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelper.Windows.ViewModels;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace StructureHelper.Windows.ViewModels.Materials
namespace StructureHelper.Windows.Graphs
{
public class MaterialDiagramViewModel : ViewModelBase
{
@@ -27,6 +23,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
bool positiveInTension;
public string MaterialName => material.Name;
public GraphVisualProps VisualProps { get; }
public double MinValue
{
get => minValue;
@@ -84,9 +81,9 @@ namespace StructureHelper.Windows.ViewModels.Materials
public MaterialDiagramViewModel(IEnumerable<IHeadMaterial> headMaterials, IHeadMaterial material)
{
MaterialsModel = new SelectItemsViewModel<IHeadMaterial>(headMaterials) { ShowButtons = true};
LimitStatesModel = new SelectItemsViewModel<LimitStateEntity>(ProgramSetting.LimitStatesList.LimitStates) { ShowButtons = false};
CalcTermsModel = new SelectItemsViewModel<CalcTermEntity>(ProgramSetting.CalcTermList.CalcTerms) { ShowButtons = false};
MaterialsModel = new SelectItemsViewModel<IHeadMaterial>(headMaterials) { ShowButtons = true };
LimitStatesModel = new SelectItemsViewModel<LimitStateEntity>(ProgramSetting.LimitStatesList.LimitStates) { ShowButtons = false };
CalcTermsModel = new SelectItemsViewModel<CalcTermEntity>(ProgramSetting.CalcTermList.CalcTerms) { ShowButtons = false };
foreach (var item in MaterialsModel.CollectionItems)
{
if (item.Item == material)
@@ -100,6 +97,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
maxValue = 0.005d;
stepCount = 50;
positiveInTension = true;
VisualProps = new();
SetLines();
}
@@ -123,9 +121,13 @@ namespace StructureHelper.Windows.ViewModels.Materials
{
var loaderMaterial = material.GetLoaderMaterial(limitState.LimitState, calcTerm.CalcTerm);
var lineSeries = new LineSeries()
{ Title = $"{material.Name} ({calcTerm.ShortName} {limitState.ShortName})",
PointGeometry = null,
{
Title = $"{material.Name} ({calcTerm.ShortName} {limitState.ShortName})",
//Stroke = new SolidColorBrush(material.Color),
Fill = Brushes.Transparent,
LineSmoothness = VisualProps.LineSmoothness,
PointGeometry = DefaultGeometries.Circle,
PointGeometrySize = VisualProps.StrokeSize
};
if (limitStates.Count() == 1 && calcTerms.Count() == 1)
{
@@ -139,7 +141,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
//var point = new PointF() { X = (float)s, Y = (float)diagramValue };
//chartValues.Add(point);
chartValues.Add(diagramValue);
labels.Add(Convert.ToString(Math.Round(s , 4)));
labels.Add(Convert.ToString(Math.Round(s, 4)));
}
lineSeries.Values = chartValues;
SeriesCollection.Add(lineSeries);

View File

@@ -1,27 +1,16 @@
using LoaderCalculator;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderCalculator.Data.Ndms;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelper.Windows.ViewModels.Graphs;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Services.Units;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
{

View File

@@ -1,13 +1,8 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Materials.Libraries;
using System.Windows.Media.Media3D;
using static System.Windows.Forms.Design.AxImporter;
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
public class ConcreteCurveLogic : IMaterialLogic
{

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
public class ConcreteLogicOptions : IMaterialLogicOptions
{

View File

@@ -10,7 +10,7 @@ using static System.Windows.Forms.Design.AxImporter;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Models.Materials.Libraries;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
internal class ConcreteMaterialOptionLogic : IMaterialOptionLogic
{

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
public interface IMaterialLogic
{

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
public interface IMaterialLogicOptions
{

View File

@@ -0,0 +1,12 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials.Libraries;
using LCM = LoaderCalculator.Data.Materials;
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
namespace StructureHelperCommon.Models.Materials
{
public interface IMaterialOptionLogic
{
void SetMaterialOptions(LCMB.IMaterialOptions materialOptions);
}
}

View File

@@ -2,7 +2,7 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
public class MaterialCommonOptionLogic : IMaterialOptionLogic
{

View File

@@ -1,16 +1,8 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Windows.Forms.Design.AxImporter;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
public class ReinforcementBiLinearLogic : IMaterialLogic
{

View File

@@ -6,9 +6,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
namespace StructureHelperCommon.Models.Materials
{
internal class ReinforcementLogicOptions : IMaterialLogicOptions
public class ReinforcementLogicOptions : IMaterialLogicOptions
{
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
public ILibMaterialEntity MaterialEntity { get; set; }

View File

@@ -6,6 +6,7 @@ using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
using LM = LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Materials;
namespace StructureHelperLogics.Models.Materials
{

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperLogics.Models.Materials;
using System;

View File

@@ -1,6 +1,7 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries;
using System.Collections.Generic;
using LCM = LoaderCalculator.Data.Materials;

View File

@@ -9,6 +9,7 @@ using Loadermaterials = LoaderCalculator.Data.Materials;
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Models.Materials;
namespace StructureHelperLogics.Models.Materials
{

View File

@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using StructureHelper.Windows.ViewModels.Graphs;
using NUnit.Framework;
using StructureHelper.Windows.Graphs;
using StructureHelperCommon.Models.Parameters;
namespace StructureHelperTests.ViewModelTests