Checkig Iput data of crack calculator was changed

This commit is contained in:
Evgeny Redikultsev
2024-05-26 11:35:48 +05:00
parent 16cef8e98e
commit d13304fe06
50 changed files with 901 additions and 206 deletions

View File

@@ -6,11 +6,18 @@
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
d:DataContext="{d:DesignInstance local:CrackResultViewModel}"
mc:Ignorable="d"
Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000">
Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Windows/CalculationWindows/CalculatorsViews/Cracks/Cracks.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<DockPanel>
<ToolBarTray DockPanel.Dock="Top">
<ToolBar>
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowRebarsCommand}" ToolTip="Show isofield results">
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowRebarsCommand}" ToolTip="Show results by rebars">
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource ShowRebarsResult}"/>
</Viewbox>
@@ -32,13 +39,14 @@
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding IsValid}" Value="false">
<Setter Property="Background" Value="Pink"/>
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
<DataGridTextColumn Header="Action name" Binding="{Binding InputData.TupleName}" Width="120"/>
<DataGridTemplateColumn Header="Combination term" Width="120">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@@ -98,34 +106,7 @@
<DataGridTemplateColumn Header="Crack width" Width="140">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.CrackWidth, Converter={StaticResource LengthConverter}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding LongTermResult.IsCrackLessThanUltimate}" Value="false">
<Setter Property="Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.CrackWidth, Converter={StaticResource LengthConverter}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding ShortTermResult.IsCrackLessThanUltimate}" Value="false">
<Setter Property="Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

View File

@@ -5,14 +5,41 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
public class CrackResultViewModel : ViewModelBase
{
CrackResult crackResult;
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
private CrackResult crackResult;
private RelayCommand? showIsoFieldCommand;
private RelayCommand? showRebarsCommand;
public TupleCrackResult SelectedResult { get; set; }
public List<TupleCrackResult> TupleResults => CrackResult.TupleResults;
public ICommand ShowRebarsCommand
{
get
{
return showRebarsCommand ??= new RelayCommand(o =>
{
var wnd = new TupleCrackResultView(SelectedResult);
wnd.ShowDialog();
}, o => SelectedResult != null && SelectedResult.IsValid);
}
}
public ICommand ShowIsoFieldCommand
{
get
{
return showIsoFieldCommand ??= new RelayCommand(o =>
{
showCrackIsoFieldsLogic.ShowIsoField(SelectedResult.RebarResults);
}, o => SelectedResult != null && SelectedResult.IsValid);
}
}
public CrackResult CrackResult => crackResult;

View File

@@ -0,0 +1,27 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DataTemplate x:Key="CrackTextBox">
<TextBlock Grid.Row="0" Text="{Binding CrackWidth, Converter={StaticResource LengthConverter}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsCrackLessThanUltimate}" Value="false">
<Setter Property="Background" Value="{StaticResource WarningColorBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
<DataTemplate x:Key="CrackGrid">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ContentControl ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding LongTermResult}"/>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding ShortTermResult}"/>
</Grid>
</DataTemplate>
</ResourceDictionary>

View File

@@ -0,0 +1,10 @@
using StructureHelperLogics.NdmCalculations.Cracking;
using System.Collections.Generic;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
public interface IShowCrackIsoFieldsLogic
{
void ShowIsoField(IEnumerable<RebarCrackResult> rebarResults);
}
}

View File

@@ -0,0 +1,37 @@
using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperLogics.NdmCalculations.Cracking;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
public class ShowCrackIsoFieldsLogic : IShowCrackIsoFieldsLogic
{
private IsoFieldReport isoFieldReport;
public void ShowIsoField(IEnumerable<RebarCrackResult> rebarResults)
{
try
{
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(rebarResults, CrackResultFuncFactory.GetResultFuncs());
isoFieldReport = new IsoFieldReport(primitiveSets);
isoFieldReport.Show();
}
catch (Exception ex)
{
var vm = new ErrorProcessor()
{
ShortText = "Errors apearred during showing isofield, see detailed information",
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
}
}
}
}

View File

@@ -4,11 +4,104 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
d:DataContext="{d:DesignInstance local:TupleCrackResultViewModel}"
mc:Ignorable="d"
Title="TupleCrackResultView" Height="450" Width="800">
<Grid>
<DataGrid>
Title="TupleCrackResultView" Height="450" Width="800" MinHeight="300" MinWidth="500" MaxHeight="1000" MaxWidth="1200" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Windows/CalculationWindows/CalculatorsViews/Cracks/Cracks.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<DockPanel>
<ToolBarTray DockPanel.Dock="Top">
<ToolBar>
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}" ToolTip="Show isofield results">
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/>
</Viewbox>
</Button>
</ToolBar>
</ToolBarTray>
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding RebarResults}" SelectedItem="{Binding SelectedResult}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding IsValid}" Value="false">
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding IsValid}"/>
<DataGridTextColumn Header="Rebar name" Binding="{Binding RebarPrimitive.Name}" Width="120" CanUserSort="True"/>
<DataGridTemplateColumn Header="Combination term" Width="120">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Long-term" />
<TextBlock Grid.Row="1" Text="Short-term" />
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Rebar stress" Width="120">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.RebarStress, Converter={StaticResource StressConverter}}"/>
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.RebarStress, Converter={StaticResource StressConverter}}"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Rebar strain" Width="120">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.RebarStrain}"/>
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.RebarStrain}"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Ref. concrete strain" Width="120">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.ConcreteStrain}"/>
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.ConcreteStrain}"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Crack width" Width="140">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</DockPanel>
</Window>

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperLogics.NdmCalculations.Cracking;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -19,9 +20,16 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
/// </summary>
public partial class TupleCrackResultView : Window
{
public TupleCrackResultView()
TupleCrackResultViewModel viewModel;
public TupleCrackResultView(TupleCrackResultViewModel viewModel)
{
InitializeComponent();
this.viewModel = viewModel;
DataContext = this.viewModel;
}
public TupleCrackResultView(TupleCrackResult crackResult) : this(new TupleCrackResultViewModel(crackResult))
{
}
}
}

View File

@@ -1,12 +1,45 @@
using System;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using StructureHelper.Infrastructure;
using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperLogics.NdmCalculations.Cracking;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
public class TupleCrackResultViewModel
public class TupleCrackResultViewModel : ViewModelBase
{
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
private TupleCrackResult crackResult;
private RelayCommand showIsoFieldCommand;
private IsoFieldReport isoFieldReport;
public TupleCrackResult CrackResult => crackResult;
public List<RebarCrackResult> RebarResults => crackResult.RebarResults;
public RebarCrackResult SelectedResult { get; set; }
public ICommand ShowIsoFieldCommand
{
get
{
return showIsoFieldCommand ??= new RelayCommand(o =>
{
showCrackIsoFieldsLogic.ShowIsoField(crackResult.RebarResults);
});
}
}
public TupleCrackResultViewModel(TupleCrackResult crackResult)
{
this.crackResult = crackResult;
}
}
}

View File

@@ -24,7 +24,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
//LimitState = LimitState,
//CalcTerm = CalcTerm,
LongTermTuple = ForceTuple,
NdmPrimitives = ndmPrimitives
Primitives = ndmPrimitives
};
var calculator = new TupleCrackCalculator() { InputData = inputData };
calculator.Run();

View File

@@ -22,7 +22,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private List<(INamedAreaPoint areaPoint, INdmPrimitive ndmPrimitive)> pointCollection;
private List<IForcesTupleResult> validTuplesList;
private ArrayParameter<double> arrayOfValuesByPoint;
private IEnumerable<IResultFunc> selectedDelegates;
private IEnumerable<ForceResultFunc> selectedDelegates;
private string exceptionMessage;
public IEnumerable<IForcesTupleResult> TupleList { get; set; }
@@ -154,7 +154,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
+ userPrestrain.Nz + autoPrestrain.Nz;
return ndm;
}
private List<string> GetValueLabels(IEnumerable<IResultFunc> selectedDelegates)
private List<string> GetValueLabels(IEnumerable<ForceResultFunc> selectedDelegates)
{
List<string> strings = new();
foreach (var valuePoint in pointCollection)

View File

@@ -416,7 +416,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
try
{
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ForceResultFuncFactory.GetResultFuncs());
isoFieldReport = new IsoFieldReport(primitiveSets);
isoFieldReport.Show();
}
@@ -429,7 +429,6 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
};
new ErrorMessage(vm).ShowDialog();
}
}
private void GetNdms()
{